diff --git a/src/lib/3rdparty/lineedit.cpp b/src/lib/3rdparty/lineedit.cpp index f5b25643f..7368416f6 100644 --- a/src/lib/3rdparty/lineedit.cpp +++ b/src/lib/3rdparty/lineedit.cpp @@ -240,7 +240,7 @@ void LineEdit::mouseReleaseEvent(QMouseEvent* event) void LineEdit::mouseDoubleClickEvent(QMouseEvent* event) { - if (event->button() == Qt::LeftButton && qzSettings->selectAllOnDoubleClick) { + if (event->buttons() == Qt::LeftButton && qzSettings->selectAllOnDoubleClick) { selectAll(); return; } diff --git a/src/lib/bookmarks/bookmarkstoolbarbutton.cpp b/src/lib/bookmarks/bookmarkstoolbarbutton.cpp index 528a25959..e2a3acb28 100644 --- a/src/lib/bookmarks/bookmarkstoolbarbutton.cpp +++ b/src/lib/bookmarks/bookmarkstoolbarbutton.cpp @@ -35,8 +35,6 @@ BookmarksToolbarButton::BookmarksToolbarButton(BookmarkItem* bookmark, QWidget* : QPushButton(parent) , m_bookmark(bookmark) , m_window(0) - , m_buttons(Qt::NoButton) - , m_modifiers(Qt::NoModifier) , m_showOnlyIcon(false) { init(); @@ -225,9 +223,6 @@ QString BookmarksToolbarButton::createTooltip() const void BookmarksToolbarButton::mousePressEvent(QMouseEvent* event) { - m_buttons = event->buttons(); - m_modifiers = event->modifiers(); - if (m_bookmark && m_bookmark->isFolder()) { if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier) { openFolder(m_bookmark); @@ -241,25 +236,25 @@ void BookmarksToolbarButton::mousePressEvent(QMouseEvent* event) void BookmarksToolbarButton::mouseReleaseEvent(QMouseEvent* event) { if (m_bookmark && rect().contains(event->pos())) { + Qt::MouseButton button = event->button(); + Qt::KeyboardModifiers modifiers = event->modifiers(); + if (m_bookmark->isUrl()) { - if (m_buttons == Qt::LeftButton && m_modifiers == Qt::NoModifier) { + if (button == Qt::LeftButton && modifiers == Qt::NoModifier) { bookmarkActivated(m_bookmark); } - else if (m_buttons == Qt::LeftButton && m_modifiers == Qt::ShiftModifier) { + else if (button == Qt::LeftButton && modifiers == Qt::ShiftModifier) { bookmarkShiftActivated(m_bookmark); } - else if (m_buttons == Qt::MiddleButton || m_modifiers == Qt::ControlModifier) { + else if (button == Qt::MiddleButton || modifiers == Qt::ControlModifier) { bookmarkCtrlActivated(m_bookmark); } } - else if (m_bookmark->isFolder() && m_buttons == Qt::MiddleButton) { + else if (m_bookmark->isFolder() && button == Qt::MiddleButton) { openFolder(m_bookmark); } } - m_buttons = Qt::NoButton; - m_modifiers = Qt::NoModifier; - QPushButton::mouseReleaseEvent(event); } diff --git a/src/lib/bookmarks/bookmarkstoolbarbutton.h b/src/lib/bookmarks/bookmarkstoolbarbutton.h index 25a805c94..a2d7e84d3 100644 --- a/src/lib/bookmarks/bookmarkstoolbarbutton.h +++ b/src/lib/bookmarks/bookmarkstoolbarbutton.h @@ -67,10 +67,7 @@ private: BookmarkItem* m_bookmark; BrowserWindow* m_window; - Qt::MouseButtons m_buttons; - Qt::KeyboardModifiers m_modifiers; bool m_showOnlyIcon; - }; #endif // BOOKMARKSTOOLBARBUTTON_H diff --git a/src/lib/desktopnotifications/desktopnotification.cpp b/src/lib/desktopnotifications/desktopnotification.cpp index ca315a1a9..c904ea716 100644 --- a/src/lib/desktopnotifications/desktopnotification.cpp +++ b/src/lib/desktopnotifications/desktopnotification.cpp @@ -79,7 +79,7 @@ void DesktopNotification::mousePressEvent(QMouseEvent* e) return; } - if (e->button() == Qt::LeftButton) { + if (e->buttons() == Qt::LeftButton) { m_dragPosition = e->globalPos() - frameGeometry().topLeft(); e->accept(); } diff --git a/src/lib/navigation/completer/locationcompleterview.cpp b/src/lib/navigation/completer/locationcompleterview.cpp index 72a5025cc..a9f374e16 100644 --- a/src/lib/navigation/completer/locationcompleterview.cpp +++ b/src/lib/navigation/completer/locationcompleterview.cpp @@ -27,7 +27,6 @@ LocationCompleterView::LocationCompleterView() : QListView(0) , m_ignoreNextMouseMove(false) - , m_buttons(Qt::NoButton) { setWindowFlags(Qt::Popup); @@ -243,29 +242,23 @@ void LocationCompleterView::mouseMoveEvent(QMouseEvent* event) QListView::mouseMoveEvent(event); } -void LocationCompleterView::mousePressEvent(QMouseEvent* event) -{ - m_buttons = event->buttons(); - - QListView::mousePressEvent(event); -} - void LocationCompleterView::mouseReleaseEvent(QMouseEvent* event) { if (m_hoveredIndex.isValid()) { + Qt::MouseButton button = event->button(); Qt::KeyboardModifiers modifiers = event->modifiers(); - if (m_buttons == Qt::LeftButton && modifiers == Qt::NoModifier) { + if (button == Qt::LeftButton && modifiers == Qt::NoModifier) { emit indexActivated(m_hoveredIndex); return; } - if (m_buttons == Qt::MiddleButton || (m_buttons == Qt::LeftButton && modifiers == Qt::ControlModifier)) { + if (button == Qt::MiddleButton || (button == Qt::LeftButton && modifiers == Qt::ControlModifier)) { emit indexCtrlActivated(m_hoveredIndex); return; } - if (m_buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) { + if (button == Qt::LeftButton && modifiers == Qt::ShiftModifier) { emit indexShiftActivated(m_hoveredIndex); return; } diff --git a/src/lib/navigation/completer/locationcompleterview.h b/src/lib/navigation/completer/locationcompleterview.h index d49b58e79..f7813671d 100644 --- a/src/lib/navigation/completer/locationcompleterview.h +++ b/src/lib/navigation/completer/locationcompleterview.h @@ -50,7 +50,6 @@ private slots: protected: void mouseMoveEvent(QMouseEvent* event); - void mousePressEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); private: @@ -58,7 +57,6 @@ private: LocationCompleterDelegate* m_delegate; QPersistentModelIndex m_hoveredIndex; - Qt::MouseButtons m_buttons; }; #endif // LOCATIONCOMPLETERVIEW_H diff --git a/src/lib/navigation/siteicon.cpp b/src/lib/navigation/siteicon.cpp index 157bd233f..18a7da560 100644 --- a/src/lib/navigation/siteicon.cpp +++ b/src/lib/navigation/siteicon.cpp @@ -71,7 +71,7 @@ void SiteIcon::contextMenuEvent(QContextMenuEvent* e) void SiteIcon::mousePressEvent(QMouseEvent* e) { - if (e->buttons() & Qt::LeftButton) { + if (e->buttons() == Qt::LeftButton) { m_dragStartPosition = e->pos(); } @@ -83,7 +83,7 @@ void SiteIcon::mousePressEvent(QMouseEvent* e) void SiteIcon::mouseMoveEvent(QMouseEvent* e) { - if (!m_locationBar || !(e->buttons() & Qt::LeftButton)) { + if (!m_locationBar || e->buttons() != Qt::LeftButton) { ToolButton::mouseMoveEvent(e); return; } diff --git a/src/lib/tools/combotabbar.cpp b/src/lib/tools/combotabbar.cpp index b0ca996e0..e22d7bae9 100644 --- a/src/lib/tools/combotabbar.cpp +++ b/src/lib/tools/combotabbar.cpp @@ -1056,7 +1056,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event) void TabBarHelper::mousePressEvent(QMouseEvent* event) { event->ignore(); - if (event->button() == Qt::LeftButton) { + if (event->buttons() == Qt::LeftButton) { m_pressedIndex = tabAt(event->pos()); if (m_pressedIndex != -1) { m_pressedGlobalX = event->globalX(); diff --git a/src/lib/tools/toolbutton.cpp b/src/lib/tools/toolbutton.cpp index 63b69ea30..7580e5eb7 100644 --- a/src/lib/tools/toolbutton.cpp +++ b/src/lib/tools/toolbutton.cpp @@ -125,20 +125,20 @@ void ToolButton::setMultiIcon(const QPixmap &image) void ToolButton::mousePressEvent(QMouseEvent* e) { - if (e->button() == Qt::LeftButton && menu() && popupMode() == QToolButton::InstantPopup) { + if (e->buttons() == Qt::LeftButton && menu() && popupMode() == QToolButton::InstantPopup) { setDown(true); showMenu(); return; } - if (e->button() == Qt::RightButton && menu()) { + if (e->buttons() == Qt::RightButton && menu()) { setDown(true); showMenu(); return; } - if (e->button() == Qt::MiddleButton) { + if (e->buttons() == Qt::MiddleButton) { setDown(true); } @@ -167,7 +167,7 @@ void ToolButton::mouseDoubleClickEvent(QMouseEvent* e) { QToolButton::mouseDoubleClickEvent(e); - if (e->button() == Qt::LeftButton) { + if (e->buttons() == Qt::LeftButton) { emit doubleClicked(); } } diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index b09c0fa86..fd07c16b4 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -572,7 +572,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event) return; } - if (event->button() == Qt::LeftButton && tabAt(event->pos()) == -1) { + if (event->buttons() == Qt::LeftButton && tabAt(event->pos()) == -1) { m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true); return; } @@ -588,7 +588,7 @@ void TabBar::mousePressEvent(QMouseEvent* event) return; } - if (event->buttons() & Qt::LeftButton && tabAt(event->pos()) != -1) { + if (event->buttons() == Qt::LeftButton && tabAt(event->pos()) != -1) { m_dragStartPosition = mapFromGlobal(event->globalPos()); } else {