qt5base-lts/tests/auto
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
..
bic/data Add binary compatibility file built against 6.5.0 2023-04-19 15:40:36 +00:00
cmake Bump version to 6.7.0 2023-06-12 14:46:07 +01:00
concurrent QVariant::value/qvariant_cast: add rvalue optimization 2023-06-12 09:58:58 +02:00
corelib QAbstractProxyModel: delay headerDataChanged emissions when inserting/removing rows/columns 2023-06-23 16:24:27 +02:00
dbus QDBus: Transform fallback interface names according to the spec 2023-06-20 19:53:47 +02:00
gui QPixmapCache: don't leak QString keys of evicted pixmap 2023-06-20 15:25:20 +02:00
guiapplauncher Move Weather Anchor Layout example to manual tests 2023-03-02 05:55:57 +01:00
network Android: explicitly bundle the OpenSSL libs for tests 2023-06-21 01:04:04 +03:00
opengl tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
other macOS: Extend accessibility testing of treeview 2023-05-23 19:42:16 +02:00
printsupport tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
shared tests: remove PlatformInputContext::filterEvent() 2023-01-18 13:21:06 +01:00
sql SQL: Make QSqlDatabase::DriverDict creation thread-safe 2023-05-24 17:27:55 +02:00
testlib Move the formatting of <chrono> durations to QDebug & QtTest 2023-05-06 17:54:23 +00:00
tools Moc: fix generated code for nested enum class corner case 2023-06-18 21:28:58 +03:00
wasm Support child windows on WASM 2023-06-15 09:41:06 +02:00
widgets QHeaderView: Don't add new sections on no-op 2023-06-23 19:21:42 +02:00
xml QDomDocument: no longer drop a provided 'standalone' attribute if 'no' 2023-04-24 21:49:29 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
network-settings.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00