[Qt-interest] QCombox with QTreeView, selection of the current index
Alexander Semke
Alexander.Semke at web.de
Sat Feb 21 13:03:34 CET 2009
Hello,
I use QTreeView as the view in an "extended" QComboBox:
TreeViewComboBox::TreeViewComboBox(QWidget* parent):QComboBox(parent){
m_treeView.header()->hide();
setView(&m_treeView);
//...
}
How I need to select a curtain Item in the QTreeView. Following doesn't
work:
void TreeViewComboBox::setCurrentIndex(const QModelIndex& index){
m_treeView.setCurrentIndex(index);
m_treeView->selectionModel()->select(index,
QItemSelectionModel::Select);
}
I've found a similar post on this mailing list:
http://lists.trolltech.com/qt-interest/2008-06/thread00247-0.html
Selection of the current index doesn't seem to work if treeview is used. Or
did I overlook something? Can somebody provide a solution for this problem?
Best regards
Alexander
More information about the Qt-interest-old
mailing list