PDA

View Full Version : is there any Widget like searching into Google, only while searching, be appear?



Alex22
21st January 2016, 16:58
is there any Widget that only while searching, be appear like searching into Google? and always have minimum size and never effects on size of other Widgets (like opening a QComboBox window).
QListWidget is not suitable because of effecting on size of other Widgets when it is going to be bigger and bigger.

d_stranz
21st January 2016, 17:09
QListWidget is not suitable because of effecting on size of other Widgets when it is going to be bigger and bigger.

QListWidget will not change its size unless you let it. If you put it into a layout and set constraints on its maximum size, it will never get any larger than that. If your instance of QListWidget changes in size as you add more items to it, then you haven't implemented your UI design correctly.

Alex22
21st January 2016, 17:49
Thanks d_stranz,
I need it takes no space like QComboBox window (or google suggested window while searching). Is there any Widget like this? If no, then I must use a QComboBox (with no border). But in this way I need window of QComboBox always be opened. How can it be opened always

Added after 32 minutes:

I found that: QCompleter



QWidget wdg;

QStringList wordList;
wordList << "alpha" << "omega" << "omicron" << "zeta";

QLineEdit *lineEdit = new QLineEdit(&wdg);
QCompleter *completer = new QCompleter(wordList,&wdg);

completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setFilterMode(Qt::MatchContains);
lineEdit->setCompleter(completer);

wdg.show();