summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/itemmodels
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-07-112-3/+3
|\ | | | | | | Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
| * test: migrate ModelsToTest to QRegularExpressionSamuel Gaist2019-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Ifea720470541000481fbacc510b4cb589c9990d9 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
| * test: migrate QItemSelectionModel test to QRegularExpressionSamuel Gaist2019-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Ibbd161700bf9e75736652b99dfa1ffd47e584249 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-06-034-23/+23
|\| | | | | | | | | | | Take 5. Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
| * Tests: Fix some warnings about deprecated functions not under testFriedemann Kleint2019-05-274-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings like: baselineserver/shared/baselineprotocol.cpp:295:72: warning: ‘int QImage::byteCount() const’ is deprecated: Use sizeInBytes [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:17: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:39: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:8153:60: warning: ‘T* QWeakPointer<T>::data() const [with T = const QNetworkSession]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]. ... st_qprinter.cpp:1318:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_qprinter.cpp:1362:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_largefile.cpp:492:85: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_largefile.cpp:498:91: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_qabstractitemmodel.cpp:312:25: warning: ‘void QAbstractItemModel::reset()’ is deprecated [-Wdeprecated-declarations] ... tst_qabstractitemmodel.cpp:1793:28: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations] ... tst_qcolor.cpp:1425:33: warning: ‘QColor QColor::light(int) const’ is deprecated: Use QColor::lighter() instead [-Wdeprecated-declarations] tst_qcolor.cpp:1432:31: warning: ‘QColor QColor::dark(int) const’ is deprecated: Use QColor::darker() instead [-Wdeprecated-declarations] tst_qprinterinfo.cpp:303:61: warning: 'QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const' is deprecated [-Wdeprecated-declarations] tst_qprinterinfo.cpp:304:65: warning: 'QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const' is deprecated [-Wdeprecated-declarations] tst_qtextdocumentfragment.cpp:947:52: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] tst_qtextlayout.cpp:2261:61: warning: ‘void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>&)’ is deprecated: Use setFormats() [-Wdeprecated-declarations] tst_qtextlayout.cpp:2330:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] tst_qitemselectionmodel.cpp:2214:37: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] ... tst_qtextlist.cpp:317:68: warning: 'bool QTextList::isEmpty() const' is deprecated: Use count() instead [-Wdeprecated-declarations] tst_qpainter.cpp:373:32: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:374:40: warning: ‘bool QPainter::matrixEnabled() const’ is deprecated: Use worldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:702:45: warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] tst_qpainter.cpp:1573:29: warning: ‘void QPainter::drawRoundRect(const QRect&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:76:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:81:41: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:105:30: warning: ‘virtual void QPdfWriter::setMargins(const QPagedPaintDevice::Margins&)’ is deprecated: Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:172:37: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:258:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp:3980:54: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] tst_qlocale.cpp:434:26: warning: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] ... Change-Id: I77c1a934b27119eedeb26a77c913686314a2a5c7 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge commit 'dev' into 'wip/cmake-merge'Tobias Hunger2019-04-169-11/+1001
|\| | | | | | | Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
| * Replace qMove with std::moveAllan Sandfeld Jensen2019-04-061-1/+1
| | | | | | | | | | | | Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
| * Merge remote-tracking branch 'origin/5.12' into 5.13Friedemann Kleint2019-03-264-4/+52
| |\ | | | | | | | | | Change-Id: I71cc71881fb638e207d83a8733bad8f267701c0f
| | * Fix tree recursion in QAbstractItemModel::match()Friedemann Kleint2019-03-222-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Recurse down the sibling at column 0 of the index instead down the index. Change-Id: Ie78d8b28eab7438ca3f83ee0df177115ca82806e Fixes: QTBUG-73864 Reviewed-by: David Faure <david.faure@kdab.com>
| | * Silence the item model testsFriedemann Kleint2019-03-214-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a logging category for the qDebug()-output. Add a meta type registration for QList<QPersistentModelIndex>, fixing numerous warnings like: WARN : tst_QItemModel::remove(QStandardItemModel:invalid start, valid count 5) QSignalSpy: Unable to handle parameter 'parents' of type 'QList<QPersistentModelIndex>' of method 'layoutChanged', use qRegisterMetaType to register it. Fix a Clang warning about potential misuse of operator , Task-number: QTBUG-73864 Change-Id: I60998403a44f5df8767926951ee13d1ed1e93c37 Reviewed-by: David Faure <david.faure@kdab.com>
| * | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-041-0/+20
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also blacklist tst_QRawFont::unsupportedWritingSystem() and tst_QGlyphRun::mixedScripts() on windows for now. Conflicts: qmake/generators/makefile.cpp src/corelib/itemmodels/qstringlistmodel.cpp src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp tests/auto/gui/text/qglyphrun/BLACKLIST tests/auto/gui/text/qrawfont/BLACKLIST Task-number: QTBUG-72836 Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
| | * Fix QStringListModel::setData to check for actual changesLuca Beldi2018-12-241-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStringListModel::setData documentation states that "The dataChanged() signal is emitted if the item is changed." This patch actually respects the doc. setData will check that the data actually changed before sending the dataChanged signal. [ChangeLog][QtCore][QStringListModel] setData will now emit the dataChanged() signal only if the string set is different from the one already contained in the model Change-Id: I4308a6f3b4851203fb899c5e29a36076e0c32f2f Reviewed-by: David Faure <david.faure@kdab.com>
| * | New proxy model: QTransposeProxyModelLuca Beldi2018-11-053-0/+922
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented a new proxy model to transpose the source model. Rows will become columns and vice-versa. Both flat and tree models supported. [ChangeLog][QtCore] New class QTransposeProxyModel to swap rows and columns of the source model. Change-Id: I902963c6b81aa0f63b5ad2bddca538f28b565084 Reviewed-by: David Faure <david.faure@kdab.com>
| * | Fix use of deprecated ItemDataRoles Background/TextColorRoleChristian Ehrlicher2018-11-052-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace BackgroundColorRole/TextColorRole with BackgroundRole/ForegroundRole and explicit deprecate them for 5.13 Change-Id: I6b0d99844a32d2f5fdfd1878317a7b7422b800d3 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-10-251-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/animation/qpropertyanimation.cpp src/gui/image/qicon.cpp tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp Change-Id: I3698172b7b44ebb487cb38f50fd2c4a9f8a35b21
| | * Fix building tests with -no-guiJüri Valdmann2018-10-201-2/+2
| | | | | | | | | | | | | | | Change-Id: I37307080e5adc334fcfcdd2fee650d675228a746 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Begin port of qtbase to CMakeSimon Hausmann2018-11-014-0/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done-by: Alexandru Croitor <alexandru.croitor@qt.io> Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Done-by: Kevin Funk <kevin.funk@kdab.com> Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Done-by: Simon Hausmann <simon.hausmann@qt.io> Done-by: Tobias Hunger <tobias.hunger@qt.io> Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-by: Volker Krause <volker.krause@kdab.com> Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-10-081-0/+10
|\| | | | | | | | | | | | | Conflicts: src/widgets/styles/qstylesheetstyle.cpp Change-Id: I3a503b44ae413fbc0a90f4af70b8f84daffd86ad
| * QSFPM: don't let setFilterRegExp(QString) overwrite CaseSensitivityDavid Faure2018-10-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression from commit 346c15102b, which creates a new QRegExp in setFilterRegExp, losing previously set case sensitivity property (i.e. when the code does proxy->setFilterCaseSensitivity(Qt::CaseInsensitive) before setFilterRegExp). Interestingly that commit ensured that setFilterFixedString would still preserve CaseSensitivity, but not setFilterRegExp(QString). Change-Id: I3d37d001ce6e86dd90e7e07431440a42607172f9 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
* | New proxy model: QConcatenateTablesProxyModelDavid Faure2018-09-093-0/+829
| | | | | | | | | | | | | | | | | | | | | | | | | | It takes multiple source models and concatenates their rows into a single model. With full unit tests. [ChangeLog][QtCore] New class QConcatenateTablesProxyModel, to concatenate the rows from multiple source models. Change-Id: Iaf4f325473adef106f423677fdc5ee0e35e87d35 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-09-072-0/+55
|\| | | | | | | Change-Id: I799e2ca2fefa140c8b73b73aa959c6ed8da6eae6
| * QSortFilterProxyModel: add test for inserting via a QComboBoxOlga Radko2018-09-062-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This new test double-checks the bugfix for QSortFilterProxyModel::insertRows in commit 70ba75519d. Previously, when using QComboBox on top of QSortFilterProxyModel and calling QComboBox::addItem with row==rowCount(), an empty item was inserted in one place, and then another item was modified (instead of the inserted empty one). This test checks that the above bugfix indeed fixes the behavior of QComboBox::addItem when used in this manner. Task-number: QTBUG-69158 Change-Id: Id01345e0525694a57250c656222d626e2267aa8e Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: David Faure <david.faure@kdab.com>
* | Reimplement QStringListModel::setItemDataLuca Beldi2018-09-061-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | Before this patch QStringListModel::setItemData emitted dataChanged twice if the roles map contained both DisplayRole and EditRole. This fixes the duplication. Increased efficiency of QStringListModel::itemData Task-number: QTBUG-67511 Change-Id: Ibaea17530f15627a3cb8003e5284e54001731ded Reviewed-by: David Faure <david.faure@kdab.com>
* | Implement QListModel::moveRowsLuca Beldi2018-09-061-8/+8
| | | | | | | | | | | | | | | | | | | | Implemented the virtual method moveRows to allow row movement. [ChangeLog][QtWidgets][QListWidget] Implemented moveRows in model Task-number: QTBUG-69807 Change-Id: I212b560b8778306a0315d9d5e4710efcc7dbbe44 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-08-232-0/+236
|\| | | | | | | Change-Id: I1114f90a2ed04a784a66505960b0f2460778726d
| * Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-08-222-0/+236
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/text/qtextengine.cpp tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h Change-Id: Ib9f968edbb0f3387c89bc25e914321d0738bfadc
| | * QSortFilterProxyModel inserting at bottom of source modelLuca Beldi2018-08-171-0/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, if you try to insert a row at the bottom of QSortFilterProxyModel the row will be inserted in the source model at position proxy->rowCount rather than at the bottom. This causes insert at apparently random positions in the source. [ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel::insertRows(row,count,parent) with row == QSortFilterProxyModel::rowCount will insert at the bottom of the source model rather than at the row QSortFilterProxyModel::rowCount of the source model Task-number: QTBUG-58499 Task-number: QTBUG-69158 Change-Id: Ie78416c8fbc429303b8c9c98375630e3e4d85f6d Reviewed-by: David Faure <david.faure@kdab.com>
* | | Implement QStringListModel::moveRowsLuca Beldi2018-08-231-0/+105
|/ / | | | | | | | | | | | | | | | | | | Implemented the virtual method moveRows to allow row movement [ChangeLog][QtCore][QStringListModel] Implemented moveRows Task-number: QTBUG-69807 Change-Id: I518f48a321bd755ab56f2fe84883d27324cc42ec Reviewed-by: David Faure <david.faure@kdab.com>
* | Add support for QRegularExpression to QSortFilterProxyModelSamuel Gaist2018-08-1911-179/+420
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the support for QRegularExpression in QSortFilterProxyModel. [ChangeLog][QtCore][QSFPM] QSortFilterProxyModel now supports QRegularExpression. Task-number: QTBUG-46810 Change-Id: If932d55f98f9b8bcf3a72c03ffd51da52cb50ad1 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge branch '5.11' into devEdward Welbourne2018-07-311-0/+48
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| * QSFPM unittest: check dataChanged and layoutChanged signalsDavid Faure2018-07-281-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm not sure why QSFPM purposefully emits dataChanged for a source dataChanged that triggers a layoutChanged (i.e. due to sorting, multiple rows are moving around). (This predates the git import in Qt 4.5.) Surely whoever is listening will not gain much from the "small" dataChanged after the "big" layoutChanged... anyhow, this documents the current behavior, at least. It also proves that the bug I saw long ago (changing a filtered-out value used to emit dataChanged(invalid, invalid), IIRC) is no longer present. Change-Id: I8975c549db88226b2b3393de9f8dca4f4109df15 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-022-9/+42
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * QSortFilterProxyModel unittest: add test for filtered-out-after-setDataDavid Faure2018-06-281-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | The row names for this test were very unspecific. After reverse-engineering what they are testing, I gave them proper descriptive names, which allowed me to notice that there were tests for "filtered in after sourceModel->setData" but not for "filtered out after sourceModel->setData". Change-Id: Ib79108db803ae77fb65d29cf0c0ef96c26655980 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
| * QAbstractItemModelTester: fix out-of-bounds index() callsDavid Faure2018-06-271-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When removing rows, the tester is looking at the data of the row "just before" and the row "just after" the removed rows, to see if they are still the same at the end of the removal operation. Guard this with bounds check, in case there is no row just before or just after. This is the opportunity to use modeltester in tst_qidentityproxymodel, which was already a testcase for removing the only row in a given parent. Change-Id: Iec8228c16b9c670b794e2665356d153679178494 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-291-4/+14
|\| | | | | | | Change-Id: I8d8b03ea46c537b091b72dc7b68aa6aa3a627ba6
| * QSortFilterProxyModel: don't assert when old model gets destroyedChristian Ehrlicher2018-05-261-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new model was set with setSourceModel() and the mapping was built up, the destruction of the old model caused a reset in the QSortFilterProxyModel which lead to an empty view or an assertion. Now we properly disconnect the old model again and also clean up the old mapping/persistent indexes when a new source model is set. Task-number: QTBUG-44962 Task-number: QTBUG-67948 Task-number: QTBUG-68427 Change-Id: I2e0612899c210bde3ac0cfa59aefd78269deee5b Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-021-0/+96
|\| | | | | | | Change-Id: Ia082e20e2eb4b76afd4c1a1584ff4e5514655d7a
| * QItemSelectionModel: More fixes for is(Column/Row)SelectedDaniel Teske2018-04-301-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the code for isRowSelected and isColumnSelected with a much simpler algorithm for deciding if a row/column is selected. In a model with a cross-hatch of unselectable indexes, the return values of is(Column/Row)Selected would depend on the order in which the selections were done. Task-number: QTBUG-18001 Change-Id: I6aa4b1df7c07fae469a686041927fa8c42bc9b16 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QSFPM: Faster row removesTim Angus2018-03-131-39/+173
|/ | | | | | | | | | | | | | | When the source model of a QSortFilterProxyModel has rows removed, a mapping is performed in order to figure out which corresponding rows in the sorted and filtered view of the model are affected. In doing so it constructs a vector of removal intervals which are subsequently used to emit rowsRemoved signals. In the case where many rows are removed (e.g. all of them), many removal intervals are identified that are often adjacent and could be simplified, which is what this patch does. i.e. instead of emitting 3 rowsRemoved for 0-3, 4-6, 7-12, now a single rowsRemoved is emitted for 0-12. Change-Id: Ia503091cc4928378c88257cd8b431582e9ff454e Reviewed-by: David Faure <david.faure@kdab.com>
* QListWidgetItem/QStandardItem: pass role to dataChanged() signalChristian Ehrlicher2018-01-261-18/+22
| | | | | | | | | | | | QAbstractItemModel::dataChanged() gained an optional role parameter with Qt5 which was not filled within QListWidgetItem/QStandardItem setData() functions Task-number: QTBUG-55903 Task-number: QTBUG-63766 Change-Id: I4da9346ef8401cc8633dc4b2ea7d00451d1e3942 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Add QModelIndex::siblingAtColumn and ::siblingAtRowAndre Somers2018-01-122-2/+10
| | | | | | | | | | | | | | | | | | | | Data in item models is most often organized in rows, where each column contains an attribute of the item represented by the row. Often when sibling is used, it is to request another piece of data from the same row. Having a specialized version makes this easier and less awkward to do, simplifying auto sibling = index.sibling(index.row(), columnOfInterest); to auto sibling = index.siblingAtColumn(columnOfInterest); For symmetry reasons, siblingAtRow(rowOfInterest) was also added. Change-Id: Ib203b2cdb16154cbb2680d16fb5c6a7538f33d07 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-111-16/+11
|\ | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/src/hb-private.hh src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/sql/doc/src/sql-driver.qdoc Change-Id: I38f0e82fcd37926cbf3c1915e009a731040d4598
| * Fix license headersJani Heikkinen2018-01-111-16/+11
| | | | | | | | | | | | | | | | Remove usage of outdated header.LGPL21 and replace those with proper one (header.LGPL in src, header.GPL-EXCEPT in tests) Change-Id: Ia4d1c0d84b77f09787fe7c30670747a1fe2aff29 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | QAbstractItemModelTester: fix the autotestsGiuseppe D'Angelo2018-01-094-13/+12
| | | | | | | | | | | | | | | | Move the modeltest autotest in the right place, and fix the other autotests that were using it to use the version now in QtTestLib. Change-Id: Ic6838945f616d580f357c872ce0956c341be3b16 Reviewed-by: David Faure <david.faure@kdab.com>
* | Introduce QAbstractItemModel::checkIndex()Giuseppe D'Angelo2018-01-082-1/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When implementing a custom model there's the habit, in each and every function that takes a QModelIndex, to carefully checking the index passed by the caller. This index is checked for "legality" (*): does the index belong to this model, is the index pointing to an existing row and column, and so on. These checks are hand-rolled and, as such, slightly different and possibly incomplete (i.e. wrong) every time. What's worse, these checks are implemented via "ordinary" code (if statements). However, passing an illegal index to a QAIM function is a precondition violation, and as such does not (and must not) be checked in ordinary conditions, as it triggers undefined behavior. On the other hand, while debugging a custom model or a custom hierarchy of (proxy) models, having such checks in place can be a significant aid. Enter checkIndex(): a debugging helper for QAbstractItemModel and its subclasses. checkIndex() centralizes the checks for legality of a given index. User code is free to assert on it, or have some other fallback mechanism in case a check fails. (*) Using "legality" here instead of "validity" in order to avoid confusion between QModelIndex::isValid() and what checkIndex() really does. [ChangeLog][QtCore][QAbstractItemModel] Added QAbstractItemModel::checkIndex(), a debugging function for QAbstractItemModel subclasses. Change-Id: I1eea0586b1ac3ededdbfbf46759145022dc5ad86 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-1/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Fix naming of new property QSortFilterProxyModel::recursiveFilteringDavid Faure2017-11-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | Add "Enabled" to match Qt API naming rules. + fix \since tag. Change-Id: Iaf312648f7385cd7e8d3d101b561fbd4e955df25 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QSortFilterProxyModel: Clear persistent indexes on source model changeChristian Ehrlicher2017-11-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | When a new source model was set to QSortFilterProxyModel, the model tried to remap the persistent indexes to the new model which was wrong. The correct solution is to clear the persistent indexes with _q_sourceModelDestroyed() since the old source model went away. Task-number: QTBUG-44962 Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | tst_qstringlistmodel: remove an invalid testGiuseppe D'Angelo2017-11-241-6/+0
| | | | | | | | | | | | | | | | The test is removing 2 rows starting at the last row of a model. As the comment indicates, that's clearly invalid. Change-Id: I43ef00d602934965b206e2ba591ff8fd0a6ae398 Reviewed-by: David Faure <david.faure@kdab.com>
* | tst_qitemmodel: do not pass illegal indices to QAbstractItemModel APIsGiuseppe D'Angelo2017-11-241-4/+0
| | | | | | | | | | | | | | That's undefined behavior, so don't test it. Change-Id: I468637ff1835f4f50859ac3d9876463221a3285a Reviewed-by: David Faure <david.faure@kdab.com>