comparison widgets/LevelPanToolButton.cpp @ 1300:1589bc7528b7

Ctrl-click on level-pan tool button now also resets to default
author Chris Cannam
date Thu, 21 Jun 2018 10:43:14 +0100
parents a34a2a25907c
children 27ea5d61b402
comparison
equal deleted inserted replaced
1299:91670e4e76a6 1300:1589bc7528b7
16 #include "LevelPanWidget.h" 16 #include "LevelPanWidget.h"
17 17
18 #include <QMenu> 18 #include <QMenu>
19 #include <QWidgetAction> 19 #include <QWidgetAction>
20 #include <QImage> 20 #include <QImage>
21 #include <QMouseEvent>
21 #include <QStylePainter> 22 #include <QStylePainter>
22 #include <QStyleOptionToolButton> 23 #include <QStyleOptionToolButton>
24
25 #include "base/Debug.h"
23 26
24 #include <iostream> 27 #include <iostream>
25 using std::cerr; 28 using std::cerr;
26 using std::endl; 29 using std::endl;
27 30
55 setBigImageSize(m_pixelsBig); 58 setBigImageSize(m_pixelsBig);
56 } 59 }
57 60
58 LevelPanToolButton::~LevelPanToolButton() 61 LevelPanToolButton::~LevelPanToolButton()
59 { 62 {
63 }
64
65 void
66 LevelPanToolButton::mousePressEvent(QMouseEvent *e)
67 {
68 if (e->button() == Qt::MidButton ||
69 ((e->button() == Qt::LeftButton) &&
70 (e->modifiers() & Qt::ControlModifier))) {
71 m_lpw->setToDefault();
72 e->accept();
73 } else {
74 QToolButton::mousePressEvent(e);
75 }
60 } 76 }
61 77
62 void 78 void
63 LevelPanToolButton::wheelEvent(QWheelEvent *e) 79 LevelPanToolButton::wheelEvent(QWheelEvent *e)
64 { 80 {