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
0
votes
1 answer

QObject::startTimer: QTimer can only be used with threads started with QThread?

I have given the model a parent, but it still shows error message when exiting, what was wrong in the following code #!/usr/bin/env python2 import os import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic import…
Shuman
  • 3,914
  • 8
  • 42
  • 65
0
votes
0 answers

Force QCompleter to reappear if user selects directory

I have a dialog where user selects file(s). I added QCompleter to the line edit, which automatically suggests next file name: However if user clicks on file, the suggestions disappear: I want them to reappear if directory is selected and display…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
0 answers

Adding Completer ui file

I have created a form in Py Qt Designer with the filename xyz.ui. As in the attached image the highlighted field is QLineEdit. I want to attach QCompleter auto completion functionality to that field, can someone tell me how to do that. I have got…
0
votes
1 answer

QLineEdit`s QCompleter stylesheet

Having a QLineEdit with a plain vanilla QStringList QCompleter. I wonder if I can change the appearance of the dropdown (I want to have either a min. size or smaller scrollbar). Clarification: I want to set it in a stylesheet, not in the…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
0
votes
1 answer

AutoComplete using two QStringList

I know how to use QCompleter class. code: QStringList wordList; wordList << "alpha" << "omega" << "omicron" << "zeta"; QLineEdit *lineEdit = new QLineEdit(this); QCompleter *completer = new QCompleter(wordList,…
user5820174
  • 151
  • 1
  • 12
0
votes
2 answers

Pass QModelIndex instead of QString when QCompleter highlighted

There is a QCompleter (set to QLineEdit) populated with QStandardItemModel. That model also populates the QTableView, I need to get the QModelIndex and select it in QTableView but it fails, it passes text instead of…
Sergii Artele
  • 63
  • 1
  • 11
0
votes
1 answer

QCompleter popup position

I'm having trouble trying to move the QCompleter popup view position. I tried the QCompeter:complete and it's pops the completer view in the position as I wanted. But if I start typing it close it, and open the completer in the 'default' position. I…
user5500455
0
votes
1 answer

QTextEdit add an abbreviate system

I'm currently working on a text editor, I want to create an abbreviate system. I mean for example when you write html5 then press key tab for example you expand an code like this : ... Maybe I used the wrong…
zed13
  • 357
  • 4
  • 21
0
votes
0 answers

QTableView + QCompleter delegate returns wrong value

I'm using Qt (C++), specifically I have a table that auto-completes using a QCompleter. I'm very new to Qt and struggling with this. My problem is that even though the QCompleter shows the correct values, the data it returns is always the data for…
David Ventura
  • 418
  • 2
  • 7
  • 20
0
votes
0 answers

PyQt4 Completer to a qlineedit

I am trying to make a completer for an line edit widget. Here is the signal : QtCore.QObject.connect(self.lineEdit, QtCore.SIGNAL(_fromUtf8("textEdited(QString)")),self.get_data) And here is the function : def get_data (self): try: …
0
votes
1 answer

QLineEdit: automatically append backslash to directory name

I'm trying to automatically add a backslash to valid file paths in a QLineEdit, which is used to show the current path of a QFileSystemModel. The code looks as follows: fileSystem = new…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
0
votes
0 answers

Segmentation fault while switching QCompleter for QLineEdit

I have data coming from two sources , one from XML file save paths , second one from QFileSystemModel which I want to work if the user couldn't see the path then in QLineEdit the user should be able to browse path !! the first letter obviously "/"…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
0
votes
1 answer

AutoCompletion pops up on focusIn but cannot set text in QLineEdit from selection

from PyQt4.Qt import Qt, QObject,QLineEdit from PyQt4 import QtGui, QtCore import utils class DirLineEdit(QLineEdit, QtCore.QObject): """docstring for DirLineEdit""" def __init__(self): super(DirLineEdit, self).__init__() …
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
0
votes
1 answer

How to customize QCompleter Completion Rules with QSortFilterProxyModel?

eg i have these three items in my QComboBox dropdown list chicken soup chilli peppers grilled chicken entering "ch" would match "chicken soup" and "chilli peppers" but not "grilled chicken". What I want is to be able to enter "ch" and match all of…
Shuman
  • 3,914
  • 8
  • 42
  • 65
0
votes
1 answer

when choose customized qcompleter dropdown list item, it does not appear in customized lineditor

I followed this great example, but when I use the arrow key to go through the customized QCompleter dropdown list item, the item does not appear in the customized line editor (it is highlighted in blue in the dropdown list). when I hit the enter…
JustDance
  • 61
  • 1
  • 5
1 2 3
8
9