Skip to content

Commit 3970b78

Browse files
author
jef
committedJun 14, 2010
workaround #2239
git-svn-id: http://svn.osgeo.org/qgis/trunk@13732 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 04699d2 commit 3970b78

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
366366
#ifdef HAVE_QWT
367367
, mpGpsWidget( NULL )
368368
#endif
369+
#ifdef Q_OS_WIN
370+
, mSkipNextContextMenuEvent( 0 )
371+
#endif
369372
{
370373
if ( smInstance )
371374
{
@@ -1926,7 +1929,7 @@ void QgisApp::setTheme( QString theThemeName )
19261929
mActionAddToOverview->setIcon( getThemeIcon( "/mActionInOverview.png" ) );
19271930
mActionAnnotation->setIcon( getThemeIcon( "/mActionAnnotation.png" ) );
19281931
mActionFormAnnotation->setIcon( getThemeIcon( "/mActionFormAnnotation.png" ) );
1929-
mActionTextAnnotation->setIcon( getThemeIcon( "/mActionTextAnnotation.png" ) );
1932+
mActionTextAnnotation->setIcon( getThemeIcon( "/mActionTextAnnotation.png" ) );
19301933

19311934
//change themes of all composers
19321935
QSet<QgsComposer*>::iterator composerIt = mPrintComposers.begin();
@@ -6365,6 +6368,26 @@ void QgisApp::keyPressEvent( QKeyEvent * e )
63656368
}
63666369
}
63676370

6371+
#ifdef Q_OS_WIN
6372+
// hope your wearing your peril sensitive sunglasses.
6373+
void QgisApp::contextMenuEvent( QContextMenuEvent *e )
6374+
{
6375+
if ( mSkipNextContextMenuEvent )
6376+
{
6377+
mSkipNextContextMenuEvent--;
6378+
e->ignore();
6379+
return;
6380+
}
6381+
6382+
QMainWindow::contextMenuEvent( e );
6383+
}
6384+
6385+
void QgisApp::skipNextContextMenuEvent()
6386+
{
6387+
mSkipNextContextMenuEvent++;
6388+
}
6389+
#endif
6390+
63686391
// Debug hook - used to output diagnostic messages when evoked (usually from the menu)
63696392
/* Temporarily disabled...
63706393
void QgisApp::debugHook()

‎src/app/qgisapp.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ class QgisApp : public QMainWindow
359359
//! returns pointer to map legend
360360
QgsLegend *legend();
361361

362+
#if Q_OS_WIN
363+
//! ugly hack
364+
void skipNextContextMenuEvent();
365+
#endif
366+
362367
public slots:
363368
//! Zoom to full extent
364369
void zoomFull();
@@ -433,6 +438,9 @@ class QgisApp : public QMainWindow
433438
//! reimplements widget keyPress event so we can check if cancel was pressed
434439
virtual void keyPressEvent( QKeyEvent * event );
435440

441+
//! reimplements context menu event
442+
virtual void contextMenuEvent( QContextMenuEvent *event );
443+
436444
private slots:
437445
//! About QGis
438446
void about();
@@ -1117,6 +1125,10 @@ class QgisApp : public QMainWindow
11171125

11181126
int mLastComposerId;
11191127

1128+
#ifdef Q_OS_WIN
1129+
int mSkipNextContextMenuEvent; // ugly hack
1130+
#endif
1131+
11201132
#ifdef HAVE_QWT
11211133
//! Persistent GPS toolbox
11221134
QgsGPSInformationWidget * mpGpsWidget;

‎src/app/qgsmaptooladdfeature.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <QMouseEvent>
3232
#include <QSettings>
3333

34+
#ifdef Q_OS_WIN
35+
#include <qgisapp.h>
36+
#endif
37+
3438
QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureMode tool ): QgsMapToolCapture( canvas, tool )
3539
{
3640

@@ -482,6 +486,11 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
482486
vlayer->endEditCommand();
483487
}
484488
mypDialog->deleteLater();
489+
490+
#ifdef Q_OS_WIN
491+
// hope your wearing your peril sensitive sunglasses.
492+
QgisApp::instance()->skipNextContextMenuEvent();
493+
#endif
485494
}
486495
delete f;
487496

0 commit comments

Comments
 (0)
Please sign in to comment.