diff options
author | Roland Knall <rknall@gmail.com> | 2019-11-12 12:54:28 +0100 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-11-12 13:55:54 +0000 |
commit | 7a1a45c5234e64286452863088bb9552922b2b3c (patch) | |
tree | 537118266eeb7eecf58a8bfc1cf9ccacaf3104a1 /ui/qt | |
parent | 75a4be6cf2263fa26ccba45560bc7910fc795faa (diff) |
Qt: Signal empty display filter bar
If a display filter is applied, but the display filter bar
has been cleared by deleting the context (either by setting a
space or backspacing over the filter), it is not clearly indicated
that the filter is still being applied.
Bug: 12438
Change-Id: Ibd4c48b094467182ed51e9859e0d5fad770000c7
Reviewed-on: https://code.wireshark.org/review/35070
Petri-Dish: Roland Knall <rknall@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/widgets/display_filter_edit.cpp | 18 | ||||
-rw-r--r-- | ui/qt/widgets/display_filter_edit.h | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/ui/qt/widgets/display_filter_edit.cpp b/ui/qt/widgets/display_filter_edit.cpp index 1a4458c904..29d036a397 100644 --- a/ui/qt/widgets/display_filter_edit.cpp +++ b/ui/qt/widgets/display_filter_edit.cpp @@ -69,7 +69,8 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type bookmark_button_(NULL), clear_button_(NULL), apply_button_(NULL), - leftAlignActions_(false) + leftAlignActions_(false), + last_applied_(QString()) { setAccessibleName(tr("Display filter entry")); @@ -333,8 +334,10 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text) if ( filter_text.length() > 0 ) clear_button_->setVisible(true); - else - setPlaceholderText(""); + else if ( last_applied_.length() > 0 ) + setPlaceholderText(tr("Current filter: %1").arg(last_applied_)); + else if ( filter_text.length() <= 0 && last_applied_.length() <= 0 ) + clear_button_->setVisible(false); alignActionButtons(); } @@ -548,6 +551,7 @@ void DisplayFilterEdit::clearFilter() { clear(); + last_applied_ = QString(); updateClearButton(); emit filterPackets(QString(), true); @@ -558,6 +562,9 @@ void DisplayFilterEdit::applyDisplayFilter() if (syntaxState() == Invalid) return; + if ( text().length() > 0 ) + last_applied_ = text(); + updateClearButton(); emit filterPackets(text(), true); @@ -642,7 +649,9 @@ void DisplayFilterEdit::applyOrPrepareFilter() if ( ! pa || pa->property("display_filter").toString().isEmpty() ) return; - setText(pa->property("display_filter").toString()); + QString filterText = pa->property("display_filter").toString(); + last_applied_ = filterText; + setText(filterText); // Holding down the Shift key will only prepare filter. if (!(QApplication::keyboardModifiers() & Qt::ShiftModifier)) { @@ -730,6 +739,7 @@ void DisplayFilterEdit::dropEvent(QDropEvent *event) return; } + last_applied_ = filterText; setText(filterText); // Holding down the Shift key will only prepare filter. diff --git a/ui/qt/widgets/display_filter_edit.h b/ui/qt/widgets/display_filter_edit.h index a87adca67f..d3b181dff7 100644 --- a/ui/qt/widgets/display_filter_edit.h +++ b/ui/qt/widgets/display_filter_edit.h @@ -75,6 +75,7 @@ private: StockIconToolButton *clear_button_; StockIconToolButton *apply_button_; bool leftAlignActions_; + QString last_applied_; void setDefaultPlaceholderText(); void buildCompletionList(const QString& field_word); |