summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtreewidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the settingseditor example into tests/manualVolker Hilsheimer2023-12-151-1/+1
| | | | | | | | | | | | | | | | The example uses QTreeWidget when it should use a QTreeView with a dedicated item model, primarily shows how to use item views (and very little about QSettings), and is generally not useful to show how an application could or should use QSettings to store settings. Turn it into a manual test instead; it's useful for that as it supports ini and plist files, and settings in different scopes. Pick-to: 6.7 Fixes: QTBUG-119978 Change-Id: I7ce039f6391c41c679d126d90a251eee60327c39 Reviewed-by: Ed Cooke <ed.cooke@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Preparations to deprecate QItemDelegateChristian Ehrlicher2023-10-051-1/+0
| | | | | | | | | | | | | QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it took until Qt6.7 to remove the last occurrences in qtbase. - remove unused includes / replace with qabstractitemdelegate.h - replace references in the documentation with QStyledItemDelegate - adjust the examples and tests to use QStyledItemDelegate Pick-to: 6.5 6.6 Change-Id: I246755004ce2d01192a726ca0972106c237df0cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QTreeWidget: rename private functions (remove _q_ prefix)Christian Ehrlicher2023-10-011-26/+26
| | | | | | | | | Cleanup the private function names after the change to pmf-style connections. Task-number: QTBUG-117698 Change-Id: Ib03acba5823101f05d695aa31fd0d7f131443c01 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Widgets/Itemviews: use pmf-style connect in QTreeWidgetChristian Ehrlicher2023-10-011-24/+35
| | | | | | | | | | Replace all connect() calls with pmf-style connection syntax. This also means that we have to properly disconnect everything in the ctor to not trigger an assertion in QtPrivate::assertObjectType(). Task-number: QTBUG-117698 Change-Id: I652c8d6f27b23a7d4467dc39b7c12850f4d25f66 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Provide overload for Qt::AlignmentFlags in item widget itemsVolker Hilsheimer2022-06-171-0/+5
| | | | | | | | | | | | | | | | Amends 53ee4c8b1f7ae72e7005166e1c0dbc4659f2ab32, which deprecated QListWidgetItem::setTextAlignment(int) etc and provided a typesafe Qt::Alignment overload instead. However, Qt::AlignLeft by itself is of type Qt::AlignmentFlag, it only becomes a Qt::Alignment when or'ed with another alignment flag. So the deprecated int-overload was taken by the compiler, resulting in a deprecation warning. Add a Qt::AlignmentFlag overload in addition, and document it as \internal since it is just a C++ technicality that we need both. Pick-to: 6.4 Change-Id: Ide97eed7f6d1f89a5f955b2ed45167e771bd8c81 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Item widgets: clean up treatment of Qt::TextAlignmentRole / CheckStateRoleGiuseppe D'Angelo2022-05-161-3/+30
| | | | | | | | | | | | | | | | | | | | | | | The item widgets all have an API flaw: getters and setters for the text alignment deal with int instead of Qt::Alignment. Deprecate the existing setters and introduce others taking Qt::Alignment. Store the alignment directly into the item widget (now that views know how to handle it). We can't change the getters without cluttering the API, so make that a Qt 7 change. Users can prepare by forcibly casting the return value to Qt::Alignment; this is going to work in Qt 6 and 7. While at it: streamline the handling of Qt::CheckStateRole as well, avoiding to rely on a pointless Qt::CheckState to int conversion through QVariant (the setter stores a Qt::CheckState, but the getter retrieves an int and converts it to a Qt::CheckState). Task-number: QTBUG-75172 Change-Id: I9f29e818e93cb2dc1d8e042bc320162c2f692112 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTableWidget doc: remove wrong comment for itemExpanded()Christian Ehrlicher2021-12-081-3/+0
| | | | | | | | | | Since Qt5.1 (80fa4b6c8ef) expandAll() emits expanded() but within this change, the comment in itemExpanded() was forgotten. Pick-to: 6.2 Pick-to: 5.15 Change-Id: Ic487e5f8999d6af27a4747b861464058faf03889 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* widgets: Fix typos in source code commentsJonas Kvinge2021-10-151-2/+2
| | | | | | Pick-to: 6.2 Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* widgets: Fix typos in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6b77f0ec043d08da3b7958d780dce9595daf97a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Consistent handling of disabled items in QItemSelectionModelAndreas Buhr2021-07-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | In QItemSelectionModel, items which are disabled or marked as not selectable should not be considered as selected. But this was not handled consistently. The following methods considered only items which are enabled and marked selectable: selectedIndexes(), rowIntersectsSelection(), and columnIntersectsSelection(). The following methods considered only items which are marked selectable, but did not check whether they are enabled: selectedRows(), selectedColumns(), isRowSelected(), isColumnSelected(), isSelected(). Finally there is hasSelection(), which did not check for enabled nor for selectable. This patch introduces consistent behavior. All methods check both whether the items are enabled and whether they are selectable now. [ChangeLog][QtCore][QItemSelectionModel][Important Behavior Changes] All methods in QItemSelectionModel now consider only items which are marked as enabled and selectable as part of the selection. Fixes: QTBUG-93829 Pick-to: 6.2 Change-Id: I4725243ea6b0db4f289ce34ada22c7a9d3282713 Reviewed-by: David Faure <david.faure@kdab.com>
* Initialize class members of QTreeWidgetItem at declarationAndreas Buhr2021-07-151-54/+11
| | | | | | | | | The members view, par, and itemFlags were initialized in each of its nine constructors. This patch moves the initilaization to the declaration to prevent this repetition. Change-Id: I71d136e7615dca5d87e8a4dc161c877633017ad0 Reviewed-by: David Faure <david.faure@kdab.com>
* QDuplicateTracker: accept the number of elements to reserve as a ctor argumentMarc Mutz2021-07-141-2/+1
| | | | | | | | | | | | This prevents us from first reserve()ing Prealloc elements, and then possibly reserve()ing a larger number, which leaves the first bucket list's memory unused. Consequently, deprecate reserve(). Change-Id: Ifc0a5a021097f4589557e7b5e45d9d0892797ade Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use RAII object to skip pending sorts in QTreeWidgetAndreas Buhr2021-07-121-15/+5
| | | | | | | | | | | | | Cleanup: This patch does not change functionality. In several places, sorting inside of the QTreeModel is disabled and afterwards restored. There is a RAII class for this, which is used in some places, but not in others. This patch introduces more consistent usage of this RAII object. Change-Id: I9802998ad31d0f9d4417824f72ff0abbb0c38a17 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* ItemViews: don't delete dragged items when a subclass accepted the moveVolker Hilsheimer2021-05-011-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 0f1008a5936c903ca9448193df7df6117e2c617b, which introduced the dropEventMoved private data member through which the drop-site itemview can notify the drag-site that the drop handler has taken care of the move operation. However, if a subclass of an item view overrides dropEvent to move and accept the event before calling the default implementation, then the flag would not be set, as the dropOn helper would return false. So QAbstractItemView still removed the item, resulting in two items being removed when one was move-dropped. Set the dropEventMoved member also when the QTreeWidget::dropEvent handler is called by a subclass override and the event is already accepted. This way, overrides don't have to artifically set the accepted action to "IgnoreAction" to disable the handling in drag site. [ChangeLog][QtWidgets][QAbstractItemView] Classes overriding dropEvent for MoveAction events to move data can call accept() on the event before calling the superclass to prevent QAbstractItemView from deleting the source item. Task-number: QTBUG-87057 Task-number: QTBUG-77427 Pick-to: 6.1 Change-Id: Ibe75fc1b2ca60627c825ad9b9b6d48953577edec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QTreeModel calling beginRemoveRows twiceLuca Beldi2021-04-261-11/+7
| | | | | | | | | | | | | For items that are children of other items, removeRows calls beginRemoveRows directly and then once again inside takeChild() The signal blocker that dates back to the monolitic import from Nokia prevents the model from emitting extra signals but the persistent indexes are corrupted nonetheless. Fixes: QTBUG-90030 Pick-to: 6.1 6.0 5.15 Change-Id: I5bc4b2598bf13247683b113faeec22471f1f04a4 Reviewed-by: David Faure <david.faure@kdab.com>
* QTreeWidgetItem: fix documentation error for childIndicatorPolicy()Christian Ehrlicher2021-01-051-1/+1
| | | | | | | | | | | The default value is 'DontShowIndicatorWhenChildless' and not 'ShowForChildren'. Fixes: QTBUG-83648 Pick-to: 6.0 Pick-to: 5.15 Change-Id: I5d4dd9f3f58bcac09ed38d8ae451e3b771695ce7 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* QAbstractItemView: don't lose items if model only allows MoveActionVolker Hilsheimer2020-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a model only allows MoveAction, then calls in the view/widget subclasses' dropEvent implementation to set the event's drop action to CopyAction will fail. QAbstractItemView will then remove the item when QDrag::exec returns. Instead of abusing the event actions for this, store explicitly that the dropEvent implementation already moved the item. If the flag is set, don't remove the item. In QListView, which uses moveRow to move items in the dropEvent handler, handle the case that the model might not implement moveRows. In that case, or when dropping an item onto another item (to overwrite data), fall back to the default implementation of QAbstractItemView. Sadly, it is impossible to know whether a model doesn't implement moveRows, or whether the move failed for other reasons, so this requires a bit of extra special case handling. QListView in IconMode is particularly odd in that it moves the item in the view, but not in the model. This follows up on fd894fd68edf3d67975cda8eb9dda43646887b0d and fixes additional issues discovered during debugging. Extend the existing unit test; since drag'n'drop runs a modal, native event loop on most systems, it still only runs on the Xcb platform. Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4 Pick-to: 5.15 Fixes: QTBUG-87057 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Item widgets: fix crash in mimeTypes()Giuseppe D'Angelo2020-07-081-1/+4
| | | | | | | | | | *Always* check the result of a dynamic/qobject cast. I'm not positive if the cast is correct (or should it just be a static cast), but in principle these models can be used with a different view. Change-Id: I37108cbb2744b6bf0fb46392d1cc9883f2d0b60e Pick-to: 5.15 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Use QList instead of QVector in widgetsJarek Kobus2020-07-021-10/+10
| | | | | | Task-number: QTBUG-84469 Change-Id: I3007734f8e4f164ece9dd8850ef007cbef9e12ef Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* QTreeWidget: remove deprecated function items()Christian Ehrlicher2020-06-201-12/+0
| | | | | | | | | It does not return anything and was already deprecated in Qt4.8 (and already returned an empty QList back then) Change-Id: I3a2f1b79081d3289d13ba9fdee346aa730d16114 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove dead code from src/widgetsVolker Hilsheimer2020-05-111-17/+0
| | | | | | | | Code that's removed via QT_VERSION(6, 0, 0) check is already no longer compiled. Change-Id: I70865f330a6260ac2e9cf2770d599a5b6f7bb7d4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Remove deprecated members from QtWidgets/itemviews classesVolker Hilsheimer2020-04-171-156/+0
| | | | | | | | Cleaning up those that are trivial to remove because they have direct replacements. Change-Id: Ie9fecd8c4822ed1a8f378b210cc4c4d9a10f7e36 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-3/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * QStringList: use local storage in removeDuplicates()Marc Mutz2020-01-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If available, use a C++17 std::pmr::unordered_set with a monotonic buffer resource and a 256-byte stack buffer to avoid the per-element allocations of QSet. Results on my machine: RESULT : tst_QStringList::removeDuplicates():"empty": - 0.00014 msecs per iteration (total: 74, iterations: 524288) + 0.000031 msecs per iteration (total: 66, iterations: 2097152) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.00": - 0.00043 msecs per iteration (total: 57, iterations: 131072) + 0.00013 msecs per iteration (total: 69, iterations: 524288) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.50": - 0.00049 msecs per iteration (total: 65, iterations: 131072) + 0.00032 msecs per iteration (total: 85, iterations: 262144) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.66": - 0.00057 msecs per iteration (total: 75, iterations: 131072) + 0.00039 msecs per iteration (total: 52, iterations: 131072) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.75": - 0.00064 msecs per iteration (total: 85, iterations: 131072) + 0.00048 msecs per iteration (total: 63, iterations: 131072) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.00": - 0.083 msecs per iteration (total: 85, iterations: 1024) + 0.039 msecs per iteration (total: 80, iterations: 2048) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.50": - 0.11 msecs per iteration (total: 58, iterations: 512) + 0.078 msecs per iteration (total: 80, iterations: 1024) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.66": - 0.13 msecs per iteration (total: 70, iterations: 512) + 0.10 msecs per iteration (total: 53, iterations: 512) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.75": - 0.16 msecs per iteration (total: 86, iterations: 512) + 0.13 msecs per iteration (total: 69, iterations: 512) When interpreting the data, take into account that each iteration contains _also_ a deep copy of the QStringList d/t the detach from 'input'. The pattern is used elsewhere in Qt, so I've put the class that implements the seen set into a private header file and used in some other places I found. Change-Id: I1f71a82008a16d5a3818f91f290ade21d837805e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-091-28/+28
|\| | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| * Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-28/+28
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-251-3/+10
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qhash.h src/gui/kernel/qevent.h src/widgets/kernel/qshortcut.cpp src/widgets/kernel/qshortcut.h Change-Id: If61c206ee43ad1d97f5b07f58ac93c4583ce5620
| * QList/Table/TreeWidgetItem: Allow reseting values by passing the default valueChristian Ehrlicher2019-11-221-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The convenience functions setBackground(), setForeground() and setSizeHint() a default constructed value as 'reset'. This means a default constructed QBrush or QSize is returned in the data() function which leads to an unexpected background or forground color or size hint. Therefore check if the passed value is a default constructed value and set an empty QVariant instead which. [ChangeLog][QtWidgets][ItemViews] The convenience views QList/Table/TreeWidgetItem now treat a default constructed QBrush or QSize as an empty QVariant which allows to reset the values set to it's default values. Task-number: QTBUG-76423 Change-Id: I840570bbad3e5fd8c5b4b58903b4fd0066dbdeb7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-11-061-1/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/features/mac/default_post.prf src/corelib/tools/qsimd_p.h src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm util/qfloat16-tables/gen_qfloat16_tables.cpp Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
| | * Doc: Add notes about Qt Style Sheets taking precedenceLeena Miettinen2019-10-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | ...over setting properties on individual widgets. Task-number: QTBUG-28675 Change-Id: Ic7bfd723ed8970112a9892727170d3bacaa1903f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Make QList an alias to QVectorLars Knoll2019-10-301-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This is almost 100% source compatible with Qt 5. Exceptions are * Stability of references for large or non movable types * taking a PMF for types that are now overloaded with r-value references in QVector * The missing prepend optimization in QVector (that is still planned to come for Qt 6) Change-Id: I96d44553304dd623def9c70d6fea8fa2fb0373b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-041-5/+8
|\| | | | | | | Change-Id: I31c1c469c00016f1bd21ecfab39794df372e56f2
| * QTreeWidget: Don't assume the selected indexes include the first columnAndy Shaw2019-10-031-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | If the first column is hidden in a QTreeWidget then when doing a drag then the selected indexes will not include any that have a column of 0. Therefore it has to account for this use std::unique to ensure that there is only one instance of the selected items represented by the selected indexes. Fixes: QTBUG-35511 Change-Id: I39dff596959f30db7378ff946735ee2866778524 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Remove usages of deprecated APIs of qtbase/widgetsSona Kurazyan2019-08-011-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | - Replace the usages of deprecated APIs by corresponding alternatives in the library code and documentation. - Build docs for deprecated APIs conditionally, based on deprecation version. Remove the docs of methods deprecated since 5.0.0, these methods are not compiled anymore. - Modify the tests to make them build when deprecated APIs disabled: * Make the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, add tests for the replacement Task-number: QTBUG-76491 Task-number: QTBUG-76540 Task-number: QTBUG-76541 Change-Id: I6aaf0a1369c479fb880369a38f2b8e1e86b46934 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: replace even more null/0/nullptr with \nullptr macroChristian Ehrlicher2019-05-081-2/+2
| | | | | | | | Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also checked for 'null pointer' and similar. Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtWidgets: replace 0 with \nullptr in documentationChristian Ehrlicher2019-02-021-8/+8
| | | | | | | | | Replace 0 with \nullptr in the documentation. As a drive-by also replace some 0 with nullptr in the corresponding code. Change-Id: Id8056dc2364a372e40bc04e8cb9fcc443e49fb18 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2019-01-211-1/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ibfcb30053f3aacb8ec2ec480e146538c9bf440ea
| * Documentation: Add \nullptr macro and use where applicableFriedemann Kleint2019-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt for Python users reading the documentation assume that int(0) can be passed for pointer parameters. Use the newly introduced \nullptr to disambiguate this. In a follow-up step, the \nullptr macro can be defined as None when generating the Qt for Python documentation. Task-number: PYSIDE-903 Change-Id: I3a45f87175a0668ab5f3f95f0aff409f7e3ef027 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Doc: replace QItemDelegate with QStyledItemDelegateChristian Ehrlicher2019-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since QStyledItemDelegate should be preferred over QItemDelegate the documentation should point to QStyledItemDelegate instead. Also mark some internal classes which derive from QItemDelegate so they will not be forgotten during Qt6 porting. Change-Id: I2dd17feedf8593afac5ca16d2546e1f0bc0250ae Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QTreeWidget: mark is/setFirstItemColumnSpanned() as deprecatedChristian Ehrlicher2018-12-111-11/+28
| | | | | | | | | | | | | | | | | | | | | | Deprecate the QTreeWidget functions is/setFirstItemColumnSpanned() to stay in sync with the other deprecated functions (selected/expanded/hidden) so they can get removed in Qt6. Also add a small unit test for them. Change-Id: Ie1cb5d7163c2d56d653c21e841ccaf7d38569787 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QTreeWidget: mark (is|set)Item(Selected|Hidden|Expanded) as deprecatedChristian Ehrlicher2018-11-091-42/+64
| | | | | | | | | | | | | | | | | | | | QTreeWidget::(is|set)Item(Selected|Hidden|Expanded)() are deprecated for a long time but not marked as such. Therefore explicitly mark them as deprecated so they can get removed with Qt6. Change-Id: Ie4971350de61326811e0788df0d359ed3c442869 Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | ItemWidgets: add helper function to retrieve the underlying modelChristian Ehrlicher2018-11-081-35/+45
| | | | | | | | | | | | | | | | | | | | Add a new function to return the underlying model to avoid code duplication and make the code more readable. Also replace some 0 with nullptr. Change-Id: I1ca33de6f26b4e36f46ce7d2eacc45d0799478a3 Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QItemWidgets: emit layoutChanged with proper sortHintChristian Ehrlicher2018-09-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | layout(AboutToBe)Changed gained a sortHint parameter with Qt5.0 but the itemmodels did not set a proper value where possible. Since the sorting of the ItemWidgets is only per column, it is reasonable to pass QAbstractItemModel::VerticalSortHint in the various layoutChanged calls. Change-Id: Ia11322bae1a96bc0d7d8422558a11cdfe04c2808 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Implement clearItemData in common modelsLuca Beldi2018-09-061-0/+21
|/ | | | | | | | | | A virtual method clearItemData was added to QAIM for Qt6. This patch implements that method to all Qt concrete models for which it makes sense. Task-number: QTBUG-69616 Change-Id: If980fcfc36f723128bc56ec4587c5c3a338dbbcc Reviewed-by: David Faure <david.faure@kdab.com>
* qdoc: Fix several minor errors to reduce qdoc warningsMartin Smith2018-08-141-0/+1
| | | | | | | | | | This update corrects several minor documentation errors that cause qdoc warnings. These include incorrect or missing \fn commands, incorrect uses of \e and \a commands together, incorrect spellings, etc. Change-Id: Ib26edef541fa3440025490bcf79cc101623e7f7b Reviewed-by: Martin Smith <martin.smith@qt.io>
* QTreeWidget: Keep items hidden even if their parents are reparentedAndy Shaw2018-06-151-1/+38
| | | | | | | | | | | When an item is explicitly hidden, then it should stay that way even if its parent is reparented. The item itself needs to be explicitly shown for it to be made visible. Task-number: QTBUG-54843 Change-Id: I0c6eea9a936f82d5874e3246292bd16365440411 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246