Commit f9dd662a authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Prevent possible problems with delayed item layouting

To achieve this, call the super class's moveCursor() with an invalid
cursor action to make it call the private executePostedLayout()
function. This is obviously a hack, but it feels less problematic than
depending on the private headers of QTreeView.

GnuPG-bug-id: 5841
parent f3a01e0d
Pipeline #141408 passed with stage
in 1 minute and 52 seconds
......@@ -153,6 +153,9 @@ QModelIndex TreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifier
}
switch (cursorAction) {
case MoveLeft: {
// HACK: call QTreeView::moveCursor with invalid cursor action to make it call the private executePostedLayout()
(void) QTreeView::moveCursor(static_cast<CursorAction>(-1), modifiers);
int visualColumn = header()->visualIndex(current.column()) - 1;
while (visualColumn >= 0 && isColumnHidden(header()->logicalIndex(visualColumn))) {
visualColumn--;
......@@ -176,6 +179,9 @@ QModelIndex TreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifier
break;
}
case MoveRight: {
// HACK: call QTreeView::moveCursor with invalid cursor action to make it call the private executePostedLayout()
(void) QTreeView::moveCursor(static_cast<CursorAction>(-1), modifiers);
int visualColumn = header()->visualIndex(current.column()) + 1;
while (visualColumn < model()->columnCount(current.parent()) && isColumnHidden(header()->logicalIndex(visualColumn))) {
visualColumn++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment