[PATCH 2/2] Allow ctrl-click to select dives incrementally from the globe view

Linus Torvalds torvalds at linux-foundation.org
Wed Jun 5 22:10:50 PDT 2013


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Thu, 6 Jun 2013 14:07:07 +0900
Subject: [PATCH 2/2] Allow ctrl-click to select dives incrementally from the globe view

I guess we should support de-selecting dives this way too, but right now
the interfaces only do selection.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 qt-ui/globe.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 20c913bbd946..78283e49ee29 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -81,6 +81,7 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
 
 	int idx;
 	struct dive *dive;
+	bool clear = !(QApplication::keyboardModifiers() && Qt::ControlModifier);
 	bool first = true;
 	for_each_dive(idx, dive) {
 		long lat_diff, lon_diff;
@@ -95,8 +96,10 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
 		if (lat_diff > resolve || lon_diff > resolve)
 			continue;
 
-		if (first)
+		if (clear) {
 			mainWindow()->dive_list()->unselectDives();
+			clear = false;
+		}
 		mainWindow()->dive_list()->selectDive(dive, first);
 		first = false;
 	}
-- 
1.8.3



More information about the subsurface mailing list