Cremers
10th May 2014, 10:42
Hi,
I'm trying to get a tableview scroll to the current index I get from completer->currentIndex but I'm having no luck
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());
}
I can see the completer working, the lineedit is filled with the completing but the index stays at 0.
I'm trying to get a tableview scroll to the current index I get from completer->currentIndex but I'm having no luck
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());
}
I can see the completer working, the lineedit is filled with the completing but the index stays at 0.