aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-11-20 06:14:07 +0000
committerPeter Wu <peter@lekensteyn.nl>2019-11-24 18:28:23 +0000
commit27f96069325ce84c825252d9cdf35538e57ce8d0 (patch)
treee0a989767e93ebcdf1b5c2981861aa85a3056338 /ui
parenta700bb9acbd8a960350ec2387a10b855643ad269 (diff)
Qt: fix display filter completion with few recent entries
If 1) the recent filters menu has less than 10 entries and 2) the cursor position is not at the end of the filter, then completion would fail. Additionally, pressing Enter on filters with syntax errors would also end up being saved, unintentionally. Fix these by disabling automatic addition of entries by Qt. Change-Id: I612c6cb8f317beb5459919b5c65b837db6150d07 Reviewed-on: https://code.wireshark.org/review/35150 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/widgets/display_filter_combo.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/qt/widgets/display_filter_combo.cpp b/ui/qt/widgets/display_filter_combo.cpp
index d9e9e84ed7..c4d70ba373 100644
--- a/ui/qt/widgets/display_filter_combo.cpp
+++ b/ui/qt/widgets/display_filter_combo.cpp
@@ -35,6 +35,11 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
// completion for fields handled by DisplayFilterEdit.
setCompleter(0);
setLineEdit(new DisplayFilterEdit(this, DisplayFilterToApply));
+ // When the combobox menu is not entirely populated, pressing Enter would
+ // normally append entries to the end. However, before doing so it moves the
+ // cursor position to the end of the field which breaks the completer.
+ // Therefore disable this and rely on dfilter_combo_add_recent being called.
+ setInsertPolicy(QComboBox::NoInsert);
// Default is Preferred.
setSizePolicy(QSizePolicy::MinimumExpanding, sizePolicy().verticalPolicy());
setAccessibleName(tr("Display filter selector"));