1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Fixed new map tooltips.

'Maybe' fixed the 'find place' combobox border colour problem on the new map plug-in.
Mouse context menu now only pops up when user clicks within map area on the new map plug-in.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@940 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-29 19:41:13 +00:00 committed by pip
parent b3f4b71192
commit 0ea6731a1e
7 changed files with 389 additions and 364 deletions

View File

@ -181,7 +181,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Height </string>
<string>Altitude</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -189,7 +189,7 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QLineEdit" name="lineEditHeight">
<widget class="QLineEdit" name="lineEditAltitude">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>299</height>
<width>476</width>
<height>289</height>
</rect>
</property>
<property name="sizePolicy">
@ -95,7 +95,7 @@ background-color: white;
color: black;
border: 1px solid black;
padding: 5px;
border-radius: 2px;
border-radius: 5px;
/* opacity: 170; */
}
</string>
@ -114,193 +114,7 @@ border-radius: 2px;
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="rightMargin">
<number>10</number>
</property>
<item row="0" column="3" rowspan="2">
<widget class="QSlider" name="verticalSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QSlider::handle:vertical {
border: 1px solid #5c5c5c;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(128, 128, 128, 255), stop:1 rgba(255, 255, 255, 255));
width: 24px;
height: 20px;
margin: -2px 0;
border-radius: 3px;
}
</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>19</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDial" name="dial">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximum">
<number>360</number>
</property>
<property name="value">
<number>180</number>
</property>
<property name="wrapping">
<bool>true</bool>
</property>
<property name="notchTarget">
<double>1.000000000000000</double>
</property>
<property name="notchesVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="toolButtonLeftPanel">
<property name="styleSheet">
<string notr="true">QToolButton { /* all types of tool button */
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
/*border-style: none;*/
border: 0px;
}
QToolButton:hover {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 160, 0, 255), stop:1 rgba(160, 100, 0, 255));
color: rgb(255, 255, 255);
}
QToolButton:pressed {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QToolButton:checked {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/left_but.png</normaloff>:/opmap/images/left_but.png</iconset>
</property>
<property name="iconSize">
<size>
<width>17</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -315,44 +129,166 @@ color: rgb(255, 255, 255);
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonRightPanel">
<property name="styleSheet">
<string notr="true">QToolButton { /* all types of tool button */
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
/*border-style: none;*/
border: 0px;
}
QToolButton:hover {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 160, 0, 255), stop:1 rgba(160, 100, 0, 255));
color: rgb(255, 255, 255);
}
QToolButton:pressed {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QToolButton:checked {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
</string>
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/right_but.png</normaloff>:/opmap/images/right_but.png</iconset>
</property>
<property name="iconSize">
<property name="minimumSize">
<size>
<width>17</width>
<height>48</height>
<width>27</width>
<height>170</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>27</width>
<height>170</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 100);
border: none;
border-radius: 12px;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<number>3</number>
</property>
<item>
<widget class="QToolButton" name="toolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/opmap/images/plus.png</normaloff>:/opmap/images/plus.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="verticalSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QSlider {
}
background-color: rgba(255, 255, 255, 0);
QSlider::handle:vertical {
border: 1px solid #5c5c5c;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(128, 128, 128, 255), stop:1 rgba(255, 255, 255, 255));
width: 24px;
height: 20px;
margin: -2px 0;
border-radius: 3px;
}
</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>19</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/opmap/images/minus.png</normaloff>:/opmap/images/minus.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -369,84 +305,106 @@ color: rgb(255, 255, 255);
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<property name="leftMargin">
<number>20</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 100);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="labelStatus">
<property name="styleSheet">
<string notr="true">QLabel { /* all label types */
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 100);
border: none;
border-radius: 8px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px; </string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelStatus">
<property name="styleSheet">
<string notr="true">QLabel { /* all label types */
color: rgb(255, 255, 255);
background-color: rgba(255, 255, 255, 0);
border: none;
border-radius: 10px;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QProgressBar {
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>labelStatus</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressBar" name="progressBarTiles">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>14</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QProgressBar {
border: nonei;
border-radius: 5px;
padding: 3px;
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
@ -457,25 +415,41 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
border: none;
border-radius: 3px;
}</string>
</property>
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
</layout>
</widget>
</property>
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="opmap.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@ -126,7 +126,7 @@ QSplitter::handle:vertical {
</column>
<column>
<property name="text">
<string>Height</string>
<string>Altitude</string>
</property>
</column>
<column>

View File

@ -118,37 +118,30 @@ border-radius: 3px;
QComboBox {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
border: 1px solid black;
border-radius: 0px;
}
QComboBox::down-arrow:on {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
top: 1px; left: 1px; /* shift the arrow when popup is open */
top: 1px; left: 1px; /* move the arrow when the popup is open */
}
QComboBox::down-arrow {
image: url(:/opmap/images/combobox_down_arrow.png);
}
QComboBox:drop-down {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));
subcontrol-origin: padding;
/* subcontrol-origin: padding;
subcontrol-position: top right;
border-left-style: 1px solid white;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
border-bottom-right-radius: 1px; */
}
QComboBox QAbstractItemView { /* the drop down list */
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
border: 2px solid darkgray;
selection-background-color: lightgray;
border-radius: 3px;
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 5px;
border-radius: 3px;
/* opacity: 170; */
selection-background-color: rgb(128, 128, 128);
border-radius: 2px;
}
</string>
</property>
@ -797,7 +790,7 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
</property>
<property name="styleSheet">
<string notr="true">
background-color: black;
/* background-color: black; */
border: 1px solid black;
QLabel { /* all label types */
@ -858,15 +851,6 @@ QComboBox:drop-down {
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 5px;
border-radius: 2px;
/* opacity: 170; */
}
</string>
</property>
</widget>
@ -918,15 +902,6 @@ QToolButton:pressed {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(180, 180, 180, 255));
color: rgb(255, 255, 255);
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 2px;
border-radius: 3px;
/* opacity: 170; */
}
</string>
</property>
<property name="frameShape">
@ -1185,15 +1160,6 @@ color: rgb(255, 255, 255);
border: none;
border-radius: 3px;
}
QToolTip {
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
border: 1px solid blacki;
padding: 5px;
border-radius: 3px;
/* opacity: 170; */
}
</string>
</property>
<property name="frameShape">

View File

@ -24,7 +24,7 @@
<number>5</number>
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_3" rowstretch="0,0,0,0,0,0,0">
<item row="4" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
@ -37,6 +37,15 @@
</item>
<item row="4" column="3">
<widget class="QDoubleSpinBox" name="longitudeSpinBox">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="decimals">
<number>8</number>
</property>
@ -63,6 +72,15 @@
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="latitudeSpinBox">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="decimals">
<number>8</number>
</property>
@ -86,6 +104,18 @@
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="zoomSpinBox">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>18</number>
</property>
@ -106,6 +136,12 @@
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="maxVisibleItems">
<number>15</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
@ -134,6 +170,19 @@
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="10" column="0">
@ -260,6 +309,9 @@
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@ -278,6 +330,9 @@
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="maxLength">
<number>512</number>
</property>
</widget>
</item>
<item>

View File

@ -50,6 +50,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map_scene_proxy = NULL;
m_map_overlay_widget = NULL;
m_mouse_waypoint = NULL;
prev_tile_number = 0;
// **************
@ -71,8 +73,6 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map->setFrameStyle(QFrame::NoFrame);
m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging
m_map->setStyleSheet(" QToolTip { background-color: white; color: black; border: 1px solid black; padding: 5px; border-radius: 2px; /* opacity: 170; */ } ");
}
// **************
@ -94,7 +94,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map_graphics_scene = m_map->scene();
m_map_scene_proxy = m_map_graphics_scene->addWidget(m_map_overlay_widget);
m_map_overlay_widget->setGeometry(m_map->geometry());
m_map_overlay_widget->setGeometry(m_widget->mapWidget->geometry());
*/
// **************
// Get required UAVObjects
@ -291,7 +291,23 @@ void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
{
if (!m_map)
return; // we don't appear to have a map to work with!
if (event->reason() != QContextMenuEvent::Mouse)
return; // not a mouse click event
QPoint p = m_map->mapFromGlobal(QCursor::pos());
if (!m_map->contentsRect().contains(p))
return; // the mouse click was not on the map
// find out if we have a waypoint under the mouse cursor
QGraphicsItem *item = m_map->itemAt(p);
m_mouse_waypoint = qgraphicsitem_cast<mapcontrol::WayPointItem *>(item);
// ****************
// create the popup menu
QMenu zoomMenu(tr("&Zoom ") + "(" + QString::number(m_map->Zoom()) + ")", this);
zoomMenu.addAction(zoom2Act);
@ -348,11 +364,18 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(wayPointEditorAct);
menu.addAction(addWayPointAct);
menu.addAction(editWayPointAct);
menu.addAction(deleteWayPointAct);
menu.addAction(clearWayPointsAct);
if (m_mouse_waypoint)
{ // we have a waypoint under the mouse
menu.addAction(editWayPointAct);
menu.addAction(deleteWayPointAct);
}
menu.addSeparator();
m_waypoint_list_mutex.lock();
if (m_waypoint_list.count() > 0)
menu.addAction(clearWayPointsAct); // we have waypoints
m_waypoint_list_mutex.unlock();
// menu.addSeparator();
menu.exec(event->globalPos());
@ -1070,12 +1093,17 @@ void OPMapGadgetWidget::addWayPoint()
void OPMapGadgetWidget::editWayPoint()
{
if (!m_mouse_waypoint) return;
// to do
waypoint_edit_dialog.show();
}
void OPMapGadgetWidget::deleteWayPoint()
{
if (!m_mouse_waypoint) return;
// to do
}

View File

@ -211,6 +211,8 @@ private:
QStandardItemModel *wayPoint_treeView_model;
mapcontrol::WayPointItem *m_mouse_waypoint;
QList<t_waypoint> m_waypoint_list;
QMutex m_waypoint_list_mutex;