diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-02 09:32:37 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-01-02 09:32:37 +0000 |
commit | 9de26a630fd49014b40e7322c971f3d96fc986af (patch) | |
tree | 47b9a762d7b6cfd99f37ff46dda87904da9f067b /tests/auto/widgets/itemviews | |
parent | bb6f0a5291f8a51d7dc21f13463dd2a0b27ed916 (diff) | |
parent | 0f315adf9199efcfafa44371464ab6d1fc866774 (diff) |
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r-- | tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 5293ba487a..0eec2e7c75 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -339,6 +339,17 @@ public: endRemoveColumns(); } + void removeAddLastColumnLayoutChanged() // for taskQTBUG_41124 + { + // make sure QHeaderView::_q_layoutChanged() is called + emit layoutAboutToBeChanged(); + --cols; + emit layoutChanged(); + emit layoutAboutToBeChanged(); + ++cols; + emit layoutChanged(); + } + void removeAllColumns() { beginRemoveColumns(QModelIndex(), 0, cols - 1); @@ -1344,6 +1355,18 @@ void tst_QTreeView::columnHidden() QCOMPARE(view.isColumnHidden(model.cols - 1), true); model.simulateMoveRows(); QCOMPARE(view.isColumnHidden(model.cols - 1), true); + + // QTBUG_41124: + // QHeaderViewPrivate::_q_layoutChanged was not called because it was + // disconnected in QTreeView::setModel(). _q_layoutChanged restores + // the hidden sections which is tested here + view.setColumnHidden(model.cols - 1, true); + model.removeAddLastColumnLayoutChanged(); + // we removed the last column and added a new one + // (with layoutToBeChanged/layoutChanged() for both) so column + // 1 is a new column and therefore must not be hidden when + // _q_layoutChanged() is called and is doing the right stuff + QCOMPARE(view.isColumnHidden(model.cols - 1), false); } void tst_QTreeView::rowHidden() |