View Full Version : QCompleter display
yuvaraj.addu
15th December 2011, 10:17
Hi,
I want to display Completer ,when my line edit text is empty
How do i do these?
Thanks
Addu
pkj
15th December 2011, 15:10
QCompleter::complete(QRect) from your lineedit/textedit...
yuvaraj.addu
16th December 2011, 06:06
Hi
Completer pop up is not displayed , while line edit text is empty
code
completer = new QCompleter(wordList, ui->lineEdit);
completer->setCompletionMode(QCompleter::PopupCompletion);
ui->lineEdit->setCompleter(completer);
ui->lineEdit->completer()->complete();
even
ui->lineEdit->completer()->popup()->show(); is not helping me to show completer popup
Thanks
Addu R
RSX
16th December 2011, 07:26
If you are are calling complete() in constructor then you can notice that the popup actually appears for a moment just before the main window. Best solution would be probably this:
QAction* action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Space));
ui->lineEdit->addAction(action);
connect(action, SIGNAL(triggered()), completer, SLOT(complete()));
But if you really want the popup to appear together with main window then this could do the trick:
...
QTimer::singleShot(250, this, SLOT(func()));
}
void MainWindow::func()
{
completer->complete();
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.