View Full Version : Mapping from QCompleter::completionModel to QCompleter::model
yuriry
12th October 2008, 07:59
QCompleter::currentIndex returns QModelIndex of QCompleter::compleitionModel. Would it be possible to map this index to QCompleter::model so that I could access other data associated with the completion string?
Thanks a lot in advance!
yuriry
12th October 2008, 08:21
I found that the code below works fine and gets the right index:
QAbstractProxyModel* proxyModel = qobject_cast<QAbstractProxyModel*>(m_completer->completionModel());
Q_ASSERT(proxyModel != 0);
QModelIndex index = proxyModel->mapToSource(m_completer->currentIndex());
But I haven't seen any documentation saying that QCompleter::completerModel is actually QAbstractProxyModel (naturally it should be). Is there a documented way to map indexes between these two models?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.