Re: qtableview qcompleter
QAbstractItemView::setCurrentIndex() just sets the cell for the given index to be the current one, e.g. receiving keyboard events, usually also becoming selected.
For your initial decscription you want to scroll to that cell, see QAbstractItemView::scrollTo()
Cheers,
_
Re: qtableview qcompleter
Thanks, I tried that, no change.
I think my problem is something else because in the textChanged slot completer->currentCompletion() always returns the correct string BUT completer->currentRow() and completer->currentIndex() somehow always return 0.
Re: qtableview qcompleter
Well, textChanged() is emitted whenever the line edit's text changes.
Have you tried listening to the completer's signals?
Cheers,
_
Re: qtableview qcompleter
Do you have an example of what you mean? QCompleter only has signals for when an item in the popup list is activated or higlighted. With Completer::InlineCompletion there is no popup
Re: qtableview qcompleter
Ah, sorry, missed the inline completion bit.
I assume currentCompletion() is also never anything other than a null QString?
Hmm.
You could try calling QAbstractItemModel::match() and call scrollTo() if the result has only one entry, i.e. when the match is unique.
Cheers,
_
Re: qtableview qcompleter
Yes I had been trying something like that. Fortunately currentCompletion() returns the correct string else I wouldn't have a clue at all. :) This works:
Code:
void PlaceDialog
::edited(QString s
) {
QModelIndexList matches = model->match(model->index(0, 0), Qt::DisplayRole, completer->currentCompletion());
{
table->setCurrentIndex(model->index(index.row(), 0));
break;
}
}