Skip to content

Commit

Permalink
workaround #2239
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13732 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 14, 2010
1 parent 942ff37 commit c3d4aa3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -366,6 +366,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
#ifdef HAVE_QWT
, mpGpsWidget( NULL )
#endif
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
{
if ( smInstance )
{
Expand Down Expand Up @@ -1926,7 +1929,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionAddToOverview->setIcon( getThemeIcon( "/mActionInOverview.png" ) );
mActionAnnotation->setIcon( getThemeIcon( "/mActionAnnotation.png" ) );
mActionFormAnnotation->setIcon( getThemeIcon( "/mActionFormAnnotation.png" ) );
mActionTextAnnotation->setIcon( getThemeIcon( "/mActionTextAnnotation.png" ) );
mActionTextAnnotation->setIcon( getThemeIcon( "/mActionTextAnnotation.png" ) );

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

#ifdef Q_OS_WIN
// hope your wearing your peril sensitive sunglasses.
void QgisApp::contextMenuEvent( QContextMenuEvent *e )
{
if ( mSkipNextContextMenuEvent )
{
mSkipNextContextMenuEvent--;
e->ignore();
return;
}

QMainWindow::contextMenuEvent( e );
}

void QgisApp::skipNextContextMenuEvent()
{
mSkipNextContextMenuEvent++;
}
#endif

// Debug hook - used to output diagnostic messages when evoked (usually from the menu)
/* Temporarily disabled...
void QgisApp::debugHook()
Expand Down
12 changes: 12 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -359,6 +359,11 @@ class QgisApp : public QMainWindow
//! returns pointer to map legend
QgsLegend *legend();

#if Q_OS_WIN
//! ugly hack
void skipNextContextMenuEvent();
#endif

public slots:
//! Zoom to full extent
void zoomFull();
Expand Down Expand Up @@ -433,6 +438,9 @@ class QgisApp : public QMainWindow
//! reimplements widget keyPress event so we can check if cancel was pressed
virtual void keyPressEvent( QKeyEvent * event );

//! reimplements context menu event
virtual void contextMenuEvent( QContextMenuEvent *event );

private slots:
//! About QGis
void about();
Expand Down Expand Up @@ -1117,6 +1125,10 @@ class QgisApp : public QMainWindow

int mLastComposerId;

#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent; // ugly hack
#endif

#ifdef HAVE_QWT
//! Persistent GPS toolbox
QgsGPSInformationWidget * mpGpsWidget;
Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -31,6 +31,10 @@
#include <QMouseEvent>
#include <QSettings>

#ifdef Q_OS_WIN
#include <qgisapp.h>
#endif

QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureMode tool ): QgsMapToolCapture( canvas, tool )
{

Expand Down Expand Up @@ -482,6 +486,11 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
vlayer->endEditCommand();
}
mypDialog->deleteLater();

#ifdef Q_OS_WIN
// hope your wearing your peril sensitive sunglasses.
QgisApp::instance()->skipNextContextMenuEvent();
#endif
}
delete f;

Expand Down

0 comments on commit c3d4aa3

Please sign in to comment.