Skip to content

Commit baaeea8

Browse files
committed
Fix table header issues in a more portable way
This undoes 9e2f8e5 and try to solve the issues present in Linux with Qt 5.9 and the one in Windows with the Dark Style at the same time. I think both issues come from using the filter box height as y offset. The real offset has to be the original table header height. In Windows+Dark the box is apparently shorter, so after moving, part of the header is clipped. In Linux+Qt5.9, the original header height is shorter than the filter box, so moving by the filter box height clips the filter box at the bottom. The new height increment for the table header is also reduced to 4, so the margin is 2 in both the bottom and the top of the filter boxes. See issue #1493
1 parent 4b5b5c6 commit baaeea8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/FilterTableHeader.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ QSize FilterTableHeader::sizeHint() const
5050
// For the size hint just take the value of the standard implementation and add the height of a input widget to it if necessary
5151
QSize s = QHeaderView::sizeHint();
5252
if(filterWidgets.size())
53-
s.setHeight(s.height() + filterWidgets.at(0)->sizeHint().height() + 5); // The 5 adds just adds some extra space
53+
s.setHeight(s.height() + filterWidgets.at(0)->sizeHint().height() + 4); // The 4 adds just adds some extra space
5454
return s;
5555
}
5656

@@ -74,15 +74,14 @@ void FilterTableHeader::adjustPositions()
7474
{
7575
// Get the current widget, move it and resize it
7676
QWidget* w = filterWidgets.at(i);
77+
// The two adds some extra space between the header label and the input widget
78+
int y = QHeaderView::sizeHint().height() + 2;
7779
if (QApplication::layoutDirection() == Qt::RightToLeft)
78-
w->move(width() - (sectionPosition(i) + sectionSize(i) - offset()), w->sizeHint().height() + 2); // The two adds some extra space between the header label and the input widget
80+
w->move(width() - (sectionPosition(i) + sectionSize(i) - offset()), y);
7981
else
80-
w->move(sectionPosition(i) - offset(), w->sizeHint().height() + 2); // The two adds some extra space between the header label and the input widget
82+
w->move(sectionPosition(i) - offset(), y);
8183
w->resize(sectionSize(i), w->sizeHint().height());
8284
}
83-
// And finally add that extra space to the header so the filter box is not clipped.
84-
if(filterWidgets.size() > 0)
85-
setMinimumSize(sizeHint().width(), sizeHint().height() + 2);
8685
}
8786

8887
void FilterTableHeader::inputChanged(const QString& new_value)

0 commit comments

Comments
 (0)