i have QCompleter and when i start completion i need to get current(first) item from popup list.
some code :
//CompleterModel == QStandardItemModel
//mComplet is QCompleter
//
showCompleter();
if (mComplet->popup()->isVisible())
{
if (index.isValid())
{
CompleterModel* model = (CompleterModel*)mComplet->model();
if (model)
{
if (item)
cout <<"item OK"<<endl;
else
cout <<"item Error"<<endl;
}
}
//CompleterModel == QStandardItemModel
//mComplet is QCompleter
//
showCompleter();
if (mComplet->popup()->isVisible())
{
QModelIndex index = mComplet->popup()->currentIndex();
if (index.isValid())
{
CompleterModel* model = (CompleterModel*)mComplet->model();
if (model)
{
QStandardItem* item = model->itemFromIndex(index);
if (item)
cout <<"item OK"<<endl;
else
cout <<"item Error"<<endl;
}
}
To copy to clipboard, switch view to plain text mode
so this function return "item Error" -- what's wrong?? (i think problem from completer sorting, but how to get proxy model?
Bookmarks