aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material
Commit message (Collapse)AuthorAgeFilesLines
* QuickControls: Fix linkage of controls stylesUlf Hermann3 days1-0/+1
| | | | | | | | | | | | They need to link the styles they import so that the dependencies are clarified (and also they'll in fact need the linkage if we ever compile them in direct mode). Pick-to: 6.10 Task-number: QTBUG-137440 Change-Id: I6edaba4390dce4f9cc2b95586f28331192cc01ff Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix QQuickIconLabel action icon color being overridden by style defaultMitch Curtis14 days10-29/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Context menus: rename control to editorMitch Curtis2025-11-123-8/+8
| | | | | | | | | | | | | | This better reflects what it is and avoids naming conflicts with the controls themselves. Pick down to 6.9 (where QQuickContextMenu was introduced) to avoid future cherry-pick conflicts. Task-number: QTBUG-133556 Task-number: QTBUG-134903 Pick-to: 6.9 6.10 Change-Id: If0af26c5f16ee56cc909fcc66d1421109786343e Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Change PopupType of textEditingContextMenu for Popup.Item on WaylandFrederic Lefebvre2025-10-311-1/+1
| | | | | | | | | | | | | | | | Use Popup.Item popupType when test is run on Wayland. Remove the need for a transient parent on Wayland that was causing several tests of tst_QQuickTextField to consistently fail. Fix the following failing tests on Ubuntu 24.04 wayland tst_QQuickTextField::contextMenuCopy, contextMenuCut, contextMenuDelete, contextMenuPaste, contextMenySelectAll, releaseAfterPressAndHold, touchscreenDoesNotSelect. Pick-to: 6.10 Change-Id: I5a411dae63ae36361ed83055a1eb4c87de17acae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* MaterialStyle: Fix reset behavior for foreground and backgroundJarkko Koivikko2025-10-151-6/+6
| | | | | | | | | | | | | | | | | | Resetting foreground and background values did not propagate to children when the earlier value matched theme default. Stop pre-clearing m_hasX/m_customX in reset. Clearing these variables prevents propagating the values to children due to early exit conditions in the inherit functions. Clear only m_explicitX and call inherit with the parent's values. m_hasX/m_customX values are then cleared in the inherit function, if changed. This guarantees propagation to children even when the color is unchanged. Pick-to: 6.10 6.8 Change-Id: Ie4f7276d43afbfaf5b4d10ccf658f27000d640d9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* MaterialStyle: Fix early out conditions for background and foregroundMorteza Jamshidi2025-10-151-7/+6
| | | | | | | | | | | | | | | | | This change fixes setting the background or foreground explicitly to the theme default. The value did not persist. Example case for background: The default m_hasBackground is false and background color is globalBackground that is 0xFFFAFAFA, so if user sets the background color to 0xFFFAFAFA the logic skips it by doing early out and doesn't set m_hasBackground to true. Fixes: QTBUG-140068 Change-Id: I26f1182d808354f34800dc62760e5498cbd77b3b Pick-to: 6.10 6.8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* quickcontrols - material style: postpone updating qsgnodesInho Lee2025-10-131-23/+63
| | | | | | | | | | | | | | QQuickAnimatedNode uses beforeRendering and this connection can conflict with Quick3D render prep. Updating qsgnodes will be delayed for now to prevent the crash. Fixes: QTBUG-126193 Pick-to: 6.10 6.8 Change-Id: I29aa09fb6a52a4446818699bebf42eabf613c43f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Material: don't set individual radii properties on rectangle SG nodeMitch Curtis2025-10-011-8/+0
| | | | | | | | | | As of 727d2350391512cb8449f9db781b4e1041a8068c this isn't necessary and turns our lovely circle into a square. Fixes: QTBUG-136958 Pick-to: 6.10 Change-Id: I96d3d8e3e2061a3a2b387bf8e35a9bcc9fd3e9ed Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Set explicit default security level of all files with default securityJan Arve Sæther2025-09-1781-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | The files (folders) already processed are listed in each issue in epic QTBUG-134547 These files were processed half a year ago. In order to make it clear that all of these files are already processed, mark them with an explicit default security header. For the record, this was generated with this script: find -E . -regex ".*\.(cpp|h|hpp|mm|qml|js)$" | xargs python3 ~/bin/add-cra-header.py in the folders listed in each subtask of QTBUG-134547 (add-cra-header.py only exist at my desktop, but it simply adds the default security header if it doesn't already have any existing security header) QUIP: 23 Fixes: QTBUG-134547 Pick-to: 6.10 6.9 6.8 Change-Id: Ieb8c78ea6561fdbdd27c7b13185ece853eedf80f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Material Container: fix includesFabian Kosmale2025-08-201-1/+2
| | | | | | | | | | | Add the missing QPointer include and switch to the preferred include style. Amends 21ff1d42c0563b5369f5dca78417adb3d9008787 Pick-to: 6.10 Change-Id: I8f39b82333128043d44a7e46821553e1f3709d41 Reviewed-by: Morteza Jamshidi <morteza.jamshidi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material Style: fix focusIn and focusOut animation issuesMorteza Jamshidi2025-08-144-104/+86
| | | | | | | | | | | | When a property potentially used in focusIn or focusOut animation is changed, we need to reschedule the animation with the correct parameters. properties like verticalPadding, leftPadding, controlHasText, ... To fix the issue I simplified focus animation logic. Fixes: QTBUG-138028 Change-Id: I115fb6fdd5676ae0282b5b4b5bd460ea3b28392a Pick-to: 6.10 6.9 6.8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SearchField: Use highlightedIndex instead of currentIndex in stylesDilek Akcay2025-08-111-2/+2
| | | | | | | | | | As highlightedIndex property is added to SearchField, relevant style implementations that previously relied on currentIndex have been updated to use highlightedIndex. Pick-to: 6.10 Change-Id: Ib8bc065c92aa95a1ea5ea3cd5c3825bbd15c2f2d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* VerticalHeaderViewDelegate: set 6.10 with set_source_files_propertiesMohammadHossein Qanbari2025-08-081-0/+3
| | | | | | | | | | | | Found in 6.10 QML API review amend 9601b74dabed53e93a7a5144d4c1fadb7876db18 Task-number: QTBUG-137478 Pick-to: 6.10 Change-Id: I3a26307f304277dfd259da3736d1069a43c0cd03 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* HorizontalHeaderViewDelegate: set 6.10 with set_source_files_propertiesMohammadHossein Qanbari2025-08-081-0/+3
| | | | | | | | | | | | Found in 6.10 QML API review amend 9601b74dabed53e93a7a5144d4c1fadb7876db18 Task-number: QTBUG-137478 Pick-to: 6.10 Change-Id: I11fcf5317add4c07e211cff70d3b2e86bd470000 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add set_source_files_properties for SearchFieldDilek Akcay2025-08-061-0/+4
| | | | | | | | | | Added set_source_files_properties to configure build settings for SearchField in 6.10. Found in 6.10 QML API review, QTBUG-137478. Pick-to: 6.10 Change-Id: Ieff5ff3c737ee2c9ddd7a261333eea777d7ef03e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material Toolbar: Reflect background color with set custom primary colorSanthosh Kumar2025-07-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the quick material style, the primary color or any other colors within its color system would be considered as custom if the set color is outside the predefined enum colors or provided in other color formats. These colors within the material color system can be set by the user through options such as conf or env. The material toolbar, by default, initialises the background color with the primary color. Thus, it's expected implicitly that the background color should reflect the primary color as set by the user. It's also to be noted that this does not necessarily mean to consider background color as custom (as it hasn't been explicitly overridden by the user). This assumption of custom background color has been corrected as part of patch 76d7080fbefc33988d8517f1a964ebdb5c3b3dd2. The controls (such as Toolbar), when requesting the background color, validate whether it has been explicitly set or not. If set, the same shall be provided; otherwise, it can be colors from the predefined range or the default color. In this case, the background color would not be considered as explicitly set (reflecting the primary color), and thus it falls back to the default color as it's also not within the predefined range in the material style. But it's valid to expect the primary color as set by the user. This patch resolves this issue by having additional validation with the primary color properties when providing the background color. Fixes: QTBUG-138602 Pick-to: 6.10 6.9 Change-Id: I1ef1d1b4cd59ec191d6b3cf2886640c52193248e Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Add Material style for SearchFieldDilek Akcay2025-06-3012-0/+143
| | | | | | | Task-number: QTBUG-137318 Pick-to: 6.10 Change-Id: Ie3437d532bf0307ec447d814c503c8b281fd1f62 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Add PURL and CPE info to 3rd party attribution filesAlexandru Croitor2025-06-041-0/+1
| | | | | | | | | | | [ChangeLog][Third-Party Code] Added PURL and CPE information to the attribution files of 3rd party sources. Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-137262 Task-number: QTBUG-129602 Change-Id: I1a5691ff042c47461fe4769399c3bd2d6ec52160 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Material: Fix ToolBar color updates on theme changesJarkko Koivikko2025-05-222-12/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes two issues in the ToolBar: 1. Background color The ToolBar background was not using the correct shade rule for the Dark theme (it did not switch to Shade200). 2. Foreground color With certain theme changes, the ToolBar could end up with black text when white text was expected (according to toolTextColor rules). Although the changes are relatively straightforward, the root cause is nuanced due to the interplay of theme defaults and custom overrides. Here is what the patch does: - Marks globalForegroundCustom and globalBackgroundCustom as false by default so that built-in defaults are treated as theme-based rather than custom. - Emits foreground and background change notifications on theme changes, except when the color is a true custom color (which remains unchanged). - Resets background and foreground colors to style defaults if the property is set to a default theme color and there’s no global override. - Removes direct assignment of Material.foreground in the ToolBar, replacing it with a dynamic approach. If the ToolBar background is set to primary, it automatically applies toolTextColor as its foreground. Pick-to: 6.9 Change-Id: I10cc7aa5276de712ed76f7acf7b56d6541bce70e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickMaterialPlaceholderText: Add MEMBER to Q_PROPERTY declarationsBartlomiej Moskal2025-04-101-2/+2
| | | | | | | | | | | | | | | | | In e70994631407b16738d2c2be8c956d8d3bbf5499 commit, two new Q_PROPERTY declarations were added: leftPadding and floatingLeftPadding. Both were missing the MEMBER keyword, which allows the Qt meta-object system to access the member variables directly. Without this fix, the following compilation warning appears: "Property declaration leftPadding has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid." Task-number: QTBUG-133492 Pick-to: 6.9 6.8 Change-Id: I11dc288463c0966821fe09f7f9fe85be1aa2c56b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix mixed-type usage of qFuzzyCompareDennis Oberst2025-03-141-1/+1
| | | | | | | | | | | | | | | | When building Qt with a non-double qreal type, i.e. QT_COORD_TYPE=float, mixing types on qFuzzyCompare will result in ambiguities since the two overloads: qFuzzyCompare(float, float) qFuzzyCompare(double, double) will compete with eachother. Fix this by ensuring that both arguments passed to the function have the same type. Pick-to: 6.9 6.8 6.5 Change-Id: Iee8154e3296a281f8efaac276b9a4d66a20d420b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix ambiguous qBound usage when qreal is floatDennis Oberst2025-03-141-2/+6
| | | | | | | | | | | | | | | | | | | | When building Qt with a non-double qreal type, i.e. QT_COORD_TYPE=float, explicit template specialization like: qBound<qreal>(0.0, qreal(0.5), 1.0); is ambiguous because the double literals conflict with qreal (float). This creates ambiguity when resolving between overloads such as: qBound<T>(const T&, const T&, const T&) qBound<T, U>(const T&, const U&, const T&) Fix this by porting to std::clamp(), which ensures consistent types and avoids the implicit conversions that made such ambiguities possible. Pick-to: 6.9 6.8 6.5 Change-Id: I45b430dd26a90fd0289111f1b336d40533c74841 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QuickControls: Add vertical and horizontal header view delegatesMohammadHossein Qanbari2025-03-065-48/+68
| | | | | | | | | | | | | | | | | | | | | | Implement QQuickHeaderViewDelegate as the base class for header view delegates, introducing 'headerView' and 'orientation' properties. Separate previous delegate settings into HorizontalHeaderViewDelegate and VerticalHeaderViewDelegate components for Basic, Fusion, and Imagine styles. This change improves the modularity and reusability of header view delegates across different styles. It also allows for more consistent behavior and easier customization of header views. A test suite has been added to verify default property settings and ensure the new components work without warnings. [ChangeLog][QtQuickControls][HeaderView] Add dedicated delegate components for vertical and horizontal header views. Task-number: QTBUG-70326 Change-Id: I8831e77f6909bdae13c3a7262145ab156f63a59a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: Fix FloatingPlaceholderText X positionBartlomiej Moskal2025-02-284-4/+63
| | | | | | | | | | | | | | | | | | | In cb7eb152204e206539f307a9556eea43c589f026, we stopped using the leftPadding value for FloatingPlaceholderText. As a result, the text is now misaligned with the placeholder. This commit restores the FloatingPlaceholderText X position to leftPadding. If leftPadding is not set, it defaults to Material.textFieldHorizontalPadding. To prevent regressions (such as QTBUG-120149), a new X position animation has been added to FloatingPlaceholderText. Fixes: QTBUG-133492 Pick-to: 6.9 6.8 Change-Id: I5c80dcedd7c2beec0891b524fc55388fa5456f2a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Avoid leaking Private dependencies for style pluginsAlexandru Croitor2025-02-281-2/+2
| | | | | | | | | | | | | | | Use qt_internal_extend_target instead of target_link_libraries for the Qt Quick style plugins. This wraps their private module dependencies in BUILD_INTERFACE genexes. It avoids leaking the deps to consumers of the style plugins in a static build, where the private modules are not in scope by default. Pick-to: 6.8 6.9 Change-Id: Iac4b9d97c112fa829a60170d7fdad60f97e43f1f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* ContextMenu: add to text editing controlsMitch Curtis2025-02-284-0/+40
| | | | | | | | | | | [ChangeLog][Controls] TextField and TextArea now provide a ContextMenu by default. If you already have a custom context menu for these types, ContextMenu will not open its own on e.g. right click. Fixes: QTBUG-35598 Pick-to: 6.9 Change-Id: I0897a7ba5e1b5b6d5425c80cbc6f2550c904605b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make module ready for source SBOM checkingLucie Gérard2025-02-212-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This includes: - turning VERIFY_SOURCE_SBOM ON - adding rules to the licenseRule.json files - correcting the licensing given via REUSE.toml files - renaming license files not located in LICENSES folder. Their name needs to be prefixed with `LICENSE.` to be ignored by reuse and excluded from the source SBOM. The names are updated in the corresponding qt_attribution.json A lot of files are skipped during the license test, but all are present in the source SBOM. This is why corrections are needed before turning the source SBOM check on. [ChangeLog][Third-Party Code] Renaming the license files with prefix LICENSE. to have them ignored by reuse tool. Task-number: QTBUG-131434 Pick-to: 6.9 6.8 Change-Id: I2b3e4750405f13a97b350ee65def30f1330526a3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Take safe areas into account for Qt Quick Controls DrawerTor Arne Vestbø2024-12-191-2/+4
| | | | | | | | | | | When the drawer is pulled in from the side we want it keep its content away from the non-safe areas, while still drawing the background edge to edge. Pick-to: 6.9 Change-Id: Iff145df719f5746cbdb1d3c13494967c5993c6e6 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Compute implicitSize based on implicitContentSize in Popup and subclassesTor Arne Vestbø2024-12-195-10/+10
| | | | | | | | | | | | 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>
* Take safe areas into account for Qt Quick Controls ToolBar and MenuBarTor Arne Vestbø2024-12-192-0/+10
| | | | | | | | | | | | | | | A ToolBar and MenuBar is commonly placed in the header/footer/menuBar of an ApplicationWindow, where we don't do any automatic padding to account for the safe area. By adding the safe area margins as padding to the controls, we ensure that the control's background flows into the non-safe area, while the content item of the control (the toolbar or menu bar content) is kept within the safe area. Pick-to: 6.9 Change-Id: I5fad7394beaa01ae8ed142e4e2e42c5bffaab9fa Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Compute implicitSize based on implicitContentSize in Container and subclassesTor Arne Vestbø2024-12-184-8/+8
| | | | | | | | | | | | Now that Container 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: If0a710a5eb4a35c91d02d7170b5e03e457e6bc12 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Compute implicitSize based on implicitContentSize in Pane and subclassesTor Arne Vestbø2024-12-186-12/+12
| | | | | | | | | | | 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: Ie31b740a1e405341fc5f0ed9673b213292e4afd9 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QQuickMaterialTextContainer: don't explicitly create a brushVolker Hilsheimer2024-12-181-1/+1
| | | | | | | | | Rely on the implicit construction, and allow for an optimized QPainter::drawBrush(QColor) to not create a brush at all. Pick-to: 6.9 6.8 Change-Id: I9a18c72f85afb1383ce9f2056830f02330cf2897 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add REUSE.toml files and missing licensesLucie Gérard2024-10-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | REUSE.toml files are read by reuse to complement or override the copyright and licensing information found in file. The use of REUSE.toml files was introduced in REUSE version 3.1.0a1. This reuse version is compatible with reuse specification version 3.2 [1]. With this commit's files, * The SPDX document generated by reuse spdx conforms to SPDX 2.3, * The reuse lint command reports that the Qt project is reuse compliant. In order to be reuse compliant all the licenses referenced in file or within a REUSE.toml files must be present in the LICENSES directory at the base of the module. The missing licenses are added. [1]: https://reuse.software/spec-3.2/ Task-number: QTBUG-124453 Task-number: QTBUG-125211 Change-Id: I5a83879a7fee1bba046b2c53d9727dc0cde05c25 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix BusyIndicator being hidden when running is changed quicklyMitch Curtis2024-10-022-3/+12
| | | | | | | | | | | | | | | | If running is set to false and then true within a short period, BusyIndicatorImpl's OpacityAnimator cancels the 1 => 0 animation (which was for running being set to false), setting opacity to 0 and hence visible to false. This happens _after_ setRunning(true) was called, because the properties were set synchronously but the animation is asynchronous. To account for this situation, we only hide ourselves if we're not running by storing and checking our running state. Fixes: QTBUG-85860 Pick-to: 6.5 6.7 6.8 Change-Id: I220dfb78f00028e4a12a92fc14082006e1844002 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Controls: Avoid visual glitches in Material styleEirik Aavitsland2024-08-201-0/+1
| | | | | | | | | | | The ElevationEffect renders into a layer. However, as the layer sampling was not specified as smooth, there was a risk that visual glitches could be produced when the layer was rendered onto the scene. Fixes: QTBUG-115759 Pick-to: 6.8 Change-Id: Id793fd224434b9b6e946ed4e31eba79e9f92db8e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material Style: update style theme when system theme is changedMohammadHossein Qanbari2024-07-235-11/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Material style did not use the system theme when it was set to QQuickMaterialStyle::System. The problem was that QQuickMaterialStyle does not know about system theme changes. To make this possible, it is required to implement the QtQuickControls2MaterialStylePlugin::updateTheme() method. This method overrides the QQuickStylePlugin::updateTheme() virtual method, and it is when the system theme is changed. The material style plugin has access to the QQuickMaterialTheme. Then, the material theme will be notified when the system theme is changed. The material theme did not have access to the material styles as they are attached to the QML objects in the QML engine. To address this, when a material style's theme is set to System, that material style can register itself to the list of the system styles that are stored in the material theme. When the system theme is changed, the material style plugin notifies the material theme and the material theme iterates through the material system styles and updates their themes. To prevent dangling pointer issues, the material styles list (with System theme) uses QPointer type to detect null pointers after they are destructed. They will be removed from the list when they are touched and are null. The testcase creates an ApplicationWindow with value of Material.System for Material.theme property to follow system theme changes. It then toggles the platform theme through the TestHandler and compares the results. The TestHandler class creates a mocked class called MockPlatformTheme that inherits from the QPlatformTheme class and overrides the colorScheme() and requestColorScheme() virtual functions. The reason for overriding these methods is to simulate the platform theme change event. [ChangeLog][Controls][Material] If the Material.theme is set to Material.System, the application theme changes when the system theme is changed. This also works for the child attached styles. If its theme is set to Material.System, regardless of its attached parent style, it will follow the system theme changes. Fixes: QTBUG-127169 Pick-to: 6.8 Change-Id: I29a0c59525f342595a20a908faa85bcae6615bf4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TreeViewDelegate: don't use palette settings in Material styleMohammadHossein Qanbari2024-07-081-3/+10
| | | | | | | | | | | | | | | | | When the app's theme was different from the system theme, the TreeViewDelegate didn't display properly as the text color was the same as the background color. The reason was that the TreeViewDelegate used the palette colors in the Material style. To fix this issue, the TreeViewDelegate should use the Material settings rather than palette settings. Fixes: QTBUG-125296 Pick-to: 6.8 6.7 6.5 Change-Id: I8c34511ed714fe709296df02873a7ebe873a4361 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Dialog: Hide title if inside a popup windowOliver Eftevaag2024-06-211-2/+2
| | | | | | | | | | | | Popup windows with the Qt::Dialog flag, will display the title in its window decoration. Because of this, it's redundant to also display the title inside the dialog. Pick-to: 6.8 Change-Id: Ib052a950216248c889983361063c8e46f4cffdfa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Controls: replace Qt.styleHints with Application.styleHintsMitch Curtis2024-06-211-1/+1
| | | | | | | | | | | | | | As mentioned in QTBUG-95540, using the latter provides better type information for tooling, and avoids the "this property only exists on the object if Quick has been imported" issue. Replace QtQml import in Fluent style's Config.qml with QtQuick to provide access to the Application type. Fixes: QTBUG-126512 Pick-to: 6.5 6.7 6.8 Change-Id: I4aac22e54f3b522f74acafd467ce22139352c9dd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Material: fix button padding for IconOnly and TextOnly displaysMohammadHossein Qanbari2024-06-171-2/+3
| | | | | | | | | | | | | | | | | | | Correct the right padding of the Material style Button when the display is IconOnly and the left padding when the display is TextOnly. The issue was due to the buttonLeftPadding() and buttonRightPadding() functions not considering the display condition in the hasIcon and hasText arguments. To fix this, the display condition is now included in the arguments of these functions. Additionally, comparing the leftPadding and rightPadding with the output of buttonLeftPadding() and buttonRightPadding() has been added to the test case. Fixes: QTBUG-126124 Pick-to: 6.8 6.7 6.5 Change-Id: I2f1b60ebeae3d9854f96357bc5b0b5a77746aa17 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Tumbler: fix warnings when swapping contentItemMitch Curtis2024-06-121-4/+4
| | | | | | | | | | | | | | | | | | | Referring to the contentItem property of Tumbler from within the contentItem itself was a way to avoid using ids (which prevent deferred execution). However, the new contentItem may not have a delegateHeight property, so we move the declaration up to the Tumbler itself to ensure that it's always available. Until QTBUG-11984 is implemented, we have to use the "__" prefix to mark the property as "private" and (hopefully) lessen the chance that it will show up in auto-completion within users' IDEs, since it's not part of the public API (this is also why we've historically avoided declaring properties here). Fixes: QTBUG-119647 Pick-to: 6.5 6.7 Change-Id: Ie8646e605b0c7b1e804a6c4da4046613f958e51d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove the use of GENERATE_CPP_EXPORTS argumentAlexey Edelev2024-06-111-1/+0
| | | | | | | | | The behavior that argument was enabling is the default one now. Pick-to: 6.8 Task-number: QTBUG-90492 Change-Id: I11711d4c794f0b22169abb595b8ffad2eeb1300d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Material: fix warning in Popup during test runVladimir Belyavsky2024-04-231-1/+1
| | | | | | | | | | Fix warning in tst_controls::Material::Popup::test_size(): "qrc:/qt-project.org/imports/QtQuick/Controls/Material/Popup.qml:42: TypeError: Cannot read property 'radius' of null" Fixes: QTBUG-124622 Change-Id: I26c90ff18b081d2c217b4eed143d576ac6c61eab Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Materials.impl: Mark dependency on Controls.implFabian Kosmale2024-03-271-0/+1
| | | | | | | | | | | | | QQuickMaterialPlaceholderText derives from QQuickPlaceholderText, so there is a dependency to Controls.impl on the C++ level. Make that one explicit, so that QDS can resolve the type in its code model. Fixes: QTBUG-123594 Pick-to: 6.5 6.7 Change-Id: I890f683af65daf501f93b4224897568ef269837d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Use document imports of QtQuick.Controls.impl, not qmldir-importsMitch Curtis2024-03-151-0/+1
| | | | | | | | | | | | | | | | qmldir-imports are transitive, meaning that we were exposing all types from QtQuick.Controls.impl each time QtQuick.Controls was imported. This patch removes these transitive qmldir-imports by moving the foreign type declarations for QQuickOverlay and QQuickSplitHandleAttached into the Basic style (which is always imported by every style as a final fallback). Task-number: QTBUG-104768 Task-number: QTBUG-123103 Change-Id: Ia0ff778a88a38bb872730e055631dc924456d7be Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Material: remove ComboBox's insetsMitch Curtis2024-03-071-3/+0
| | | | | | | | | | | | | | | These were probably necessary when it had drop shadows, but it no longer does. Doing this makes it the same height as TextField. [ChangeLog][Controls][Material] ComboBox's insets were removed. This may cause visual changes to UIs. Task-number: QTBUG-120067 Pick-to: 6.6 6.7 Change-Id: Ia66f254eb5d556b7f629488a8f74e2417d7d7489 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Material: fix floating placeholder text x positionMitch Curtis2024-03-072-2/+4
| | | | | | | | | | Don't set it to control.leftPadding, because we don't want it to change if the user changes leftPadding. Fixes: QTBUG-120149 Pick-to: 6.5 6.6 6.7 Change-Id: I67bbc22192fef386fe088398b67d3eb0a10421ba Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Material: animate RadioButton indicatorMitch Curtis2024-03-071-4/+27
| | | | | | | | | | | This makes it match the specs: https://m3.material.io/components/radio-button/guidelines#eba97636-1dd9-4e81-a1a6-20b8123d1b83 Fixes: QTBUG-113532 Pick-to: 6.5 6.6 6.7 Change-Id: I266a8f8c6ace780650b26f72fa1bd7ea8c933507 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Material: fix assertion failure when quickly changing TextField's focusMitch Curtis2024-02-151-1/+12
| | | | | | | | | | | | Focus changes can happen before the focus in/out animations finish. In that case, stop the animation, which will eventually delete it. Until it's deleted, we clear the pointer so that our asserts don't fail for the wrong reason. Fixes: QTBUG-118889 Pick-to: 6.6 6.7 Change-Id: I6398805c006dadac71e168126c7a387357d5d2b0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>