Hi Oliver,

thank for the patches. The backspace is a nice idea. I just wonder how
to communicate that to the user :)

backspace for backward delete is to me at least as obvious as the right mouse button to end a polyline ;-)

Personally, I'd rather use the Escape key to end drawing, which more or less works in QLGT, too. It just doesn't update the path length and any suggested path continuation (the magenta line) remains on the map. Also, the last point is handled differently: When ending with the mouse, the last point is discarded, while it is added to the polyline when Escape is used.

The attached patch makes the two methods behave mostly identical and
also fixes the non-transparency of the action menu on OS X (e.g. http://www.domachowski.eu/boards/pic2.jpg)

I would also like to propose to merge the distance overlay menu with
the overlay menu like this:

    F5   Join Distance PolyLines
    -
    F7   Add Distance Polyline
    -
    F9   Add Static Text Box
    F10  Add Geo-Ref. Text Box

Having the distance polyline in an extra menu below the text box commands makes IMHO not much sense. Any objections?

Regards,
Michael
From 4950b1624b139c550651596a0dd2e05b3014582a Mon Sep 17 00:00:00 2001
From: Michael Klein <[email protected]>
Date: Tue, 1 May 2012 22:34:51 +0200
Subject: [PATCH] fix COverlayDistance glitches and CMegaMenu transparency on
 OS X

---
 src/CActions.cpp         |    2 +-
 src/CMegaMenu.cpp        |   12 ++---------
 src/COverlayDistance.cpp |   51 ++++++++++++++++++----------------------------
 3 files changed, 23 insertions(+), 42 deletions(-)

diff --git a/src/CActions.cpp b/src/CActions.cpp
index 27ebe14..fb68de9 100644
--- a/src/CActions.cpp
+++ b/src/CActions.cpp
@@ -304,7 +304,7 @@ void CActions::funcSwitchToOverlayDistance()
     setMenuPixmap(QPixmap(":/icons/backDistance128x128.png"));
     actionGroup->switchToActionGroup(CMenus::OverlayDistanceMenu);
     COverlayDB::self().gainFocus();
-    funcDistance();
+    funcMoveArea();
 }
 
 
diff --git a/src/CMegaMenu.cpp b/src/CMegaMenu.cpp
index e2e4719..ea85bf2 100644
--- a/src/CMegaMenu.cpp
+++ b/src/CMegaMenu.cpp
@@ -94,47 +94,38 @@ void CMegaMenu::switchByKeyWord(const QString& key)
     else if (key == "Waypoints")
     {
         actions->funcSwitchToWpt();
-        actions->funcMoveArea();
     }
     else if (key == "Search")
     {
         actions->funcSwitchToMain();
-        actions->funcMoveArea();
     }
     else if (key == "Maps")
     {
         actions->funcSwitchToMap();
-        actions->funcMoveArea();
     }
     else if (key == "Tracks")
     {
         actions->funcSwitchToTrack();
-        actions->funcMoveArea();
     }
     else if (key == "LiveLog")
     {
         actions->funcSwitchToLiveLog();
-        actions->funcMoveArea();
     }
     else if (key == "Overlay")
     {
         actions->funcSwitchToOverlay();
-        actions->funcMoveArea();
     }
     else if (key == "OverlayDistance")
     {
         actions->funcSwitchToOverlayDistance();
-        actions->funcMoveArea();
     }
     else if (key == "Routes")
     {
         actions->funcSwitchToRoute();
-        actions->funcMoveArea();
     }
     else if (key == "GeoDB")
     {
         actions->funcSwitchToMain();
-        actions->funcMoveArea();
     }
 
 
@@ -170,7 +161,8 @@ void CMegaMenu::initStyleOption(QStyleOptionMenuItem 
*option, const QAction *act
     }
     if(!isCurrent)
     {
-        option->palette.setBrush(QPalette::Normal, QPalette::Window, 
QColor(0,0,0,0));
+        option->palette.setBrush(QPalette::Normal, QPalette::Window, 
Qt::transparent);
+        option->palette.setBrush(QPalette::Normal, QPalette::Button, 
Qt::transparent);
     }
 
     if (isEnabled() && action->isEnabled() && (!action->menu() || 
action->menu()->isEnabled()))
diff --git a/src/COverlayDistance.cpp b/src/COverlayDistance.cpp
index 2a96b8d..54e5ba8 100644
--- a/src/COverlayDistance.cpp
+++ b/src/COverlayDistance.cpp
@@ -37,7 +37,7 @@
 
 bool COverlayDistance::showBullets = true;
 
-bool operator==(const projXY& p1, const projXY& p2)
+static bool operator==(const projXY& p1, const projXY& p2)
 {
     return (p1.u == p2.u) && (p1.v == p2.v);
 }
@@ -706,35 +706,8 @@ void COverlayDistance::mousePressEvent(QMouseEvent * e)
     }
     else if(e->button() == Qt::RightButton)
     {
-        if(doMove)
-        {
-
-            if(addType != eNone)
-            {
-                points.removeOne(*thePoint);
-            }
-            else
-            {
-                *thePoint = savePoint;
-            }
-            thePoint = 0;
-            thePointBefor   = 0;
-            thePointAfter   = 0;
-
-
-            calcDistance();
-            theMainWindow->getCanvas()->update();
-            emit sigChanged();
-
-            doMove      = false;
-            addType     = eNone;
-            subline.clear();
-
-            COverlayDB::self().emitSigChanged();
-
-            QApplication::restoreOverrideCursor();
-            return;
-        }
+        looseFocus();
+        return;
     }
 
     selectedPoints.clear();
@@ -1318,17 +1291,33 @@ void COverlayDistance::makeVisible()
     emit sigChanged();
 }
 
-
 void COverlayDistance::looseFocus()
 {
+    if(doMove)
+    {
+        if(addType != eNone)
+        {
+            points.removeOne(*thePoint);
+        }
+        else
+        {
+            *thePoint = savePoint;
+        }
+    }
+
     if(doSpecialCursor)
     {
         QApplication::restoreOverrideCursor();
         doSpecialCursor = false;
     }
+
     doMove          = false;
     addType         = eNone;
     doFuncWheel     = false;
+
+    subline.clear();
+    calcDistance();
+    emit sigChanged();
 }
 
 
-- 
1.7.9.6

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to