aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material/qquickmaterialtheme.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Set explicit default security level of all files with default securityJan Arve Sæther2025-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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 Style: update style theme when system theme is changedMohammadHossein Qanbari2024-07-231-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QQuickMaterialTheme: check if default font family is availableVladimir Belyavsky2023-11-231-10/+8
| | | | | | | | | | | | | | | Explicitly check if "Roboto" font family is available before using it as a default font family for Material style. If not - try fallback to "Noto" font family. If both are unavailable, use default system font. This prevents us from missing family fallback lookups, which can be slow. Similar change 86b4f9f583e31f0db171a4320680902d83340468 was made also for Imagine style. Fixes: QTBUG-83155 Pick-to: 6.6 6.5 Change-Id: I57b7837175dd2b7d5097fbc648da33bd5443f8d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Material: don't set all caps for Button textMitch Curtis2023-05-051-1/+0
| | | | | | | | | | | | | The guidelines have changed since Material 2, and they now recommend to use sentence case: https://m3.material.io/components/buttons/guidelines Amends f47f8d69319fa7b0b71cc8036c5bdfd1e8407e70. Pick-to: 6.5 6.5.1 Change-Id: I055f4acc9c1e594b5c87818bcce5abd774b01d04 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Remove "2" from Qt Quick Controls directoriesMitch Curtis2022-12-011-0/+80
Qt Quick Controls 2 was named that way because it was a follow-up to Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer supported, we don't need to have "2" in the name. Work on this was already started for the documentation in 1abdfe5d5a052f2298b7bf657513dfa7e0c66a56. By doing this renaming a few weeks before feature freeze, it won't affect the release but still results in as little time possible spent manually fixing conflicts in cherry-picks from non-LTS releases as a result of the renaming. This patch does the following: - Renames directories. - Adapts CMakeLists.txt and other files to account for the new paths. A follow-up patch will handle documentation. It does not touch library names or other user-facing stuff, as that will have to be done in Qt 7. Task-number: QTBUG-95413 Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>