Skip to content

Commit

Permalink
Allow clicking mouse back button on stacked panel widgets
Browse files Browse the repository at this point in the history
Only works if click occurs outside of widgets - we probably should
start ignoring clicks which aren't left/middle/right in any
mouse event handlers
  • Loading branch information
nyalldawson committed Mar 17, 2017
1 parent 7aff3e7 commit e5f5814
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/gui/qgspanelwidgetstack.sip
Expand Up @@ -89,4 +89,9 @@ class QgsPanelWidgetStack: public QWidget
* @param panel The panel to close.
*/
void closePanel( QgsPanelWidget* panel );

protected:

void mouseReleaseEvent( QMouseEvent *e );

};
8 changes: 8 additions & 0 deletions src/gui/qgspanelwidgetstack.cpp
Expand Up @@ -147,6 +147,14 @@ void QgsPanelWidgetStack::closePanel( QgsPanelWidget *panel )
this->updateBreadcrumb();
}

void QgsPanelWidgetStack::mouseReleaseEvent( QMouseEvent *e )
{
if ( e->button() == Qt::BackButton )
{
acceptCurrentPanel();
}
}

void QgsPanelWidgetStack::updateBreadcrumb()
{
QString breadcrumb;
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgspanelwidgetstack.h
Expand Up @@ -117,6 +117,11 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
* @param panel The panel to close.
*/
void closePanel( QgsPanelWidget *panel );

protected:

void mouseReleaseEvent( QMouseEvent *e ) override;

private:
void updateBreadcrumb();
QStack<QString> mTitles;
Expand Down

0 comments on commit e5f5814

Please sign in to comment.