mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Updated zoom user controls on the new map plug-in
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@850 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
b2840b41ef
commit
8c5375d5ab
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>441</height>
|
||||
<width>656</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -239,29 +239,28 @@ color: rgb(255, 255, 255);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelZoom">
|
||||
<widget class="QComboBox" name="comboBoxZoom">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
<property name="toolTip">
|
||||
<string>Zoom level</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(255, 255, 255, 0);
|
||||
color: rgb(255, 255, 255);</string>
|
||||
<string notr="true">color: rgb(255, 255, 255);
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom</string>
|
||||
<property name="maxVisibleItems">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -651,8 +650,6 @@ border: none;
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>labelMapPos</zorder>
|
||||
<zorder>layoutWidget_2</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -72,19 +72,23 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging
|
||||
}
|
||||
|
||||
// **************
|
||||
|
||||
createActions();
|
||||
|
||||
// **************
|
||||
// set the user control options
|
||||
|
||||
m_widget->labelZoom->setText(QString::number(m_map->Zoom()));
|
||||
m_widget->labelRotate->setText(QString::number(m_map->Rotate()));
|
||||
// m_widget->labelNumTilesToLoad->setText(" 0");
|
||||
m_widget->labelMapPos->setText("");
|
||||
m_widget->labelMousePos->setText("");
|
||||
m_widget->progressBarMap->setMaximum(1);
|
||||
|
||||
// **************
|
||||
|
||||
createActions();
|
||||
m_widget->comboBoxZoom->clear();
|
||||
for (int i = 2; i <= 19; i++)
|
||||
m_widget->comboBoxZoom->addItem(QString::number(i), i);
|
||||
m_widget->comboBoxZoom->setCurrentIndex((int)(m_map->Zoom() + 0.5) - 2);
|
||||
|
||||
// **************
|
||||
// map stuff
|
||||
@ -141,6 +145,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_statusUpdateTimer->start();
|
||||
|
||||
// **************
|
||||
|
||||
connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int)));
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
@ -335,7 +341,13 @@ void OPMapGadgetWidget::zoomChanged(double zoom)
|
||||
int i_zoom = (int)(zoom + 0.5);
|
||||
|
||||
if (m_widget)
|
||||
m_widget->labelZoom->setText(" " + QString::number(zoom));
|
||||
{
|
||||
// m_widget->labelZoom->setText(" " + QString::number(zoom));
|
||||
|
||||
disconnect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, 0);
|
||||
m_widget->comboBoxZoom->setCurrentIndex(i_zoom - 2);
|
||||
connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int)));
|
||||
}
|
||||
|
||||
switch (i_zoom)
|
||||
{
|
||||
@ -364,7 +376,7 @@ void OPMapGadgetWidget::zoomChanged(double zoom)
|
||||
void OPMapGadgetWidget::OnMapDrag()
|
||||
{
|
||||
if (followUAVAct->isChecked())
|
||||
followUAVAct->setChecked(false); // disable follow UAV mode
|
||||
followUAVAct->setChecked(false); // disable follow UAV mode when the user starts to manually drag the map
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point)
|
||||
@ -498,6 +510,14 @@ void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_comboBoxZoom_currentIndexChanged(int index)
|
||||
{
|
||||
bool ok;
|
||||
int i = (int)m_widget->comboBoxZoom->itemData(index).toInt(&ok);
|
||||
setZoom(2 + index);
|
||||
}
|
||||
|
||||
|
||||
// *************************************************************************************
|
||||
// public functions
|
||||
|
||||
|
@ -78,6 +78,7 @@ private slots:
|
||||
void on_toolButtonZoomP_clicked();
|
||||
void on_pushButtonGeoFenceM_clicked();
|
||||
void on_pushButtonGeoFenceP_clicked();
|
||||
void on_comboBoxZoom_currentIndexChanged(int index);
|
||||
|
||||
// map signals
|
||||
void zoomChanged(double zoom);
|
||||
|
Loading…
Reference in New Issue
Block a user