Skip to content

Commit

Permalink
remove Windows OS specific event filter that eats context menu events
Browse files Browse the repository at this point in the history
fixes #17453
  • Loading branch information
stevenmizuno authored and nyalldawson committed Jan 15, 2018
1 parent 09fbdb1 commit cefb1bc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
27 changes: 0 additions & 27 deletions src/gui/qgsmaptoolcapture.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
7 changes: 0 additions & 7 deletions src/gui/qgsmaptoolcapture.h
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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.