1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Distinguish clicked and controlclicked in ToolButton

This commit is contained in:
Vladislav Tronko 2016-08-17 10:49:48 +03:00 committed by David Rosca
parent 4c7735139e
commit e56d01fec9

View File

@ -172,8 +172,6 @@ void ToolButton::showMenu()
void ToolButton::mousePressEvent(QMouseEvent* e) void ToolButton::mousePressEvent(QMouseEvent* e)
{ {
QToolButton::mousePressEvent(e);
if (popupMode() == QToolButton::DelayedPopup) if (popupMode() == QToolButton::DelayedPopup)
m_pressTimer.start(); m_pressTimer.start();
@ -184,13 +182,13 @@ void ToolButton::mousePressEvent(QMouseEvent* e)
else if (e->buttons() == Qt::RightButton && menu()) { else if (e->buttons() == Qt::RightButton && menu()) {
setDown(true); setDown(true);
showMenu(); showMenu();
} else {
QToolButton::mousePressEvent(e);
} }
} }
void ToolButton::mouseReleaseEvent(QMouseEvent* e) void ToolButton::mouseReleaseEvent(QMouseEvent* e)
{ {
QToolButton::mouseReleaseEvent(e);
m_pressTimer.stop(); m_pressTimer.stop();
if (e->button() == Qt::MiddleButton && rect().contains(e->pos())) { if (e->button() == Qt::MiddleButton && rect().contains(e->pos())) {
@ -200,6 +198,8 @@ void ToolButton::mouseReleaseEvent(QMouseEvent* e)
else if (e->button() == Qt::LeftButton && rect().contains(e->pos()) && e->modifiers() == Qt::ControlModifier) { else if (e->button() == Qt::LeftButton && rect().contains(e->pos()) && e->modifiers() == Qt::ControlModifier) {
emit controlClicked(); emit controlClicked();
setDown(false); setDown(false);
} else {
QToolButton::mouseReleaseEvent(e);
} }
} }