qt5base-lts/tests/auto/widgets
Axel Spoerl 2a1772a649 QHeaderView: Don't add new sections on no-op
When a table view adds its first row, QHeaderView::initializeSections()
is called. It initializes the vertical header view with the number of
added sections. Subsequently QHeaderView::sectionsInserted() is called
with the same amount of newly added rows/sections.
That leads to the initial amount of sections being 2x the number of
rows added in the first go. In other words, the table view will display
at least one row more than the underlying table model has.

This patch adds an OR condition to the early return check at the
beginning of QHeaderView::sectionsInserted(). The method returns early
if the number of sections equals the number of respective sections
(rows in this case) in the model.

An autotest is added in tst_QTableView::rowsInVerticalHeader().

Fixes: QTBUG-114225
Pick-to: 6.6 6.5
Change-Id: I895444f025591981965562e54e2335391db52357
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-06-23 19:21:42 +02:00
..
dialogs Allow disable native messagebox dialog 2023-05-02 10:37:17 +02:00
effects tests: blacklist tst_QGraphicsEffect::draw() on Wayland 2023-04-17 16:05:24 +02:00
graphicsview tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
itemviews QHeaderView: Don't add new sections on no-op 2023-06-23 19:21:42 +02:00
kernel Fix sending deferred delete events when posted before outermost loop 2023-06-09 16:31:35 +02:00
styles QStyleSheetStyle: Default to foreground for unset brushes only 2023-06-09 23:42:47 +02:00
util Implement QWidgetPrivate::focusObject() 2023-06-21 00:30:41 +02:00
widgets tst_qmenu: fix -Wsuggest-override 2023-06-20 15:24:50 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00