aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols/controls
Commit message (Collapse)AuthorAgeFilesLines
* Properly blacklist Switch mouse/touch tests on macOS 26Tor Arne Vestbø14 days1-2/+2
| | | | | | | | Amends 023cad2c2c815c3237fdd4636213084db63fdcb1. Task-number: QTBUG-142189 Change-Id: I4aac13fb790578ea69fb856e41ffc265f2330a01 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Qt Quick Controls: add DoubleSpinBoxXavier BESSON2025-12-041-0/+869
| | | | | | | | [ChangeLog][Controls] Added DoubleSpinBox. Fixes: QTBUG-67349 Change-Id: Icb2f02162825daf74778de725f80af63874a5d16 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix CalendarModel month count calculationJoni Poikelin2025-11-261-0/+9
| | | | | | | | | | CalendarModel used previously set from and to values to calculate the range and thus the count wasn't ever up to date. Fixes: QTBUG-141883 Pick-to: 6.10 6.8 Change-Id: Id3ef60810d2e8ebfcc060307e6d17cfca379cd78 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add iOS style for SearchFieldDilek Akcay2025-11-261-4/+26
| | | | | | | Task-number: QTBUG-137318 Pick-to: 6.10 Change-Id: Iead7b9ad0bf22c96d94ab70795fed854f613f6d7 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Blacklist Switch mouse/touch tests on macOS 26Tor Arne Vestbø2025-11-251-0/+18
| | | | | | Task-number: QTBUG-142189 Change-Id: I863b5773f89528d3582dd83c84cff78d159990c4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Dialog(ButtonBox): Prioritize popupItem subFocusItem over buttonBoxOliver Eftevaag2025-11-201-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a followup to e323e508b61ce0a2615c9c8e8fbf897e27965173. In cases where a Dialog has an item with explicit focus, e.g: ``` Dialog { Button { focus: true text: "Foo" } footer: DialogButtonBox { standardButtons: DialogButtonBox.Ok } } ``` Then the "Foo" button should get focus, since it's explicitly set in QML. 4d1753b95f0343a68f80a1b482b8ab9a0397fecb changed this behavior to instead always give the buttonbox focus. If focus isn't explicitly set elsewhere, it should be fine to give it to the buttonbox. However, doing so unconditionally would be a significant behavior change that would break lots of user projects. Add a precondition to verify that the popupItem doesn't have a subFocusItem, before considering whether or not to give focus to the buttonbox. As a drive-by, also just call setFocus() instead of forceActiveFocus(). Both functions work for our purposes, so might as well use the less extreme option. Amends e323e508b61ce0a2615c9c8e8fbf897e27965173 Change-Id: Iea72f162669159082386966a1d9419c64abb7302 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Dialog: Don't give buttonBox focus when empty or buttons are disabledOliver Eftevaag2025-11-181-0/+34
| | | | | | | | | | | | | | | | | Focus behavior was changed in 4d1753b95f0343a68f80a1b482b8ab9a0397fecb to give the buttonBox focus when a dialog is opened. This will fundamentally conflict with user projects that manually set the focus property. Further discussion will be needed to arrive on a good solution for when the focus property is manually set. For now, we can at least make sure that the new focus behavior is limited to cases where the buttonBox actually contains buttons (aka, not empty), with at least one of them being enabled. Fixes: QTBUG-141998 Change-Id: I704e6a707f5b579e5f4de7b6197abc2fc5dfdf3e Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Account for icon color being set to transparentMitch Curtis2025-11-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QQuickAbstractButtonPrivate::updateEffectiveIcon we need to resolve the icon's color so that QQuickIconLabel knows which of defaultIconColor and icon.color should win. In both QQuickAbstractButtonPrivate::updateEffectiveIcon and QQuickAction::setIcon, we need to unconditionally set the icon and be more strict about when we return early. This fixes the case where setting "transparent" as the icon color wouldn't result in the original image's colors being used, but would instead result in the style's default icon color: Button { text: "Original icon color" icon.source: "heart.svg" icon.color: "transparent" } Button { text: "Original icon color (action)" action: Action { icon.source: "heart.svg" icon.color: "transparent" } } Task-number: QTBUG-87459 Change-Id: Ic490e3b37a8174b8c034b84a1ad551a78088e44d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QQuickIconLabel action icon color being overridden by style defaultMitch Curtis2025-11-1812-0/+528
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Styles need a way to set the default icon color for controls. Until now, that was done like this: icon.color: "tomato" contentItem: IconLabel { icon: control.icon } This breaks the use case of e.g. an Action that sets its own icon.color, because the icon property of the control always takes precedence (see 146bc9517c56feda4eba34282d3cc53bd47b6267). This patch adds a defaultIconColor property to IconLabel, which allows styles to specify a color without overriding any potential action's icon: contentItem: IconLabel { icon: control.icon defaultIconColor: "tomato } If icon.color was explicitly set, it is used instead. This does mean that overriding the contentItem will result in the icon color being lost, but that is already the case for style customizations in general. All controls that set icon.color and using IconLabel to display their icon are affected and are therefore adapted: Button, CheckDelegate, DelayButton, ItemDelegate, MenuBarItem, MenuItem, RadioDelegate, RoundButton, SwipeDelegate, SwitchDelegate, TabButton, ToolButton. Add FlowPane to the shared folder of the baseline test and use it in the tests that we touch. This fixes two issues: - Using Pane as the background fixes text being invisible for some styles. - Using Flow provides the most space-efficient layouting of items now that we have more than would fit in the old layout. Task-number: QTBUG-87459 Change-Id: I455ce7202a46b7cfa7545650574e48ad72796675 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* DialogButtonBox: add properties for setting a default buttonOliver Eftevaag2025-11-142-0/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt Quick Controls lacked the ability for setting a default button in a dialog button box. This is something that we support in QtWidgets, and it makes sense to allow dialogs with a DialogButtonBox set as the footer to decide if a particular button should be default, and have focus when the dialog is opened. With this patch, we're introducing two different ways for selecting a default button. The first is the usage of the DialogButtonBox::defaultButton property, which works like this: ``` DialogButtonBox { defaultButton: Button { text: qsTr("Ok") } Button { text: qsTr("Cancel") } } ``` In the snippet above, the Button that is set as default should both be highlighted, and be the sub focus item of the DialogButtonBox. However, since the standardButtons property can be used to dynamically create buttons on the fly, we also needed an alternative way for picking a default button. In cases where standardButtons is being used to create buttons in the DialogButtonBox, the new defaultStandardButton property can be used: ``` DialogButtonBox { standardButtons: DialogButtonBox.Yes | DialogButtonBox.No defaultStandardButton: DialogButtonBox.Yes } ``` Something worth noting, is that the DialogButtonBox's contentItem is typically a ListView. ListView have the ItemIsFocusScope flag set, meaning that we need to give focus to both the ListView, and the default Button. In addition, the FontDialog and ColorDialog will now make the Ok button default, and give it focus when the dialogs are opened. The FileDialog and FolderDialog will continue to give the ListView focus, since that's IMO more user friendly. The MessageDialog will need new API to take full advantage of this new feature, which will be introduced later. [ChangeLog][DialogButtonBox] The DialogButtonBox now has two new properties, defaultButton and defaultStandardButton. When one of these properties are being used, a button set as default will be highlighted and receive activeFocus whenever the DialogButtonBox gets focus. If a DialogButtonBox is assigned as a Dialog's footer, it will also get focus when the Dialog is opened. This means that a Dialog with a DialogButtonBox as its footer, will give focus to a default button when opened. If both of these properties are unset, the first button with the AcceptRole will get focus, but it will not be highlighted. Fixes: QTBUG-58246 Fixes: QTBUG-139352 Change-Id: Ic083410184dd63e0e790694f782a7a98c1dc8b6e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* ScrollBar: ensure cleanup functions are called regardless of flickableMitch Curtis2025-11-071-0/+49
| | | | | | | | | | | | Otherwise the old scroll bar can be visible in certain situations. Extends 908aa77d16e00f2bccc0ddae0f8b61955c56a6a1. Amends bb2a6c61777e2500fa00710c8bb752fa7b99f079. Fixes: QTBUG-141229 Pick-to: 6.8 6.10 Change-Id: I5c8a02f90e68c42d21078b945cc1ea0c84066635 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* tst_slider.qml: add test_integerSteppingMitch Curtis2025-11-061-0/+44
| | | | | | | | | | Verify that using integer values for from, to and stepSize results in integer values. Task-number: QTBUG-141090 Pick-to: 6.8 6.10 Change-Id: Ideadd88bae45d3d9cfff9a4efd077a35368029e2 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* RangeSlider: keep values integer if everything is integerMitch Curtis2025-11-061-0/+48
| | | | | | | | | | | | | | | Based on 42687caf7bc7496b838995f3fa68194ca8323da3. If a user uses integer values for stepSize, from and to, they most likely want the actual values of the handles to be integers, too. Detect this condition, and store it in a new boolean member. If the condition is met, we round the value in valueAt() (which, due to floating point math, might not be an exact integer). Fixes: QTBUG-141090 Pick-to: 6.8 6.10 Change-Id: If9507534db8fceb113e7426b5d46c6a023919d66 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Dial::test_integerStepping: ensure we actually test changes in valueMitch Curtis2025-10-301-1/+3
| | | | | | | | | | By not comparing the Dial's value against 1 eight times. Amends 42687caf7bc7496b838995f3fa68194ca8323da3. Pick-to: 6.8 6.10 Change-Id: I67bc64c517d06a176ba4b2189f5755f954915ae1 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* ScrollBar::test_flashing: Use non-interactive scrollbar to stabilize testTor Arne Vestbø2025-10-131-1/+3
| | | | | | | | | | | | | | In rare cases the mouse was lingering over the exact position of the scroll bar as a result of other tests moving the mouse, which would make the scrollbar never leave the active state, and hence keep reporting a non-0 opacity. We're programmatically activating the scroll bar via increment(), so we don't need the scroll bar to be interactive to do the test. Pick-to: 6.10 6.8 6.5 Change-Id: Id75b22d51277c3515fd4f448360bd576b45d69d8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* ScrollView: use padding if no rightPadding or bottomPadding is setMorteza Jamshidi2025-10-061-0/+23
| | | | | | | | | | | | | Because rightPadding and bottomPadding properties are set in the windows and macos ScrollView style implementation if the user try to set the padding property there will be no effect. So with this change we make sure that the padding property is used if rightPadding or bottomPadding aren't explicitly set by the user. Fixes: QTBUG-123631 Change-Id: I5078cec1774cef7b99e0735022ddb4ce84cd08df Pick-to: 6.10 6.8 6.7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SearchField: Keep currentIndex at -1 until user explicitly selectsDilek Akcay2025-10-021-5/+38
| | | | | | | | | | | | | | | | | | Until now, currentIndex was assigned to different values on different actions, like to 0 on model changes, or to the index of the highlighted index according to the arrow key actions. These caused unexpected behavior so the following changes were made: - Removed setting to 0 when model is set in the beginning. - Reset currentIndex to -1 on any user edit(typing/deleting) - Disabled arrow key interactions on currentIndex Now currentIndex only changes whether the user clicks an item in the popup or presses Enter on a highlighted item. Pick-to: 6.10 Change-Id: Ib1a991c87a767fe436b4b025a26834871401ca4b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Android: enable qt quick tests after crash fixAssam Boudjelthia2025-09-056-0/+269
| | | | | | | | | | | | | | | | | | After the deadlock fix in QTBUG-139211, these can be enabled again since they were crashing for the same reason. The enables tst_controls and tst_focus. At the same time blacklist few test cases that still fail, doing this is still beneficial because get more test coverage anyways from re-enabling the skipped tests. Fixes: QTBUG-100259 Fixes: QTBUG-100258 Task-number: QTBUG-139415 Pick-to: 6.10 Change-Id: Id5b0a0e0870dd89bf4bc376b1b705ebeaa1b6ea0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SearchField: Add highlightedIndex and fix ambiguous currentIndex behaviourDilek Akcay2025-07-181-3/+30
| | | | | | | | | | The new highlightedIndex property enables control over the highlighted item in the SearchField. This property follows the same logic and behaviour as the Combobox's highlighted API. Fixes: QTBUG-137862 Pick-to: 6.10 Change-Id: Ifb2a4fd52f126c6ea6b7e36b2b47e4b0f0115428 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix heap-use-after-free in Container when using ListView transitionsMitch Curtis2025-07-041-0/+74
| | | | | | | | | | | | | | | | | | | | | Container's removeItem function removes and deletes items immediately. This has caused issues in the past, like QTBUG-46798. QTBUG-133256 is similar to that, except it also involves transitions. This patch fixes the crash by listening for the destruction of items created within an ObjectModel and removing them so that views don't have dangling pointers to them. Add removeAndDestroyObjectModelItem to tst_qquicklistview2, which is similar to the test added for 1e3924d8f585dd9099eb74ffbc17950c693d14da but adds more thorough checks and transitions. Fixes: QTBUG-133256 Task-number: QTBUG-46798 Pick-to: 6.5 6.8 6.9 6.10 Change-Id: I9777713edfc6f82a4e9edefe2fd6c9831f03c261 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* MonthGrid: fix dates being incorrect for certain timezonesMitch Curtis2025-06-301-5/+81
| | | | | | | | | | | | | | | | | | | | | | When a QDate is passed to QML, it becomes to a JavaScript Date. As Dates are stored in local time, the QDates we were passing to QML had the potential to be one day off in certain timezones. For example: 00:00 UTC converted to UTC-8 is 20:00 the day before. Fix this by storing and providing dates as QDateTime so that we can give it a time of day that can't possibly result in a different day when converted to local time. It's fine to change the C++ API since it's private, and nothing will change for the type that users see, since they always get a Date. Add a SystemEnvironment singleton to QQuickControlsTestUtils (Qt.test.controls) to allow reading and writing environment variables from QML. Fixes: QTBUG-72208 Pick-to: 6.8 6.9 6.10 Change-Id: Idb4ab26568d8f1eddd5ab4cebe691e38173d02a9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't delete component delegatesMitch Curtis2025-06-258-0/+201
| | | | | | | | | | | | | | | | | This makes it impossible to e.g. swap between two delegates. Similar to 80f1186338bcf8c7d692b4fadfc46531c002c6b0 except for QQmlComponents. [ChangeLog][Controls][Important Behavior Changes] Old QQmlComponent delegates (not the item instances created by them) are no longer destroyed when a new one is set, as they are technically owned by user code. They will still eventually be garbage-collected as expected, assuming there are no references to them. Fixes: QTBUG-137777 Change-Id: Icbe6971727d684a266b12a0b41474397e536bfdc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Allow SelectionRectangle dragging if TableView doesn't flick via mouseShawn Rutledge2025-06-201-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting `interactive: false` on TableView is drastic (except perhaps in some mode that the user can enter somehow), but setting `acceptedButtons: Qt.NoButton` should be the default, to have flicking on touchscreens but avoid dragging by mouse. This is possible since cbc694491b8431fd3dcf82c3d17a17a06cbccebc (but the default was not changed, for fear of surprising users with a behavior change). So now QQuickSelectionRectanglePrivate::updateSelectionMode() allows dragging in either case, via all devices if the TableView is not interactive, or mouse-only if the flicking is touch-only. Long-press has so far been allowed to select only in the case when dragging cannot select. But if the TableView has interactive: true, then you can flick it on a touchscreen, regardless of how acceptedButtons is set, even though we may expect the user to select dragging the mouse. So now if `selectionMode: Auto` is declared, and touch flicking works, we allow the long-press to select, because otherwise there would not be a way to make a selection on a touchscreen. We should not consider `interactive: false` to be normal (unless the developer finds a need to disable scrolling in some unique modal use case that can be exited somehow). `acceptedButtons: Qt.LeftButton` is not a very useful setting either (even though it's still the default). The snippet is improved to illustrate, along with some drive-by's. Docs explain the behavior in more detail. Test coverage is added in the manual test and the autotest. Pick-to: 6.9 6.10 Task-number: QTBUG-97111 Task-number: QTBUG-132268 Change-Id: I912dbc7bf8de536794b5bdcc1269bf2860645de9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickSlider: Normalize near-zero values when setting slider valueDoris Verria2025-06-051-0/+42
| | | | | | | | | | | | Normalize near-zero values to 0.0 first before doing a fuzzy compare, as the latter may give false when comparing near-zero values to 0 eg: 0.0 and 1e-15. Fixes: QTBUG-134635 Pick-to: 6.8 6.9 6.10 Done-with: Jasuhan-Yoganathan <yasuhan.yoganathan@qt.io> Change-Id: I81474760dded319d41280c3ef8dbff340ae649e3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Enable expanded client area by default in iOS styleTor Arne Vestbø2025-06-021-2/+3
| | | | | | | | | [ChangeLog][iOS] The iOS style now enables expanded client areas by default. To override this, set the ApplicationWindow's flags explicitly to e.g. Qt.Window. Change-Id: I333e36d2959b2ff8029cc685ec2b5610d11e6069 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Introduce SearchField for Quick ControlsDilek Akcay2025-06-011-0/+230
| | | | | | | | | Add a new QQuickSearchField as part of the Qt Quick Controls to simplify implementing search functionality for lists of items. Task-number: QTBUG-126188 Change-Id: I634131161447616a2d66e7f301bd8a24adac2d7f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* CMake: Don't enable ASM languageJoerg Bornemann2025-05-029-9/+9
| | | | | | | | Remove the ASM language where no assembler files are used. Pick-to: 6.5 6.8 6.9 Change-Id: I3c94f798803b054a432fc2c8d6d65c665572a202 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve "could not convert argument" error messageMitch Curtis2025-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | Add the actual types involved in the attempted conversion, rather than just saying that it couldn't be done. Before: "Could not convert argument 0 at" "expression for onCompleted@qrc:/qt/qml/quick2/Main.qml:34" qrc:/qt/qml/quick2/Main.qml:34: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. After: "Could not convert argument 0 from QQmlComponent(0x5b72731bd710) to QQuickItem*" "expression for onCompleted@qrc:/qt/qml/quick2/Main.qml:34" qrc:/qt/qml/quick2/Main.qml:34: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. Pick-to: 6.8 6.9 Change-Id: Ia4144ad61332e53c662a280dd8b68dc99aa09cf8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Button: don't allow pressing if already pressedShawn Rutledge2025-03-191-4/+36
| | | | | | | | | | | | | | Pressing one Button and then another, on a touchscreen, should not cause either Button to emit pressed() twice. tst_button.qml's test_multiTouch() now counts the pressedChanged and pressed signals separately. Pick-to: 6.5 6.8 6.9 Fixes: QTBUG-122043 Change-Id: I2f353ebc29900f9cfba5e71425022473d3a32a26 Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix incorrect calculation in Tumbler::test_displacementListViewMitch Curtis2025-03-191-1/+1
| | | | | | | | | | | It was missing ".y", and so it was trying to add a point to a float. For some reason that results in a string, which becomes NaN and triggers an assertion failure after df97b6b2de6282bd6422f1e531a42475dadc980d. Pick-to: 6.5 6.8 6.9 Change-Id: If1346b66c0cdc8b4fa15cb06fc00ed168c3b8f1c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix QuickControls2 QML tests test to pass in a static buildAlexandru Croitor2025-03-139-9/+72
| | | | | | | | | | | | | | | The tst_basic test was failing when building against a static Qt build because the QML import scanner was not able to find the QML files that are outside the current source directory. Fix it by adding the test's data directory to the QT_QML_IMPORT_SCANNER_EXTRA_ROOT_PATHS property. Pick-to: 6.8 6.9 Fixes: QTBUG-131813 Change-Id: If52375708b17e249fb2998ec8f92169f267e1980 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Revert "skip() tst_controls::Imagine::Popup::test_popupOverlayCenterIn"Santhosh Kumar2025-02-031-4/+0
| | | | | | | | | | | This reverts commit 97bff2510d55a5174602e3dd2b839f46d4aaecc5. The issue been fixed in qtbase c08a92307d6d9fa9d9d9a1f301e3f2a65374e99a. Pick-to: 6.9 6.8 Task-number: QTBUG-132275 Task-number: QTBUG-132789 Change-Id: I70ee9b64a6a60040f03e320452bf613d014a2d73 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Controls: Make ComboBox currentValue property writablePierre-Yves Siret2025-01-281-0/+65
| | | | | | | | | | | | | | | | | | | | | This offers another way besides currentIndex to select the current item, enabling more "declarative" code with bindings. The current advertised way to select an index based on its value is using findValue in onCompleted. This doesn't react to backend value changes like a binding and is quite brittle depending on the model. I often use hacks like the following: `currentIndex: count, indexOfValue(backend.value)`. The solution offered here is both cleaner and more robust (it accounts for model changes too). [ChangeLog][Controls][ComboBox] It is now possible to write to the ComboBox currentValue property as way to set its current item. Fixes: QTBUG-100345 Change-Id: I5b544fc890ad937ef88cb8eca1a5c2dd3e5def98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Controls: improve ComboBox mouse testsPierre-Yves Siret2025-01-281-1/+28
| | | | | | | | | | | | | | | | | | | The ComboBox::test_mouse was too unconstrained, giving false positives. The spirit of the test is to click on the second item and asserts that it was activated. It did not check the resulting currentIndex value. The FluentWinUI3 popup enter animation is animated, this caused the test to instead click on the first item but still pass the test. The test now waits for the enter animation to finish and checks the currentIndex after mouse release. This also adds another test making sure the activated signal does get emitted when the current item is clicked in the popup. This is a preliminary work for the patch making currentValue writable. Task-number: QTBUG-100345 Change-Id: Ib75435552a65ad6e20b1f73ed8f6285fe3268b59 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* SelectionRectangle: Deactivate when the last cell is unselectedMohammadHossein Qanbari2025-01-091-0/+56
| | | | | | | | | | | | | | | | | | | | This commit introduces changes to ensure that the SelectionRectangle is properly deactivated when the last selected cell in QQuickTableView is unselected. Key changes include: - Added a virtual method `hasSelection()` to QQuickSelectable interface - Implemented `hasSelection()` for QQuickTableViewPrivate, which checks if any items are selected - Updated QQuickSelectionRectangle to utilize the new `hasSelection()` method to determine its active state The test case checks that after deselecting the last selected cell, both the SelectionRectangle and its handles are properly deactivated. Pick-to: 6.8 6.9 Change-Id: I97214bb0d91dda8a902a4725918b60209b853acf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* tst_selectionrectangle: Update tests for TableView without delegateMohammadHossein Qanbari2024-12-211-176/+459
| | | | | | | | | | | | | | | | This patch enhances the test coverage for SelectionRectangle when used with a TableView that has no delegate set. The changes add the following considerations: 1. Verify that selection doesn't activate when no delegate is set 2. Cover potential crash scenarios 3. Consider the no-delegate case The related fix patch is: 481d2e54cc41960264878fcafdff13d702729712 Pick-to: 6.8 6.9 Change-Id: I0e91491bc4a07aeb9dd9f4ae02e7137201c9bca4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* skip() tst_controls::Imagine::Popup::test_popupOverlayCenterInJan Arve Sæther2024-12-201-0/+4
| | | | | | | | | | Blacklisting doesn't work since it times out. Unblock CI until a fix can be found. Task-number: QTBUG-132275 Change-Id: Ia162ced15ccf808fdde5d941406539ee4e6f84b9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Compute implicitSize based on implicitContentSize in Popup and subclassesTor Arne Vestbø2024-12-191-0/+35
| | | | | | | | | | | | Popup uses a Pane as its popup item, so now that Pane reflects its explicitly set contentWidth/Height through implicitContentWidth/Height we can use the same expression for implicit width/height as regular controls, which hooks us into the safe area binding loop detection as well. Pick-to: 6.9 Change-Id: I3709978dae0271d7daf44fc6988f09f03df15b1f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Reflect Container.content{Width,Height} through implicitContent{Width,Height}Tor Arne Vestbø2024-12-181-0/+35
| | | | | | | | | | | | | | | | | When a Container does not have an explicit content size set, we pick up the content size from the implicit content size, so the two are in sync. However, if an explicit content size is set, we were failing to reflect this through the control's implicit content size, which means that any client of Container can not treat it as a plain Control, reading its implicit content size to do layouting. We now keep the two values in sync, even when an explicit content size has been set. Pick-to: 6.9 Change-Id: If1253a1de804d99232b6c78ec9eae88f3937efe0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Reflect Pane.content{Width,Height} through implicitContent{Width,Height}Tor Arne Vestbø2024-12-181-0/+35
| | | | | | | | | | | | | | | | | | | | | When a Pane does not have an explicit content size set, we pick up the content size from the implicit content size, so the two are in sync. However, if an explicit content size is set, we were failing to reflect this through the control's implicit content size, which means that any client of Pane can not treat it as a plain Control, reading its implicit content size to do layouting. We now keep the two values in sync, even when an explicit content size has been set. As a drive-by this also fixed a bug in QQuickPane::resetContentWidth() where we would unset hasContentHeight instead of hasContentWidth. Pick-to: 6.9 Change-Id: If24b15bef51d3841932d2bf6d645087ccca677a9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Blacklist ToolTip::test_attachedSizeBug for all stylesShawn Rutledge2024-12-168-0/+34
| | | | | | | | | It seems that it's not style-specific. Blacklist it to unblock integrations until a fix can be found. Task-number: QTBUG-101704 Change-Id: I3458e209a9bad98b72eb2ad6457b04cdce0e6c56 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SpinBox: Only call fixup on content change in live modeFabian Kosmale2024-10-311-29/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | We shouldn't call fixup on intermediate or valid results while the user is editing; at least not if the live proverty is false, as there's no need to always have the latest value available. Unconditionally calling fixup means that it is no longer possible to have a temporarily invalid input. We could check whether the state is Invalid (as opposed to Intermediate), and only call fixup then, but even that is probably unnecessary overhead. Especially given that completely invalid input (e.g. a letter when a number is expected) is still blocked anyway, as this already happens via TextInput's validator. The expectation is that a style properly shares the validator between the SpinBox and its TextInput, like Qt's own style do. The behavior stays the same as it was before when "live" is set to true. The behavior in that case is basically as if one would press Enter after every change. Amends ce85cb16160394d616bc3dc4bf2a8915ec63b036 Fixes: QTBUG-129939 Pick-to: 6.8 Change-Id: I583b472486ca3a5e8109d73a9e5c9947016aec98 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickItemView: fix crash with zero-size SwipeView that uses RepeaterMitch Curtis2024-10-251-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | When running the minimal example from the bug report, the order of events is: 1. deletables are iterated in QQuickRepeater::clear(), and deleteLater is called on the delegate item. 2. deletables are unparented. This causes Container (SwipeView) to be notified of the parent change and it removes the item. Part of this involves changing the currentIndex, since the removed item was current. 3. SwipeView's contentItem (ListView) has its currentIndex bound to the container's, so QQuickItemView::setCurrentIndex is called. 4. setCurrentIndex calls updateCurrent, which detects that the currentIndex (which is -1, because there was only one item) is out of range and so releases the item. This causes it to be added to unrequestedItems, even though it has been scheduled for deletion. This patch makes QQuickItemView detect that the item is going to be deleted and not add it to the list of deletables. Fixes: QTBUG-129622 Pick-to: 6.5 6.8 Change-Id: I999aedbdfafc61ff6d33eb6579331f470e9c1454 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Close Dialog when a DestructiveRole button is clickedDheerendra Purohit2024-10-191-0/+31
| | | | | | | | | | | | | | | Assume that a button with DialogButtonBox.DestructiveRole is added to a dialog. When that button is clicked, it only emitted the discarded() signal. Now after emitting, we call QQuickDialog::close(). [ChangeLog][Controls][Important Behavior Changes] Dialog is now closed when a button with the DestructiveRole is clicked. Currently the only button with this role is Discard. Pick-to: 6.8 Fixes: QTBUG-67168 Change-Id: I3fbee383e10709630ba48cc420924ca71153e70f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add a flickDeceleration property to TumblerTomasz Kalisiak2024-10-021-0/+107
| | | | | | | | | | | | | | | | | | Tumbler is based on PathView and ListView. They both have a flickDeceleration property. It was not possible to configure this property when using Tumbler. flickDeceleration in PathView and ListView does not have the same default value. Hence, to preserve the original behavior, the property of Tumbler changes together with the wrap property by default, unless assigned an explicit value. It is resettable. The designer file for Tumbler contains the new property as well. [ChangeLog][Controls][Tumbler] Added flickDeceleration property. Change-Id: I5f58b8659fea9bbd7bcc7381087351162b8e06c3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix find_package call for standalone build of tst_material projectAlexey Edelev2024-09-201-1/+2
| | | | | | | | | | | ShaderTools are not a component in the Qt6BuildInternals. Split find_package call to two correct. Amends cde11110f33827459baf40f4dfa5240d1d2bf5ba Pick-to: 6.5 6.7 6.8 Change-Id: I15ea3d6d8a7f89047daea55968c318cbf3a30449 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix popup windows emitting closed signal twice during exit transitionEd Cooke2024-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When a popup is closed, and the popup type is set to PopupWindow, the exit transition is called twice, resulting in closed() signals emitting twice. There is a guard in QQuickPopup::setVisible that checks whether visibility is always set to true. In the case it is an exit transition, only once the transition has completed, will the visibility be false. Therefore, the guard in QQuickPopup::setVisible that checks whether the visibility is being set to the value it already is has to consider whether an exit transition is taking place, to allow a popup to stop an exit transition and start an enter transition. What this logic does not consider, is that when destructing a popup window, QQuickPopup::setVisibility(false) may be called several times during the exit transition. To get around this, an extra check is needed such that when visiblility is false and is being set to false, return. Fixes: QTBUG-126858 Pick-to: 6.8 Change-Id: I02f9ed52900c452972d01094d8ebc0936c16d617 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Force Popup::test_resetSize to use `popupType: Popup.Item`Ed Cooke2024-09-031-0/+1
| | | | | | | | | | | | It is not possible to reset the size of a QWindow, but it is possible to reset the size of an QQuickItem. This test tests if resetting the size of a QQuickPopup is successful, therefore, it does not need to be run for popup windows. Task-number: QTBUG-126553 Pick-to: 6.8 Change-Id: I6a7aab8ae0e665d9d2074fa472a8e4ec7e114b41 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Change Popup::test_size to support popupType: Popup.WindowEd Cooke2024-08-301-2/+2
| | | | | | | | | | | | Popup::test_size updates the size of a popup in QML and then checks that the size has indeed updated. When using popupType: Popup.Window, a try compare statement should be used when checking if the size has indeed updated. Task-number: QTBUG-126553 Pick-to: 6.8 Change-Id: I13567967fcea458e3b61e0cfd154158238b398c5 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Explicitly set the popupType: Popup.Item in empty model ComboBox testEd Cooke2024-08-301-0/+1
| | | | | | | | | | | | | ComboBox::test_emptyPopupAfterModelCleared currently tests that the popup of a ComboBox is empty by checking the height is zero. This does not apply to popups with popupType set to Popup.Window as they can not have zero dimensions. Note, in the future the plan is to set a minimum height for the ComboBox popup and so this test will become obselete. Task-number: QTBUG-126553 Pick-to: 6.8 Change-Id: I34e256ec86de9c722894e21d289eddbb2bab3b1a Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>