diff options
author | João Valverde <j@v6e.pt> | 2022-10-04 15:54:15 +0100 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2022-10-04 17:06:54 +0000 |
commit | f0a633622dcd5090a6d88d159ed5d6cc56ea5440 (patch) | |
tree | 422558070a49c2992f6189cc9fe244221ea44776 /ui/qt | |
parent | 4512dfd66ddf02ce63d33c4ff5e9b2ecda28a92a (diff) |
Qt: Remove workaround for Qt bug fixed in Qt 5.5.1
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/widgets/stock_icon_tool_button.cpp | 27 | ||||
-rw-r--r-- | ui/qt/widgets/stock_icon_tool_button.h | 2 |
2 files changed, 1 insertions, 28 deletions
diff --git a/ui/qt/widgets/stock_icon_tool_button.cpp b/ui/qt/widgets/stock_icon_tool_button.cpp index c5ef17c2ba..9e2d8cb9a5 100644 --- a/ui/qt/widgets/stock_icon_tool_button.cpp +++ b/ui/qt/widgets/stock_icon_tool_button.cpp @@ -25,8 +25,7 @@ // Subclass QToolButton, which lets us catch events and set icons as needed. StockIconToolButton::StockIconToolButton(QWidget * parent, QString stock_icon_name) : - QToolButton(parent), - leave_timer_(0) + QToolButton(parent) { setStockIcon(stock_icon_name); } @@ -61,8 +60,6 @@ bool StockIconToolButton::event(QEvent *event) case QEvent::Enter: if (isEnabled()) { setIconMode(QIcon::Active); - if (leave_timer_ > 0) killTimer(leave_timer_); - leave_timer_ = startTimer(leave_interval_); } break; case QEvent::MouseButtonPress: @@ -70,31 +67,9 @@ bool StockIconToolButton::event(QEvent *event) setIconMode(QIcon::Selected); } break; - case QEvent::Leave: - if (leave_timer_ > 0) killTimer(leave_timer_); - leave_timer_ = 0; - // Fall through case QEvent::MouseButtonRelease: setIconMode(); break; - case QEvent::Timer: - { - // We can lose QEvent::Leave, QEvent::HoverLeave and underMouse() - // on macOS if a tooltip appears: - // https://bugreports.qt.io/browse/QTBUG-46379 - // Work around the issue by periodically checking the mouse - // position and scheduling a fake leave event when the mouse - // moves away. - QTimerEvent *te = (QTimerEvent *) event; - bool under_mouse = rect().contains(mapFromGlobal(QCursor::pos())); - if (te->timerId() == leave_timer_ && !under_mouse) { - killTimer(leave_timer_); - leave_timer_ = 0; - QMouseEvent *me = new QMouseEvent(QEvent::Leave, mapFromGlobal(QCursor::pos()), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - QApplication::postEvent(this, me); - } - break; - } case QEvent::ApplicationPaletteChange: setStockIcon(); break; diff --git a/ui/qt/widgets/stock_icon_tool_button.h b/ui/qt/widgets/stock_icon_tool_button.h index 61c7f0d7a6..26db61f499 100644 --- a/ui/qt/widgets/stock_icon_tool_button.h +++ b/ui/qt/widgets/stock_icon_tool_button.h @@ -26,8 +26,6 @@ protected: private: QIcon base_icon_; QString icon_name_; - int leave_timer_; - static const int leave_interval_ = 500; // ms }; #endif // STOCKICONTOOLBUTTON_H |