# HG changeset patch # User Chris Cannam # Date 1529574194 -3600 # Node ID 1589bc7528b7b9bdf33352155eacf5c7cf329a9f # Parent 91670e4e76a6191c0dda0cf61d9740cb7f75cd38 Ctrl-click on level-pan tool button now also resets to default diff -r 91670e4e76a6 -r 1589bc7528b7 widgets/LevelPanToolButton.cpp --- a/widgets/LevelPanToolButton.cpp Mon Jun 11 14:40:36 2018 +0100 +++ b/widgets/LevelPanToolButton.cpp Thu Jun 21 10:43:14 2018 +0100 @@ -18,9 +18,12 @@ #include #include #include +#include #include #include +#include "base/Debug.h" + #include using std::cerr; using std::endl; @@ -60,6 +63,19 @@ } void +LevelPanToolButton::mousePressEvent(QMouseEvent *e) +{ + if (e->button() == Qt::MidButton || + ((e->button() == Qt::LeftButton) && + (e->modifiers() & Qt::ControlModifier))) { + m_lpw->setToDefault(); + e->accept(); + } else { + QToolButton::mousePressEvent(e); + } +} + +void LevelPanToolButton::wheelEvent(QWheelEvent *e) { m_lpw->wheelEvent(e); diff -r 91670e4e76a6 -r 1589bc7528b7 widgets/LevelPanToolButton.h --- a/widgets/LevelPanToolButton.h Mon Jun 11 14:40:36 2018 +0100 +++ b/widgets/LevelPanToolButton.h Thu Jun 21 10:43:14 2018 +0100 @@ -70,6 +70,7 @@ virtual void paintEvent(QPaintEvent *); virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); + virtual void mousePressEvent(QMouseEvent *); virtual void wheelEvent(QWheelEvent *e); LevelPanWidget *m_lpw;