TreeViewComboBox: Fix home and end keys in presence of unselectable items

Change-Id: I33ba7677571c4b813c9dc7779f61ad7287826733
Task-number: QTCREATORBUG-13314
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Eike Ziller
2014-11-03 08:59:46 +01:00
parent bf3c55be42
commit f1c6163e6c

View File

@@ -111,12 +111,12 @@ void TreeViewComboBox::keyPressEvent(QKeyEvent *e)
setCurrentIndex(indexBelow(m_view->currentIndex())); setCurrentIndex(indexBelow(m_view->currentIndex()));
} else if (e->key() == Qt::Key_Home) { } else if (e->key() == Qt::Key_Home) {
QModelIndex index = m_view->model()->index(0, 0); QModelIndex index = m_view->model()->index(0, 0);
if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable) if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable))
index = indexBelow(index); index = indexBelow(index);
setCurrentIndex(index); setCurrentIndex(index);
} else if (e->key() == Qt::Key_End) { } else if (e->key() == Qt::Key_End) {
QModelIndex index = lastIndex(m_view->rootIndex()); QModelIndex index = lastIndex(m_view->rootIndex());
if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable) if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable))
index = indexAbove(index); index = indexAbove(index);
setCurrentIndex(index); setCurrentIndex(index);
} else { } else {