summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
Commit message (Collapse)AuthorAgeFilesLines
* a11y: Notify about property/state changes of focused item view itemMichael Weghorn11 days2-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item view item data for various roles are relevant for the properties and states reported for the corresponding accessible objects on the accessibility layer, see the a11y implementation in QAccessibleTableCell. Therefore, changes to the relevant role data should also be reported as corresponding state/property changes on the a11y layer. Implement sending corresponding accessibility events from QAbstractItemView::dataChanged. While the roles param in the QAbstractItemModel::dataChanged signal that this slot is connected to is optional, only handle roles that are explicitly passed for now, which covers the case of interactively modifying items. Properly handling the case of an empty list of roles indicating that all roles should be considered as (potentially) having been modified would require to keep track of previous values to be able to only send notifications about those that actually changed. (One way to do that for the current item could be to remember the values in QAbstractItemView::currentChanged and then compare whether those have changed in the meantime.) Always sending accessibility events even if no change actually occured would be incorrect and could e.g. result in confusing/misleading screen reader announcements. For now, in order to avoid potential negative performance implications when doing that for all items, restrict this to the case where (only) the current item's data has changed, which in particular covers the case where a user interactively modifies that item. (If the need arises, this can be further extended as needed in the future.) This e.g. makes the Orca screen reader on Linux announce changes to the checkbox state for the QTBUG-141856 sample program when toggling it using the space key, and results in the state getting updated as expected in Accerciser [1]. The accessible name shown in Accerciser also gets updated as expected when modifying an item's text, and Orca announces the new name. [1] https://gitlab.gnome.org/GNOME/accerciser Task-number: QTBUG-141856 Change-Id: Ic1592f4c639c29ab4144ae8b768f26c63f8878dc Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Unify item view to a11y child index mappingMichael Weghorn11 days7-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | Different QAbstractItemViewPrivate subclasses implement mapping from the item views model index to an accessible child index. So far, the methods implementing the logic were independent and used only within the corresponding item view implementations themselves. Introduce a new virtual base class method QAbstractItemViewPrivate::accessibleChildIndex and let the existing implementations override that one. This prepares for being able to make use of that logic directly inside QAbstractItemViewPrivate in an upcoming commit. While at it, also make have those methods dependent on QT_CONFIG(accessibility). Task-number: QTBUG-141856 Change-Id: Ic02a7875eccb893f722f13489f768f3675fe14bf Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Ingo Klöcker <[email protected]>
* Doc: Fix QDoc warnings for internal classes in Qt WidgetsJerome Pasion2025-12-015-8/+31
| | | | | | | | -Internal classes should have internal class documentation. Task-number: QTBUG-141665 Change-Id: I399e0cec51a9308172301a862dcd07e6137e9854 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QListView: Correctly set State_Enabled flag in paintEventSebastian Beckmann2025-11-231-1/+1
| | | | | | | | | | This condition got flipped around in a cleanup. As a result, the enabled state would no longer be set. Amends d98fe19e3c502385052df8cdd27ad0eb038a05c6. Change-Id: I7be7242fcdb99cea9a3f940244a0bb84d6291e64 Reviewed-by: Volker Hilsheimer <[email protected]>
* QTableView: correct selection with moved columns/rows and spansChristian Ehrlicher2025-11-201-19/+22
| | | | | | | | | | | | When a column or row is moved and there are spans, the calculation of the correct row was not correct for the 'moved to' column/row because there was a mixup of visual and logical columns. Pick-to: 6.10 6.8 Fixes: QTBUG-138513 Change-Id: Ia3d1aa2c5376cb25ea56dc55b6a57a88edbfec30 Reviewed-by: David Faure <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* QTableView: misc optimization of setSelection()Christian Ehrlicher2025-11-191-4/+8
| | | | | | | | | | | QTableView::setSelection() is very often only called for one index (e.g. due to a mouse click) - therefor topLeft and bottomRight is the same. Avoid the calculation of the bottomRect index in such cases. Pick-to: 6.10 6.8 Task-number: QTBUG-138513 Change-Id: I2edba6943d554919d4873c1918e08b99d28112f3 Reviewed-by: Volker Hilsheimer <[email protected]>
* QListView: misc cleanup for QListView::paintEvent()Christian Ehrlicher2025-11-191-22/+11
| | | | | | | Use range-based for-loop, use QFlags::setFlag() instead bit operators. Change-Id: I3391829427f7e64d6295ee007fd07813c09b1453 Reviewed-by: Volker Hilsheimer <[email protected]>
* QWidgets: deprecate QStyle::State_EditingChristian Ehrlicher2025-11-192-12/+1
| | | | | | | | | | | This enum was only used in QListView and even there it was not set (when an item was editor the editor had the focus, not the view so it could never be set). Fixes: QTBUG-69351 Fixes: QTBUG-68947 Change-Id: If8423bcc1595667ca6908820512024d9947abba0 Reviewed-by: Volker Hilsheimer <[email protected]>
* QAbstractItemView: Fix using declaration of update()Friedemann Kleint2025-10-231-1/+1
| | | | | | | | | | It is a QWidget method. PySide's shiboken6 code generator is a bit picky about the using declarations. Pick-to: 6.10 Fixes: PYSIDE-3219 Change-Id: Iafb2c2d8c0d66a38f6b48eef9a09f94f4fc25141 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QAbstractItemView: Make the keyboard search configurableChristian Kandeler2025-10-214-2/+34
| | | | | | | | | | | | Introduce a new property keyboardSearchFlags, so that keyboard search is no longer limited to prefix matching. [ChangeLog][QtWidgets][QAbstractItemView] The new property keyboardSearchFlags was introduced, allowing client code to do something other than a prefix search. Change-Id: Ic2408e51b15de0275c80936de66a07058ddf7132 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QAbstractItemView: Fix isPersistentEditorOpen for non-persistent editorsDheerendra Purohit2025-10-141-1/+2
| | | | | | | | | | | | | isPersistentEditorOpen() returned true if an editor widget existed for the given index, even when it was not opened as a persistent editor. Update the implementation to check both that the editor widget exists and that it is listed in the persistent editor set. Pick-to: 6.10 6.9 Fixes: QTBUG-72333 Change-Id: I380fb51a4e357b5497fb1462e4dcd40c7ead4e13 Reviewed-by: David Faure <[email protected]>
* Doc: Add alternate text for Qt Widgets imagesJerome Pasion2025-10-098-7/+9
| | | | | | | | | | Alternate text (alt text) improves the documentation experience for screen readers and for other accessibility tools. Pick-to: 6.9 6.10 Task-number: QTBUG-135124 Change-Id: Ic481c1468548d197a69c9e19703c5773226fbd39 Reviewed-by: Alexei Cazacov <[email protected]>
* QTreeView: fix calculating ViewItemPosition when first column is hiddenChristian Ehrlicher2025-10-051-7/+10
| | | | | | | | | | When there are only two columns and the first one is hidden, the calculation for ViewItemPosition was wrong. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-140494 Change-Id: I2d96f0ef1b40608cf8a3705891877464e93c6857 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Use angle bracket include style in public headersTor Arne Vestbø2025-09-181-1/+2
| | | | | | | | | As a drive-by, reorder and regroup changed includes to separate includes from different modules from each other. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I3bcca2a75ada7b6d99ef763e0ce8cfbd0750f004 Reviewed-by: Marc Mutz <[email protected]>
* Assess security level for files under qtbase/src/widgets/itemviewsPiotr Wiercinski2025-09-1850-0/+50
| | | | | | | | | | | Assign the default level to all files but qheaderview.cpp which parses input in read(). QUIP: 23 Fixes: QTBUG-135739 Pick-to: 6.10 6.9 6.8 Change-Id: Idf295f0af63b418793a67d43c1c1d6e39dc92d37 Reviewed-by: Volker Hilsheimer <[email protected]>
* doc: Fix typo in QTableView::wordWrapKai Uwe Broulik2025-08-291-1/+1
| | | | | | | | even of -> even if Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I2d7e9f8975374c88cea0673d3689c33e92950386 Reviewed-by: Volker Hilsheimer <[email protected]>
* QStyledItemDelegate: remove unnecessary includeGiuseppe D'Angelo2025-08-091-3/+0
| | | | | | | | 7e362f76a6a6b0eb0cad2d2426063524f41fc16c removed the last usage of QTableView from the code; drop the include. Change-Id: I3352c8854b81fef2b0038af53fbd2437f69d0d21 Reviewed-by: Volker Hilsheimer <[email protected]>
* Add previewColumnVisible property in QColumnViewXavier BESSON2025-07-293-15/+62
| | | | | | | | Make it possible to have a QColumnView without a preview widget. Fixes: QTBUG-1826 Change-Id: Id169540224150a2fe804f61f90ee9bf2aabeb9ff Reviewed-by: Axel Spoerl <[email protected]>
* Fix QListWidget build without drag-and-dropIvan Solovev2025-07-281-0/+2
| | | | | | | | | | | | We need to guard the Q_PROPERTY as well, otherwise moc will try to generate the code to use the getter and the setter. Amends ef7e5ea616a3f04ff0ba5f6fe34487a332152b01, which amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3. Pick-to: 6.10 Change-Id: I2e1e76cc14537b9b5d43260bbe4807a0f468b682 Reviewed-by: Volker Hilsheimer <[email protected]>
* Properly guard supportedDragActions in QTreeWidget and QTableWidgetIvan Solovev2025-07-264-0/+16
| | | | | | | | | | | | | | | | | | | | | Guard Q_PROPERTY, the declarations and the definitions of the getters and the setters with QT_CONFIG(draganddrop). Both widgets use underlying models (QTreeModel and QTableModel) that are based on QAbstractItemModel. The latter has a virtual method supportedDragActions(), which is not guarded by any config. As a result, this patch also has to provide fallback implementations for the overrides of this method. The implementations simply return Qt::IgnoreAction. Amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3 and 760579204e314cc4e0fdc7b8b8bd8d8706095a38. Also provide fallback implementations for QTreeModel Pick-to: 6.10 Change-Id: I9ff2c7112d1b3b7ad23347a03c5e29cf0d115935 Reviewed-by: Volker Hilsheimer <[email protected]>
* Fix corner case not switching to normal QHeaderivew memory modelThorbjørn Martsum / Mjølner Informatics2025-07-061-3/+1
| | | | | | | | | | | The useGlobalMode and globalResizeMode testing was not correct. We just want to look at the input resize parameter and switch to normal memory mode if that can cause a section resize. Fixes: QTBUG-138130 Pick-to: 6.9 6.10 Change-Id: If0829e54ec82b68a138a64a770df95ea85ac2e2b Reviewed-by: Christian Ehrlicher <[email protected]>
* Avoid using QPainter::brushOrigin() to save and restore the originChristian Ehrlicher2025-06-213-8/+10
| | | | | | | | | | | Avoid QPainter::brushOrigin() since it returns a QPoint instead QPointF so it might loose precision. Use QPainterStateGuard instead to make sure the correct QPainter state is restored later on. Pick-to: 6.10 Task-number: QTBUG-137885 Change-Id: I3f49c72c0425e22ffb1246b42d926e704dc9d8dd Reviewed-by: Eirik Aavitsland <[email protected]>
* ItemView widgets: make supportedDragActions a propertyVolker Hilsheimer2025-06-206-34/+19
| | | | | | | | | | | | This makes the property accessible to the Widget designer. Document it as a property. Amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3 Pick-to: 6.10 Task-number: QTBUG-137478 Change-Id: I55e95e541c5c1ae162eb7c2ae78c969f9d23ea2a Reviewed-by: Christian Ehrlicher <[email protected]>
* QAbstractItemView: fix autoscroll immediately stoppingMiika Pernu2025-06-202-6/+12
| | | | | | | | | | | | | | | | | | | Adjust the draggedPosition calculation to changes in QAbstractItemViewPrivate::offset(). The draggedPosition was previously first calculated by adding mouse pos and offset() value, and mouse pos was later extracted by subtracting the offset() from draggedPosition. However, the offset() value no longer remains a constant between the addition and subtraction, which makes it impossible to get the old mouse position. Store the offset and mouse position separately to make the calculations deterministic across events. Fixes: QTBUG-130978 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I5c601ff7ca40c9d8fb7ad949ff15520d199f5c1f Reviewed-by: Volker Hilsheimer <[email protected]>
* QDataStream: use new operator bool() in the codeTatiana Borisova2025-06-171-10/+5
| | | | | | | | | | | - After adding the QDataStream::operator bool(), it is not required to check the QDataStream::status(). It is enough to use the reference of stream in the statement, which returns true if stream status is OK. New operator usage makes code more convenient. Pick-to: 6.10 Change-Id: Ie92658b613484a1e444ab442f8f821458c511079 Reviewed-by: Marc Mutz <[email protected]>
* Fix -no-feature-draganddrop buildsVolker Hilsheimer2025-06-122-0/+4
| | | | | | | | | | | | | Amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3 which added the APIs, and ef7e5ea616a3f04ff0ba5f6fe34487a332152b01 which only added the guard for QListWidget. Address header review comment. Pick-to: 6.10 Task-number: QTBUG-137478 Change-Id: I405190190f4d64dd810d7d35e9ef616ab0147b19 Reviewed-by: David Faure <[email protected]>
* Widgets: Set viewItemPosition style option for QTableView and QListViewOlivier De Cannière2025-06-123-0/+23
| | | | | | | | | | | | | | | | Before this patch, we did not set the view item positions in the views. This was fine as they were ignored until b780eaf6a063a7efe03417cf6b7008a188e222a4 added a condition to early exit on invalid positions. This then broke all qss background styling using QStyleOptionViewItem::ViewItemPosition as they were always invalid. Set the position when trying to draw a cell of the view before reaching the code handling the qss rules for backgrounds. Fixes: QTBUG-137346 Pick-to: 6.10 6.9 6.8 Change-Id: I83d7a3ea7b9bab98889791bb807988a74e355b93 Reviewed-by: Santhosh Kumar <[email protected]>
* QTreeView: Delay reset of accessibility when laying out items lazilyVolker Hilsheimer2025-06-051-1/+6
| | | | | | | | | | | | | | | | | | | QTreeViewPrivate::doItemsLayout might get triggered when accessibility elements query properties of items, such as the state or geometry. If we reset the model immediately, then the items that are currently querying might get destroyed, resulting in crashes. Instead, use a queued invocation to reset the model only once control returned to the event queue. This leaves current elements intact. Amends 6a4afebc5ce8db69a6c9fb398cada31e6bad5e3c and follow-up commit a86321cb665b1af03b245b3b0fe0b57faa4a678f. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-136074 Task-number: QTBUG-133855 Change-Id: I2c6acda3b31105447393a6efcb85ddf737161fe8 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QHeaderView: remove unused include, add missing includeChristian Ehrlicher2025-06-022-2/+1
| | | | | | | | | | Remove unused include of qtableview.h in the source - this also fixes the compilation with feature_tableview = OFF. Move the missing include of qlist.h into the header. Pick-to: 6.10 6.9 Change-Id: Ie443cf6f3bf6b76dedc994bf1b8c16daebf9022d Reviewed-by: Volker Hilsheimer <[email protected]>
* Fix QHeaderView auto section resize corner caseThorbjørn Lund Martsum2025-05-131-0/+8
| | | | | | | | | | | | | | In some situations where the model is set sufficient late an auto resize would never be applied. See bug report for further details. This is solved by moving to the normal memory model when the global resize mode is changed to resizeToContents or stretch. Fixes: QTBUG-136453 Pick-to: 6.9 Change-Id: Ie0448042a7d23b059eaf7464a662f0f551d89fd9 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QHeaderView: fix logic in setOffset()Christian Ehrlicher2025-05-071-1/+1
| | | | | | | | | | | | | | Fix the logic in setOffset() which was accidentally reversed during fixing of UB during signed overflow. Amends 49fcac99deea390901000a74deea1c0c690b6ae2. Coverity-Id: 479557 Pick-to: 6.9 6.8 6.5 Fixes: QTBUG-136362 Fixes: QTBUG-136477 Change-Id: Ifc9c80346355b0a9e516effe2ff8b60b1966d67a Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
* QHeaderView: fix more UB (signed integer overflow) in setOffset()Marc Mutz2025-04-161-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We fixed the first line of defense in 03d1e81516be9af37fa08900f9a2d88d34abc4df, but that commit didn't rule out ndelta == INT_MIN, in which case -ndelta overflows a few lines below. Coverity pointed this out. Add a check that exposes this problem to ubsan, and avoid the overflow by using qMulOverflow<-1>()¹ and not scrolling when it overflows, but emitting a qWarning(). ¹ There's no qNegateOverflow()... When state == QHeaderViewPrivate::ResizeSection, we assume that everything happens on the actual screen, which has physical limits to the setOffset() argument, and therefore these arithmetic operations don't need to be protected. I fully expect that this will just be a rat's tail, one we can only hope to control by using Peppe's safe integers everywhere, at which point we've probably blown our executable code size out of any proportions. So leave it at this, for the time being. Amends 03d1e81516be9af37fa08900f9a2d88d34abc4df. Coverity-Id: 479557 Pick-to: 6.9 6.8 6.5 Change-Id: I2e31fc9be21e7d59563b67f3cd26c29dcea61b55 Reviewed-by: Axel Spoerl <[email protected]>
* Fix -no-feature-draganddrop buildsOliver Eftevaag2025-04-103-5/+8
| | | | | | | | Building tests will still cause build issues, but at least this lets you build without them. Change-Id: Iea5c93bf31593a5ee0f66c877da4d5a7ba9b6dc3 Reviewed-by: Juha Vuolle <[email protected]>
* QAbstractItemView: disconnect from the correct delegateMarc Mutz2025-04-021-1/+1
| | | | | | | | | | | | | | | | Purely from a symmetry argument, we should be disconnecting the old item delegate, not the new one. I didn't find a case where this actually causes test failures, nor did I take the time to implement a test where it does. Amends a126d3627cc347500c1a6bd82027efa6d451ccbd. That patch landed in Qt 6.7, but that branch is "closed" at this point in time, so not picking there now. Pick-to: 6.9 6.8 Change-Id: I06b704e699616d61c65ad676ffe45dfbd9f8a870 Reviewed-by: Volker Hilsheimer <[email protected]>
* QHeaderView: port from qt_saturate to q26::saturate_castMarc Mutz2025-03-281-2/+3
| | | | | | | | | | | The commit that introduced the qt_saturate call did use that old function in order to stay compatible with Qt 6.5, which never received q26::saturate_cast. This patch ports to the new function in branches that have it. Pick-to: 6.9 6.8 Change-Id: Iadd9d2c92ea1e37095b71b1647db61dec2b8333a Reviewed-by: Axel Spoerl <[email protected]>
* tst_QHeaderView: fix UB (invalid downcast) in testStylePosition()Marc Mutz2025-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The view that's being created in init() is not a protected_QHeaderView, but only a "normal" QHeaderView, so casting it to protected_QHeaderView is not valid. Says UBSan: tst_qheaderview.cpp:3338:37: runtime error: downcast of address 0x604000087050 which does not point to an object of type 'protected_QHeaderView' 0x604000087050: note: object is of type 'QHeaderView' 00 00 00 00 d8 d2 e6 0b b2 7f 00 00 80 88 00 00 c0 61 00 00 08 d6 e6 0b b2 7f 00 00 00 00 be be ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QHeaderView' Fix using the usual trick: forward-declare tst_QHeaderView and make QHeaderView itself befriend it directly. Amends bff78163f6dc83d833b2097a51453523cfa7b00b. tst_QHeaderView is now asan/ubsan-clean, except for some signed overflows in calculateAndCheck(), filed QTBUG-135201 to track it. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I718695bef26e72f442bd677c6bad05bab561163f Reviewed-by: Axel Spoerl <[email protected]> Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
* QHeaderView: fix UB (signed overflow) in setOffset()Marc Mutz2025-03-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have no idea why setOffset() would accept all int values, but tst_QHeaderView::getSetCheck() checks the function with both INT_MIN and INT_MAX (albeit without having show()n the object it so tortures), so try to make it work(-ish). 0 - INT_MIN overflows, of course, so use saturation math to calculate the result. This might not scroll to pixel precision, but it couldn't have done so before, either (no int value can possibly represent the mathematical value, otherwise it wouldn't have overflown). But at least we now don't run into UB anymore. Said UBSan: qheaderview.cpp:418:9: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int' #0 0x7f183ffa4a5f in QHeaderView::setOffset(int) qheaderview.cpp:418 #1 0x55f5ca56a5fe in tst_QHeaderView::getSetCheck() tst_qheaderview.cpp:437 While q26::saturate_cast was only picked to 6.8, its predecessor, qt_saturate(), was picked to 6.2, so use that, for now, and port to q26::saturate_cast in a follow-up. As a drive-by, mark ndelta const. Amends the start of the public history. Pick-to: 6.9 6.8 6.5 Change-Id: I118c917ccd588c0b6d407090609f4d17075bbab6 Reviewed-by: Axel Spoerl <[email protected]>
* QAbstractItemView: fix UB (invalid downcast) in Private::shouldAutoScroll()Marc Mutz2025-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | Says UBSan: qabstractitemview.cpp:4442:18: runtime error: downcast of address 0x604000026790 which does not point to an object of type 'QAbstractItemView' 0x604000026790: note: object is of type 'QWidget' 00 00 00 00 08 b1 cf 9f 33 7f 00 00 80 24 00 00 60 61 00 00 b8 b2 cf 9f 33 7f 00 00 00 00 be be ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QWidget' I did not reserch what the problem was that the code comment referred to, but we now have QWidgetPrivate::get() (incl. in 5.15), so use that. Amends the start of the public history. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: If658d21694f6806eafdf678b8d5ff7ed62e93513 Reviewed-by: Friedemann Kleint <[email protected]>
* Doc: remove stray 's'Volker Hilsheimer2025-03-231-1/+1
| | | | | | | | Amends 4409edc14b8a593640c1eb22560a6ba249336163. Pick-to: 6.9 6.8 Change-Id: I1502e0d63a845c5deb476af1c37cb89a6cc43c6c Reviewed-by: Christian Ehrlicher <[email protected]>
* Style: pass widget to styleHint() where appropriateChristian Ehrlicher2025-03-021-1/+1
| | | | | | | | | | QStyle::styleHint() take the QWidget as optional third parameter. Add this to calls to styleHint() where appropriate. Task-number: QTBUG-2501 Pick-to: 6.9 6.8 Change-Id: I62aa251f7dd9d78178ea8aefc1e2882d3ac040be Reviewed-by: Volker Hilsheimer <[email protected]>
* QAbstractItemDelegate: add handleEditorEvent()David Faure2025-02-285-59/+54
| | | | | | | | | | | | | | | | | QItemDelegate and QStyledItemDelegate had this exact implementation already, the actual code being in QAbstractItemDelegatePrivate. If someone writes their own delegate by deriving from QAbstractItemDelegate, they had no way to call the default event filter code (to get Enter to commit, Esc to abort editing etc.). [ChangeLog][QtWidgets][QAbstractItemDelegate] The base class now provides a handleEditorEvent() method, which provides the same event handling as in QItemDelegate and QStyledItemDelegate, including Tab, Enter, Esc keys and focus out handling. Change-Id: I1b560d8a1b348e3b3bb5cfc3162f9b265b706684 Reviewed-by: Volker Hilsheimer <[email protected]>
* Document the default value for QAbstractItemView::editTriggersDavid Faure2025-02-231-0/+6
| | | | | | | Pick-to: 6.9 Change-Id: I4456dcfcecf739299533167867208e1943bc4a26 Reviewed-by: Christian Ehrlicher <[email protected]> Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
* ItemWidgets: add supportedDragActions()/setSupportedDragActions()Christian Ehrlicher2025-02-129-7/+113
| | | | | | | | | | | In Qt6 the deprecated function QAIM::setSupportedDragActions() was removed so the itemwidgets had no possibility to specify the drag actions anymore. Fix this by adding it to the itemwidgets themselves. Done-with: David Faure <[email protected]> Fixes: QTBUG-87465 Change-Id: Ib10fa30c5b2c9e8e5cd3f0e1c2664f7a12fb249b Reviewed-by: Volker Hilsheimer <[email protected]>
* QListWidget/QTableWidget: extract method view()David Faure2025-02-124-21/+24
| | | | | Change-Id: Ie6505e2aea2c3a7a10f91be19dfc66197bf97556 Reviewed-by: Volker Hilsheimer <[email protected]>
* Widgets: add enum values to QStyleOptionViewItem::ViewItemFeatureChristian Ehrlicher2025-01-201-4/+9
| | | | | | | | | | | | | | Add two new enum values: IsDecoratedRootColumn: notifies the style that the current cell also contains place for the tree column branch indicator so it can e.g. properly draw rounded edges in a cell or complete row. IsDecorationForRootColumn: the item contains the information to draw the tree column branch indicator. Pick-to: 6.9 Task-number: QTBUG-131585 Change-Id: Iee2823fe3a227630f926d0448095a10fad2b0ba7 Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: fix linking issue in QHeaderView; reflowVolker Hilsheimer2025-01-181-10/+10
| | | | | | | | | | | | | | QHeaderView has no resizeMode property, only a ResizeMode enum type that is then used in the sectionResizeMode API. Fix that reference, reflow the paragraph, and apply some light editing. Amends 9e3a96189d9db8a458e65cd5078509afe7a160db Pick-to: 6.9 Change-Id: I240c3f64fd45c96f4d3ba95c2086a638468e137f Reviewed-by: Christian Ehrlicher <[email protected]> Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
* Remove unused qdebug.h include from private headersAhmad Samir2025-01-162-2/+0
| | | | | | Pick-to: 6.9 Change-Id: I03c951d03ab2410298878d0689c0d50bdd4eedf2 Reviewed-by: Mårten Nordheim <[email protected]>
* QTreeView: fix Private::intersectedRect()Christian Ehrlicher2025-01-091-3/+5
| | | | | | | | | | | | | | | Don't try to update the left and right boundaries when no valid idxRect was found. Also fix the early exit check - we can exit when the idxRect is completely below *or* completely above the current viewport. This amends 2f9c72028d2481f587f378a256654d0a362e3d44. Pick-to: 6.9 6.8 Fixes: QTBUG-132670 Task-number: QTBUG-124173 Change-Id: I51f9e12c66268318e597facfbe4df74367d1089a Reviewed-by: David Faure <[email protected]>
* Replace all QPair/qMakePair with std::pair in qtbase/widgetsIsak Fyksen2025-01-098-45/+44
| | | | | | | | | | As a drive-by replace QList::append and operator<< with emplace_back, to avoid repeating value_type. Task-number: QTBUG-115841 Pick-to: 6.9 6.8 Change-Id: I6fb790f959b41b0feb49e3a0f0b6b3631e24a232 Reviewed-by: Marc Mutz <[email protected]>
* Widgets: pass dpr to QIcon::pixmap()Christian Ehrlicher2024-12-291-1/+3
| | | | | | | | | Change the remaining calls to QIcon::pixmap() to pass a valid devicePixelRatio parameter. Pick-to: 6.9 Change-Id: I0e71e20c8109e296446e9e13cddba31d53c05df9 Reviewed-by: Volker Hilsheimer <[email protected]>