r17937 by jghali - Better reflect in the gui that mouse is grabbed when in eyedropper mode

scribus-commit scribus-commit at lists.scribus.net
Fri Dec 7 17:29:01 UTC 2012


Author: jghali
Date: Fri Dec  7 17:29:01 2012
New Revision: 17937

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17937
Log:
Better reflect in the gui that mouse is grabbed when in eyedropper mode

Modified:
    branches/Version14x/Scribus/scribus/canvasmode.cpp
    branches/Version14x/Scribus/scribus/canvasmode.h
    branches/Version14x/Scribus/scribus/canvasmode_eyedropper.cpp

Modified: branches/Version14x/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17937&path=/branches/Version14x/Scribus/scribus/canvasmode.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode.cpp (original)
+++ branches/Version14x/Scribus/scribus/canvasmode.cpp Fri Dec  7 17:29:01 2012
@@ -529,51 +529,50 @@
 	p->restore();
 }
 
-
-void CanvasMode::setModeCursor()
-{
-	//NOTE: Merge with similar code in ScribusMainWindow::setAppMode()
+QCursor CanvasMode::modeCursor()
+{
+	QCursor cursor;
 	switch (m_doc->appMode)
 	{
 		case modeDrawShapes:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawFrame.xpm")));
+			cursor = QCursor(loadIcon("DrawFrame.xpm"));
 			break;
 		case modeDrawImage:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm")));
+			cursor =  QCursor(loadIcon("DrawImageFrame.xpm"));
 			break;
 		case modeDrawLatex:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawLatexFrame.xpm")));
+			cursor = QCursor(loadIcon("DrawLatexFrame.xpm"));
 			break;
 		case modeDrawText:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawTextFrame.xpm")));
+			cursor = QCursor(loadIcon("DrawTextFrame.xpm"));
 			break;
 		case modeDrawTable:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawTable.xpm")));
+			cursor = QCursor(loadIcon("DrawTable.xpm"));
 			break;
 		case modeDrawRegularPolygon:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawPolylineFrame.xpm")));
+			cursor = QCursor(loadIcon("DrawPolylineFrame.xpm"));
 			break;
 		case modeDrawLine:
 		case modeDrawBezierLine:
-			qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
+			cursor = QCursor(Qt::CrossCursor);
 			break;
 		case modeDrawFreehandLine:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DrawFreeLine.png"), 0, 32));
+			cursor = QCursor(loadIcon("DrawFreeLine.png"), 0, 32);
 			break;
 		case modeImportObject:
-			qApp->changeOverrideCursor(QCursor(loadIcon("DragPix.xpm")));
+			cursor = QCursor(loadIcon("DragPix.xpm"));
 			break;
 		case modeMagnifier:
 			if (m_view->Magnify)
-				qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm")));
+				cursor = QCursor(loadIcon("LupeZ.xpm"));
 			else
-				qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm")));
+				cursor = QCursor(loadIcon("LupeZm.xpm"));
 			break;
 		case modePanning:
-			qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
+			cursor = QCursor(loadIcon("HandC.xpm"));
 			break;
 		case modeEyeDropper:
-			qApp->changeOverrideCursor(QCursor(loadIcon("colorpickercursor.png"), 0, 32));
+			cursor = QCursor(loadIcon("colorpickercursor.png"), 0, 32);
 			break;
 		case modeMeasurementTool:
 		case modeEditGradientVectors:
@@ -584,12 +583,19 @@
 		case modeInsertPDFListbox:
 		case modeInsertPDFTextAnnotation:
 		case modeInsertPDFLinkAnnotation:
-			qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
+			cursor = QCursor(Qt::CrossCursor);
 			break;
 		default:
-			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-			break;
-	}
+			cursor = QCursor(Qt::ArrowCursor);
+			break;
+	}
+	return cursor;
+}
+
+void CanvasMode::setModeCursor()
+{
+	QCursor cursor = modeCursor();
+	qApp->changeOverrideCursor(cursor);
 }
 
 #ifdef GESTURE_FRAME_PREVIEW

Modified: branches/Version14x/Scribus/scribus/canvasmode.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17937&path=/branches/Version14x/Scribus/scribus/canvasmode.h
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode.h (original)
+++ branches/Version14x/Scribus/scribus/canvasmode.h Fri Dec  7 17:29:01 2012
@@ -20,9 +20,10 @@
 
 #include "scribusapi.h"
 
+#include <QBrush>
+#include <QCursor>
 #include <QMap>
 #include <QPen>
-#include <QBrush>
 
 class QDragEnterEvent;
 class QDragMoveEvent;
@@ -124,6 +125,8 @@
 	public:
 	void clearPixmapCache();
 #endif // GESTURE_FRAME_PREVIEW
+
+	QCursor modeCursor();
 	void setModeCursor();
 	
 	/** main canvas modes dont have a delegate */

Modified: branches/Version14x/Scribus/scribus/canvasmode_eyedropper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17937&path=/branches/Version14x/Scribus/scribus/canvasmode_eyedropper.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode_eyedropper.cpp (original)
+++ branches/Version14x/Scribus/scribus/canvasmode_eyedropper.cpp Fri Dec  7 17:29:01 2012
@@ -48,7 +48,7 @@
 {
 	if (!m_mouseGrabbed)
 	{
-		m_view->widget()->grabMouse();
+		m_view->widget()->grabMouse(modeCursor());
 		m_mouseGrabbed = true;
 	}
 }




More information about the scribus-commit mailing list