Skip to content

Commit

Permalink
Fix Escape key press should close current stacked panel
Browse files Browse the repository at this point in the history
Code was present but not correctly hooked up before

(cherry-picked from 846ca49)
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent f1249ce commit b5644dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/gui/qgspanelwidgetstack.sip.in
Expand Up @@ -130,6 +130,8 @@ This slot is normally auto connected to panelAccepted when a panel is shown.

virtual void mouseReleaseEvent( QMouseEvent *e );

virtual void keyPressEvent( QKeyEvent *e );


};

Expand Down
8 changes: 8 additions & 0 deletions src/gui/qgspanelwidgetstack.cpp
Expand Up @@ -155,6 +155,14 @@ void QgsPanelWidgetStack::mouseReleaseEvent( QMouseEvent *e )
}
}

void QgsPanelWidgetStack::keyPressEvent( QKeyEvent *e )
{
if ( e->key() == Qt::Key_Escape )
{
acceptCurrentPanel();
}
}

void QgsPanelWidgetStack::updateBreadcrumb()
{
QString breadcrumb;
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgspanelwidgetstack.h
Expand Up @@ -122,6 +122,7 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
protected:

void mouseReleaseEvent( QMouseEvent *e ) override;
void keyPressEvent( QKeyEvent *e ) override;

private:
void updateBreadcrumb();
Expand Down

0 comments on commit b5644dd

Please sign in to comment.