aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/display_filter_combo.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@zing.org>2015-09-07 09:08:39 -0700
committerGerald Combs <gerald@wireshark.org>2015-09-07 19:55:17 +0000
commit4496fdeef8e88c8200377e16fc56f44acfebc9a0 (patch)
tree8152321290bfb211d6076afad0247e7d50e32bd0 /ui/qt/display_filter_combo.cpp
parent912921b10b3852fa1957090da4b2bdee137c5fd8 (diff)
Enable the display filter arrow tooltip.
Add an event handler which ensures that the tooltip displays only when we're over the arrow subcontrol. Change-Id: I14d308344d9dd4d4ffbc7b0fe568c95f21f9a641 Reviewed-on: https://code.wireshark.org/review/10417 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/display_filter_combo.cpp')
-rw-r--r--ui/qt/display_filter_combo.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/ui/qt/display_filter_combo.cpp b/ui/qt/display_filter_combo.cpp
index 3e3f79f1aa..020766d7e7 100644
--- a/ui/qt/display_filter_combo.cpp
+++ b/ui/qt/display_filter_combo.cpp
@@ -27,6 +27,9 @@
#include <epan/prefs.h>
+#include <QHelpEvent>
+#include <QStyleOptionComboBox>
+
#include "display_filter_edit.h"
#include "display_filter_combo.h"
#include "wireshark_application.h"
@@ -62,7 +65,7 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
"QComboBox::drop-down {"
" subcontrol-origin: padding;"
" subcontrol-position: top right;"
- " width: 16px;"
+ " width: 14px;"
" border-left-width: 0px;"
" }"
@@ -75,8 +78,7 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
" left: 1px;"
"}"
);
- // XXX This applies to the whole control, not just the drop-down arrow.
-// setToolTip(tr("Select from previously used filters."));
+ setToolTip(tr("Select from previously used filters."));
connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(updateMaxCount()));
}
@@ -99,6 +101,27 @@ void DisplayFilterCombo::writeRecent(FILE *rf) {
}
}
+bool DisplayFilterCombo::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::ToolTip:
+ {
+ // Only show a tooltip for the arrow.
+ QHelpEvent *he = (QHelpEvent *) event;
+ QStyleOptionComboBox opt;
+ initStyleOption(&opt);
+ QRect scr = style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, this);
+ if (!scr.contains(he->pos())) {
+ return false;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return QComboBox::event(event);
+}
+
bool DisplayFilterCombo::checkDisplayFilter()
{
DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(lineEdit());