Skip to content

Commit e5f5814

Browse files
committedMar 17, 2017
Allow clicking mouse back button on stacked panel widgets
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
1 parent 7aff3e7 commit e5f5814

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
 

‎python/gui/qgspanelwidgetstack.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,9 @@ class QgsPanelWidgetStack: public QWidget
8989
* @param panel The panel to close.
9090
*/
9191
void closePanel( QgsPanelWidget* panel );
92+
93+
protected:
94+
95+
void mouseReleaseEvent( QMouseEvent *e );
96+
9297
};

‎src/gui/qgspanelwidgetstack.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ void QgsPanelWidgetStack::closePanel( QgsPanelWidget *panel )
147147
this->updateBreadcrumb();
148148
}
149149

150+
void QgsPanelWidgetStack::mouseReleaseEvent( QMouseEvent *e )
151+
{
152+
if ( e->button() == Qt::BackButton )
153+
{
154+
acceptCurrentPanel();
155+
}
156+
}
157+
150158
void QgsPanelWidgetStack::updateBreadcrumb()
151159
{
152160
QString breadcrumb;

‎src/gui/qgspanelwidgetstack.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
117117
* @param panel The panel to close.
118118
*/
119119
void closePanel( QgsPanelWidget *panel );
120+
121+
protected:
122+
123+
void mouseReleaseEvent( QMouseEvent *e ) override;
124+
120125
private:
121126
void updateBreadcrumb();
122127
QStack<QString> mTitles;

0 commit comments

Comments
 (0)
Please sign in to comment.