Skip to content

Commit

Permalink
Tests/QTreeView: make styleOptionViewItem more robust
Browse files Browse the repository at this point in the history
styleOptionViewItem() sometimes fails due to a very small widget size
even when using showMaximized(). This might be due to a mis-configured
vm scrren size or similar. To make sure that all 4 rows are properly
painted set the minimum width to a reasonable value and also resize the
sections appropriately.

Pick-to: 6.8 6.7 6.5
Fixes: QTBUG-126494
Change-Id: I9956d3119be1ba9e0fb33e4e7b30f40b01b017a5
Reviewed-by: Axel Spoerl <[email protected]>
  • Loading branch information
chehrlic committed Aug 2, 2024
1 parent 6f62f25 commit f766236
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3374,6 +3374,12 @@ void tst_QTreeView::styleOptionViewItem()
view.setRowHidden(3, par1->index(), true);

view.setColumnHidden(1, true);
view.header()->setMinimumSectionSize(10);
// make sure that all columns are drawn in the view by using a very small section size
for (int i = 0; i < view.header()->count(); ++i)
view.header()->resizeSection(i, 20);
view.setMinimumWidth(view.header()->count() * 20);

const int visibleColumns = 4;
const int modelColumns = 5;

Expand Down

0 comments on commit f766236

Please sign in to comment.