1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +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)
{
QToolButton::mousePressEvent(e);
if (popupMode() == QToolButton::DelayedPopup)
m_pressTimer.start();
@ -184,13 +182,13 @@ void ToolButton::mousePressEvent(QMouseEvent* e)
else if (e->buttons() == Qt::RightButton && menu()) {
setDown(true);
showMenu();
} else {
QToolButton::mousePressEvent(e);
}
}
void ToolButton::mouseReleaseEvent(QMouseEvent* e)
{
QToolButton::mouseReleaseEvent(e);
m_pressTimer.stop();
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) {
emit controlClicked();
setDown(false);
} else {
QToolButton::mouseReleaseEvent(e);
}
}