diff options
author | Eike Ziller <eike.ziller@qt.io> | 2022-09-07 10:05:17 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2022-09-08 06:10:58 +0000 |
commit | aac822de87787f1c670919af344613e78d001e72 (patch) | |
tree | 26289d35f7a0e0426f437c23a8a47698f766638e | |
parent | 0cb3459c718b8f32ed7bca1da5b804568fb5d3ad (diff) | |
download | qt-creator-aac822de87787f1c670919af344613e78d001e72.tar.gz |
HistoryCompleter: Make popup behave like default QCompleter
The default popup of QCompleter turns off scroll bars, and it looks like
turning on scroll bars leads to the wrong size at first show if
horizontal scrollbars are needed. Turn scroll bars off and also
otherwise set the same flags on the list view as QCompleter does.
Fixes: QTCREATORBUG-11811
Change-Id: I0f013bb7c0c49d399968572cc67b939410ce7f3b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/libs/utils/historycompleter.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp index 8dc45c1052..2b96ccf95f 100644 --- a/src/libs/utils/historycompleter.cpp +++ b/src/libs/utils/historycompleter.cpp @@ -76,6 +76,10 @@ public: HistoryLineView(HistoryCompleterPrivate *model_) : model(model_) { + setEditTriggers(QAbstractItemView::NoEditTriggers); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setSelectionBehavior(QAbstractItemView::SelectRows); + setSelectionMode(QAbstractItemView::SingleSelection); } void installDelegate() |