From 84a3c85be4b7272b07b0da7cea741dd54e1a11b5 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sun, 6 Sep 2015 10:37:15 -0700 Subject: [PATCH] Disable display filter tooltips for now. Comment out the setToolTip call in DisplayFilterCombo. The function applies to the entire control, but the text only makes sense for the drop-down arrow. Remove the tooltip for the clear button in DisplayFilterEdit. If the purpose of the "X" symbol isn't obvious then we aren't doing our job properly. Comment out the other setToolTip calls in DisplayFilterEdit for now since they interfere with leaveEvents. Add a note about a possible workaround. Change-Id: I055a30b6a5b5e07cebf1fa36e217654d390d34d0 Reviewed-on: https://code.wireshark.org/review/10405 Reviewed-by: Gerald Combs --- ui/qt/display_filter_combo.cpp | 5 ++-- ui/qt/display_filter_edit.cpp | 49 +++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ui/qt/display_filter_combo.cpp b/ui/qt/display_filter_combo.cpp index 2481c208a8..22737b82e8 100644 --- a/ui/qt/display_filter_combo.cpp +++ b/ui/qt/display_filter_combo.cpp @@ -75,9 +75,8 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) : " left: 1px;" "}" ); -#ifndef QT_NO_TOOLTIP - setToolTip(tr("Select from previously used filters")); -#endif // QT_NO_TOOLTIP + // XXX This applies to the whole control, not just the drop-down arrow. +// setToolTip(tr("Select from previously used filters")); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(updateMaxCount())); } diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp index ba2d08c1e3..69c2f8b965 100644 --- a/ui/qt/display_filter_edit.cpp +++ b/ui/qt/display_filter_edit.cpp @@ -91,25 +91,30 @@ public: } protected: - virtual void enterEvent(QEvent *evt) { - if (isEnabled()) { - setIconMode(QIcon::Active); + virtual bool event(QEvent *event) { + switch (event->type()) { + case QEvent::Enter: + // XXX We lose leave events if a tooltip appears, at least OS X. + // If we really want to enable the tooltips below we will likely + // have to add a timer to periodically check the mouse position. + if (isEnabled()) { + setIconMode(QIcon::Active); + } + break; + case QEvent::MouseButtonPress: + if (isEnabled()) { + setIconMode(QIcon::Selected); + } + break; + case QEvent::Leave: + case QEvent::MouseButtonRelease: + setIconMode(); + break; + default: + break; } - QToolButton::enterEvent(evt); - } - virtual void leaveEvent(QEvent *evt) { - setIconMode(); - QToolButton::leaveEvent(evt); - } - virtual void mousePressEvent(QMouseEvent *evt) { - if (isEnabled()) { - setIconMode(QIcon::Selected); - } - QToolButton::mousePressEvent(evt); - } - virtual void mouseReleaseEvent(QMouseEvent *evt) { - setIconMode(); - QToolButton::mouseReleaseEvent(evt); + + return QToolButton::event(event); } private: @@ -195,9 +200,8 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : bookmark_button_->setCursor(Qt::ArrowCursor); bookmark_button_->setMenu(new QMenu()); bookmark_button_->setPopupMode(QToolButton::InstantPopup); - bookmark_button_->setToolTip(tr("Manage saved bookmarks.")); +// bookmark_button_->setToolTip(tr("Manage saved bookmarks.")); // Disabled for now. Interferes with leave events. bookmark_button_->setIconSize(QSize(14, 14)); - bookmark_button_->setAutoRaise(true); bookmark_button_->setStyleSheet( "QToolButton {" " border: none;" @@ -211,9 +215,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : if (!plain_) { clear_button_ = new StockIconToolButton(this, "x-filter-clear"); clear_button_->setCursor(Qt::ArrowCursor); - clear_button_->setToolTip(tr("Clear the filter string and update the display.")); clear_button_->setIconSize(QSize(14, 14)); - clear_button_->setAutoRaise(true); clear_button_->setStyleSheet( "QToolButton {" " border: none;" @@ -231,9 +233,8 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : apply_button_ = new StockIconToolButton(this, "x-filter-apply"); apply_button_->setCursor(Qt::ArrowCursor); apply_button_->setEnabled(false); - apply_button_->setToolTip(tr("Apply this filter string to the display.")); +// apply_button_->setToolTip(tr("Apply this filter string to the display.")); // Disabled for now. Interferes with leave events. apply_button_->setIconSize(QSize(24, 14)); - apply_button_->setAutoRaise(true); apply_button_->setStyleSheet( "QToolButton {" " border: none;"