Skip to content
Permalink
Browse files

remove Windows OS specific event filter that eats context menu events

fixes #17453
  • Loading branch information
stevenmizuno authored and nyalldawson committed Dec 21, 2017
1 parent 09fbdb1 commit cefb1bc77933aedc7926a4faa79bbc5e07b7a417
Showing with 0 additions and 34 deletions.
  1. +0 −27 src/gui/qgsmaptoolcapture.cpp
  2. +0 −7 src/gui/qgsmaptoolcapture.h
@@ -41,9 +41,6 @@
QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode )
: QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
, mCaptureMode( mode )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
{
mCaptureModeFromLayer = mode == CaptureNone;
mCapturing = false;
@@ -640,18 +637,6 @@ void QgsMapToolCapture::stopCapturing()

mTracingStartPoint = QgsPointXY();

#ifdef Q_OS_WIN
Q_FOREACH ( QWidget *w, qApp->topLevelWidgets() )
{
if ( w->objectName() == "QgisApp" )
{
if ( mSkipNextContextMenuEvent++ == 0 )
w->installEventFilter( this );
break;
}
}
#endif

mCapturing = false;
mCaptureCurve.clear();
mSnappingMatches.clear();
@@ -783,15 +768,3 @@ void QgsMapToolCapture::setPoints( const QVector<QgsPointXY> &pointList )
mSnappingMatches.append( QgsPointLocator::Match() );
}

#ifdef Q_OS_WIN
bool QgsMapToolCapture::eventFilter( QObject *obj, QEvent *event )
{
if ( event->type() != QEvent::ContextMenu )
return false;

if ( --mSkipNextContextMenuEvent == 0 )
obj->removeEventFilter( this );

return mSkipNextContextMenuEvent >= 0;
}
#endif
@@ -97,10 +97,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
*/
void keyPressEvent( QKeyEvent *e ) override;

#ifdef Q_OS_WIN
virtual bool eventFilter( QObject *obj, QEvent *e ) override;
#endif

/**
* Clean a temporary rubberband
*/
@@ -261,9 +257,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing

friend class TestQgsMapToolReshape;

#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent;
#endif
};

#endif

0 comments on commit cefb1bc

Please sign in to comment.
You can’t perform that action at this time.