Questions tagged [qcompleter]

A QCompleter is a class from the Qt toolkit which provides completions based on an item model.

QCompleter can be set to provide auto-completion for any widget.

A simple example of using the QCompleter will look like this:

//this will contain the words for autocompletion.
QStringList words;
//Let's populate it:
words << "hello" << "word" << "this" << "is" << "qt" << "auto-completer";
//We will be using auto-completer for a QLineEdit
QLineEdit * l = new QLineEdit();
//Creating the QCompleter, and giving it the word list
QCompleter * completer = new QCompleter( words );
//Setting the case sensivity
completer->setCaseSensitivity( Qt::CaseInsensitive );
//Assigning the completer to the LineEdit
l->setCompleter( completer );
//And finally showing the edit.
l->show();

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

122 questions
2
votes
1 answer

Multicolumn Model for QCompleter

I'm trying to work with QCompleter for autocompletion on a QComboBox. The two pictures below show the populated combobox(left) and a QCompleter on the column 1 (right). This example works fine as long as the model columns for the QComboBox and…
bfris
  • 5,272
  • 1
  • 20
  • 37
2
votes
1 answer

PyQt5 Adding QCompleter to Existing QTextEdit

I am currently creating a SQL Editor and Query Wizard with PyQt5 and am running into an issue when trying to add a QCompleter to all my QPlainTextEdits in the wizard. All the UI is created with Qt Designer and is stored in a QStackedWidget. I have…
Drew M.
  • 49
  • 6
2
votes
2 answers

model/view QCompleter in a QLineEdit

ubuntu 10.04, KDE 4.4.5 python 2.6.4 qt 4.6.2 pyqt 4.6.2 I'm trying to create a QCompleter, which works fine if I just build the QLineEdit. However if I drop the QLineEdit into a QMainWindow, the QCompleter no longer works. Here is the LineEdit…
T Carrasco
  • 463
  • 2
  • 6
  • 16
2
votes
1 answer

how to remove the cursor in QLineedit completer

This is my sample program for Qlineedit Completer. After Autosuggestion i want to display the text as starting of the item in line edit for that i wrote completer.activated.connect(lambda: QTimer.singleShot(0, lambda: edit.home(False))). Its…
raghava
  • 119
  • 2
  • 11
2
votes
1 answer

python GUI autocomplete by key value

I am trying to create an autocomplete GUI in python such that as I type a first name, I see possible last names. For example, let's say I have this dictionary: {"George": ["Washington", "Bush"]}. When I start typing "G", I want it to show…
SKCSS
  • 37
  • 4
2
votes
1 answer

change style of QCompleter?

I try to aplicate a stylesheet in a QLineEdit in especific in a popup of QCompleter. in QtDesigner try: code: QLineEdit#lineEdit::popup{ background:red; } but it does not work What I'm looking for is to change the color of the letter, background…
Mystic_Force
  • 263
  • 3
  • 12
2
votes
0 answers

QCompleter in QTreeView not completing expected column

I am installing a QCompleter on a QTreeView via a QStyledItemDelegate. My QStandardItemModel looks something like the following: Item 1 \_ Item A, Item B, Item C \_ Item D, Item E, Item F Item 2 \_ Item G, Item H, Item I In the subclassed…
Spencer
  • 1,931
  • 1
  • 21
  • 44
2
votes
1 answer

QListWidget Editable Item signal upon text change

On Qt 4.6.1, when I connect the itemChanged signal from a QListWidget, I do not see the continual emitting behaviour upon every edit as discussed in Qt - signal for when QListWidget row is edited? For me it only emits itemChanged upon pressing…
John
  • 55
  • 6
2
votes
1 answer

QCompleter with additional result

Need some help. I have a QCompleter with some QStringList, for example: QstringList list; list << "world" << "mouse" << "user"; It works fine when user searches in QLineEdit for a word from this list, but I want to show a changed result. For…
user7049720
2
votes
1 answer

QPlainTextEdit and QCompleter focus issue

I have read through the QCompleter docs (https://doc.qt.io/qt-5/qcompleter.html) and I've tried to implement QCompleter for a QPlainTextEdit. Now I've got it to work like this: But the problem with that is, if you start writing a word that is in…
user8513021
2
votes
1 answer

pyqt auto completion in a table

I need auto completion in a table. So far, I could make it work that I get the same list for the entire table. However, I need a dynamic list for each cell. How can I get update the list when I move to a new position in the cell? from PyQt5.QtCore…
Stephan
  • 242
  • 4
  • 16
2
votes
3 answers

PyQt - Auto Completer with QLineEdit multiple times

I want to have the possibility to use multiple times the auto completer in my QLineEdit, I found example using QTextEdit but I can't find for QLineEdit. here is a piece of code I use (very simple one) : from PyQt5.QtGui import * from PyQt5.QtCore…
syedelec
  • 1,285
  • 2
  • 19
  • 30
2
votes
1 answer

QCompleter for large models

QCompleter works slightly slow on large data sets (large models): when I start to input characters in QCombobox it passes few seconds to show auto-complete popup with variants, when input 2nd char QCompleter does not react on key press for few…
Aleksey Kontsevich
  • 4,671
  • 4
  • 46
  • 101
2
votes
1 answer

QCompleter runtime crash

I want to do a Code Completer so i subclassed QCompleter: http://hastebin.com/qeyumevisa.cpp But, when I try to run this code, i get a runtime error: And debug output shows: ASSERT: "d->widget != 0" in file util\qcompleter.cpp, line 1446 Crash…
Intelligide
  • 279
  • 2
  • 14
2
votes
0 answers

Completion for a QLineEdit with multiple models/categories

I'd like to build a completion for a QLineEdit which can take several completion models and organizes them as categories. I have a working solution based on a QSortFilterProxyModel and a tree model for the items: The root items in the model show up…
1
2
3
8 9