case Qt::Key_Left:
if (index > 0) {
case Qt::Key_Left:
if (index > 0) {
+ const int expandedParentsCount = m_model->expandedParentsCount(index);
+ if (expandedParentsCount == 0) {
+ --index;
+ } else {
+ // Go to the parent of the current item.
+ do {
+ --index;
+ } while (index > 0 && m_model->expandedParentsCount(index) == expandedParentsCount);
+ }
m_keyboardAnchorIndex = index;
m_keyboardAnchorPos = keyboardAnchorPos(index);
}
m_keyboardAnchorIndex = index;
m_keyboardAnchorPos = keyboardAnchorPos(index);
}