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>
This commit is contained in:
parent
75a4be6cf2
commit
7a1a45c523
|
@ -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.
|
||||
|
|
|
@ -75,6 +75,7 @@ private:
|
|||
StockIconToolButton *clear_button_;
|
||||
StockIconToolButton *apply_button_;
|
||||
bool leftAlignActions_;
|
||||
QString last_applied_;
|
||||
|
||||
void setDefaultPlaceholderText();
|
||||
void buildCompletionList(const QString& field_word);
|
||||
|
|
Loading…
Reference in New Issue