Hi,
I'm trying to get a tableview scroll to the current index I get from completer->currentIndex but I'm having no luck
{
// etc
completer
->setCompletionMode
( QCompleter::InlineCompletion);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setModel(model);
edit = new LineEdit(this);
connect(edit,
SIGNAL(textChanged
(QString)),
this,
SLOT(edited
(QString)));
edit->setCompleter(completer);
//etc
}
void PlaceDialog
::edited(QString s
) {
QDebug()<s << completer->currentCompletion() << completer->currentIndex();
table->setCurrentIndex(completer->currentIndex());
}
PlaceDialog::PlaceDialog(QWidget *parent, QString def, QString filename)
{
// etc
completer = new QCompleter(this);
completer->setCompletionMode( QCompleter::InlineCompletion);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setModel(model);
edit = new LineEdit(this);
connect(edit, SIGNAL(textChanged(QString)), this, SLOT(edited(QString)));
edit->setCompleter(completer);
//etc
}
void PlaceDialog::edited(QString s)
{
QDebug()<s << completer->currentCompletion() << completer->currentIndex();
table->setCurrentIndex(completer->currentIndex());
}
To copy to clipboard, switch view to plain text mode
I can see the completer working, the lineedit is filled with the completing but the index stays at 0.
Bookmarks