添加鼠标经纬度
This commit is contained in:
@@ -182,6 +182,9 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
|
||||
this,SLOT(NOPTimeout()));
|
||||
NoOperationTimer->start(20000);//20s不操作
|
||||
|
||||
mouseInfo = new QGraphicsTextItem();
|
||||
mouseInfo->setDefaultTextColor(Qt::white);
|
||||
mscene.addItem(mouseInfo);
|
||||
|
||||
|
||||
currentGroup = 3;
|
||||
@@ -621,11 +624,20 @@ void OPMapWidget::resizeEvent(QResizeEvent *event)
|
||||
QRect(QPoint(0,0), event->size()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QGraphicsView::resizeEvent(event);
|
||||
if (compass) {
|
||||
compass->setScale(0.1 + 0.05 * (qreal)(event->size().width()) / 1000 * (qreal)(event->size().height()) / 600);
|
||||
}
|
||||
|
||||
|
||||
if(mouseInfo) {
|
||||
mouseInfo->setPos(this->width() - 200,this->height() - 100);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
QSize OPMapWidget::sizeHint() const
|
||||
{
|
||||
@@ -693,6 +705,9 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
|
||||
|
||||
|
||||
|
||||
if(altitudeitem)
|
||||
{
|
||||
if((event->pos().x() > altitudeitem->x())&&(event->pos().x() < (altitudeitem->boundingRect().width() + altitudeitem->x())) &&
|
||||
@@ -726,6 +741,17 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
currentmouseposition = map->FromLocalToLatLng(p.x(), p.y());
|
||||
|
||||
|
||||
|
||||
|
||||
QString string = QString(tr("zom:%1\nlat:%2\nlng:%3").arg(map->Zoom()).arg(QString::number(currentmouseposition.Lat(),'f',8)).arg(QString::number(currentmouseposition.Lng(),'f',8)));
|
||||
|
||||
|
||||
if(mouseInfo) {
|
||||
mouseInfo->setPlainText(string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
isLNOP = false;
|
||||
|
||||
|
||||
|
||||
@@ -503,6 +503,7 @@ private:
|
||||
|
||||
bool isMeasure = false;
|
||||
|
||||
QGraphicsTextItem *mouseInfo;
|
||||
|
||||
QString waypointMessage;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user