summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
Commit message (Collapse)AuthorAgeFilesLines
...
* Reset palette resolve mask in windows vista styleSanthosh Kumar2023-09-051-0/+2
| | | | | | | | | | | | | | The palette set by windows vista style during polish doesn't allow style- sheet style to override it. This patch reset resolve mask for the palette set by windows vista style and thus it can be overridden. Fixes: QTBUG-115511 Pick-to: 6.6 6.5 Change-Id: Ifcaf441f806cfa0273599b3dce83fdfaec3f5a66 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* WindowsVista style: fix subControlRect() in rtl modeChristian Ehrlicher2023-08-191-2/+1
| | | | | | | | | | | | | | During refactoring of the vista style in 46f98147f4e3a09b32042c0655d5de7285a795e3 a regression slipped into subControlRect()'s default branch which lead to a double call of visualRect(). This breaks nearly all subControlRect() calculations in rtl mode. Fixes: QTBUG-116224 Pick-to: 6.6 6.5 Change-Id: Ida722e1b6c6a311b27a9b48d1fe1378b47c21cf4 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Windows style: use correct value for title bar heightYuhang Zhao2023-07-121-5/+2
| | | | | | | | | | | | | | | | The title bar height = caption bar height + resize border thickness. This calculation is used by many open source repositories for quite a long time, including Microsoft's own famous products such as Windows Terminal. And if you use AdjustWindowRectEx() to get the title bar height, the result is also exactly the same, so this should be the correct calculation. Normally, when DPI is 96, it should be 23 + (4 + 4) = 31px. Pick-to: 6.6 Change-Id: I0a2de3b55d5b62327eacc7e2ff5dc23771b8efdb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows QPA: minor code simplificationYuhang Zhao2023-06-281-15/+9
| | | | | | | | | | Simplify the code a little bit. Change-Id: I7fdb14e676c5b0aa8752b6ee17f0644056ddfcea Reviewed-by: Timothée Keller <timothee.keller@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix disabled and inactive group palettes for windows native styleSanthosh Kumar2023-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | The dark mode related changes for windows didn't update disabled and inactive group palettes, and this makes text in certain context (such as menu bar) appear with enabled color. The windows theme API populateLightSystemPalette() is responsible for this and it updates palettes for color roles and certain inactive scenarios but not for disabled. This patch set makes existing systemPalette(Qt::ColorScheme) to be available in QWindowsTheme and it updates palette depending on color scheme. From now on, this API updates palettes for windows native style. Its to be noted that window native style use light palette irrespective of color scheme. Fixes: QTBUG-114821 Pick-to: 6.5 6.6 Change-Id: Iff4f35900293b8e7030ec121ca21856daa094dc0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Set color scheme after handling theme change in windowsSanthosh Kumar2023-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | Setting color scheme before handling theme change provides incorrect palette color when user switches from light to dark or dark to light. This is visible when using Fusion style (or other style that supports dark mode) in Windows. The change has been made as part of patchset 787038bb1d282b4d6c5c040d8e902ccac9befb41. It also has to be noted that handling palette changes to make further changes to the palette (or the style sheet), is less likely than Handling the colorScheme change signal and in this sense, this patch set can also be considered as an improvement. This patchset reverts that change and updates color scheme after palette change in the application. [ChangeLog][QtGui][ColorScheme] Update colorScheme property after palette change. Fixes: QTBUG-112653 Pick-to: 6.5 6.6 Change-Id: I71bc413c56663fefdf9fe5871bbb19b7e6c3d9ff Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Fix QMenu (+other theme) sizes on Windows multiscreen systemsThorbjørn Lund Martsum2023-05-102-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason this worked before is unclear. It could be suspected that we have made a dpi awareness change or Microsoft changed the behavior of the OpenThemeData function. Regardless, we expect the result to match the primary display which OpenThemeData doesn't do (anymore). Instead it returns a value based on the hwnd screen (which btw didn't always match the widget) and the cache system would then re-use that theme also for hwnds on other screens. The most obvious solution is to use OpenThemeDataForDpi to make sure we get a theme result matching the primary sceen. Then our correction of the result by with multiplying QWindowsStylePrivate::nativeMetricScaleFactor(widget) works again. This fix does not only fix QMenu sizes. It fixes the size for all widgets that use this theme function, which could return near random results before. We load this library dynamically since MinGW 11.2.0 won't link with it. [ChangeLog][QWidgets][QMenu] Fixed menu sizes on Windows systems with more screens. Fixes: QTBUG-112911 Pick-to: 6.5 Change-Id: I8fdfde2ef5b2aa407cbc74c85afe2c0b74026cff Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* macOS: Avoid memory leak when using NSSlider for style drawingTor Arne Vestbø2023-04-271-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix the broken sliders reported in QTBUG-98093 a workaround was added by 4bee9cdc0ac4bbee7f061e8f6050d704032f6d0f where we would call initWithFrame on an already initialized NSSlider. This breaks the contract of object initialization in Objective-C, as the class is free to allocate and prepare resources for the instance without freeing previously acquired resources first. As noted by the Object Initialization chapter of the Concepts in Objective-C Programming guide, "Once an object is initialized, you should not initialize it again.": https://tinyurl.com/objc-object-init And as observed in QTBUG-112899, the additional initialization resulted in a memory leak. The other part of 4bee9cdc0ac4bbee7f061e8f6050d704032f6d0f was that we now called startTrackingAt twice when drawing. Both from setupSlider, for all consumers, and from drawComplexControl, and as it turns out, this is the key thing that "fixes" the pressed knob drawing of NSSlider. For some reason, NSSlider needs the duplicate startTrackingAt call both to draw the knob as pressed, and to not let one drawing pass affect another drawing pass. This would benefit from further investigation, but for now the removed leak is an improvement. Fixes: QTBUG-112899 Task-number: QTBUG-98093 Pick-to: 6.5 Change-Id: Ia7e6ef963910f1858d2fdb10e0323fc5bb3b2eda Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTabBar: draw text within moving tabAxel Spoerl2023-04-201-0/+1
| | | | | | | | | | | | | | | | | | | | When a tab was moved by dragging, the tab's rectangle was drawn empty, without the tab text. When a tab was moved by animated snap back to its original position, the tab text was already drawn on the original position, while the rectangle was still moving due to animation. Adds the enum value QStyleOptionTab::TabPosition::Moving When this option is set, QCommonStyle draws the tab text at the current position instead of the original home position of the tab. The QMacStyle switches over the TabPosition enum. As a moving tab is laid out like the last tab in the given orientation, the enum value Moving is treated like End. Fixes: QTBUG-112277 Change-Id: I42a2d9c269dadfe9819c12dbc69e3ae995a45b09 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWindowsXPStyle: use QVarLengthArray instead new for memory allocationChristian Ehrlicher2023-02-281-21/+21
| | | | | | | | | Avoid the creation of a temporary buffer by using QVarLengthArray instead. Normally GetRegionData() only returns one rect (~48bytes) so it will fit into the QVLA without a memory allocation Change-Id: I279693e17e2f9f2c1c75504c3e5c1de3d45084ec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStyleSheet: never treat styled scrollbars as transientVolker Hilsheimer2023-02-271-4/+8
| | | | | | | | | | | | | | | | | | | | | | | If a style sheet is applied to a scrollbar, then we cannot treat it as transient, as the QStyleSheetStyle doesn't implement any fade-in/out animation logic. And we also need to set the overlap to 0 (in both the style sheet and the macOS style) if the scrollbars are not transient; otherwise the opaque scrollbar will be placed on top of the content. Since a style sheet might only apply to a scrollbar based on its orientation, we also have to pass the style option through to all calls of the styleHint function. And since that function is also called from other QStyle implementations in the macOS style, we have to make sure that we call styleHint() on the widget's style to get the correct value based on the style sheet. Fixes: QTBUG-63381 Pick-to: 6.5 6.4 6.2 Change-Id: Ic67ce3a7cb5089f885dabfd5a1951e3029915446 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Rename Qt::Appearance to Qt::ColorSchemeTor Arne Vestbø2023-02-132-3/+3
| | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. Pick-to: 6.5 Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* src: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-104-19/+0
| | | | | | Pick-to: 6.5 Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Reset dark palettes for widgets to light in windows styleSanthosh Kumar2023-02-022-0/+36
| | | | | | | | | | | | | | | | | Windows theme in dark mode set dark palettes for checkbox, radiobutton, menu, menubar explicitly. The fix added as part of a2518b4140ed88a674bf4a4fcf4576e35c698bb9 (to use light palette for windows style) overrides only system palette and widget specific palettes are still with dark palettes. In this patch, the windows style overwrite dark with light palette for widgets that are explicitly set with dark palette in windows theme. Fixes: QTBUG-110432 Pick-to: 6.5 Change-Id: I2af0e517d62981f062244eeab8f1b5e5442cc451 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Vista style: remove temporary workaroundYuhang Zhao2022-12-161-10/+2
| | | | | | | | The MinGW issue has been fixed some time ago. Change-Id: Ie2eaa2952d398a913b06d36d7e621efff9e4c926 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Vista Style: Use correct action icon pixmaps matching the device pixel ratioFriedemann Kleint2022-12-121-5/+4
| | | | | | | | | | | Extend change 5911335756dff5a917e4a7ccf025816c08ddd656 to the Vista style (using the paint device's ratio). Pick-to: 6.4 Fixes: QTBUG-108440 Task-number: QTBUG-85885 Change-Id: Ib0b5fcc943a18896b770b382b39bbb684238a618 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Overwrite dark system palette in Vista styleVolker Hilsheimer2022-12-081-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | The Vista style uses system assets for controls, and those are never dark. Because of that we cannot support dark appearance with that style, and applications using the Vista style should always use the light system palette. Override QStyle::polish(QPalette &) in the vista style to do that. To make that palette available, move the code reading the light palette into QWindowsApplication, and call that method from both the platform theme (if the system is running in light mode) and from the Vista style (only if the system is running in dark mode). If the system is dark mode and another style is used (e.g. Fusion, which works well with a dark palette), then the palette returned by the platform theme gets used without any modifications. This requires duplicating some small inline helper functions in QWindowsTheme and QWindowsApplication. We can clean this up once the implementation is complete for both Qt Widgets and Qt Quick. Change-Id: Ia13f59a2d8414642603f9708926718daf9e8954d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Revert "Let styles indicate that they support dark mode"Volker Hilsheimer2022-12-082-7/+0
| | | | | | | | | | | This reverts commit 3ee7a9f85c9d4566223f44f7bab04abafdfca82c. Styles that don't support dark mode can overwrite the palette in a QStyle::polish(QPalette &) override instead. Change-Id: I8b84d822d91be5b3f67f76f791a1330bba7ea546 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Stop using deprecated constants and use suggested replacementTimur Pocheptsov2022-12-021-1/+1
| | | | | | Pick-to: 6.4 6.2 Change-Id: I3686d896267d219501f8eeec74729c17d9c2b42d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Let styles indicate that they support dark modeSanthosh Kumar2022-11-262-0/+7
| | | | | | | | | | Add a style hint that allows styles to indicate that they support dark mode. The macOS and Fusion styles support dark mode, the other styles, in particular the Windows Vista style, do not. Task-number: QTBUG-72028 Change-Id: I02cac2e19a21898663f50f09a4ef419a613a73ec Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: delay initialization of small fontVolker Hilsheimer2022-11-092-9/+14
| | | | | | | | | | | | | | | | | | During construction of a QStyle, QApplication might not yet be initialized, e.g. when calling QApplication::setStyle("macOS") before constructing QApplication. In that case, we cannot access the platform theme. We don't just want to skip initializing the small font either though. Store the smallSystemFont as a std::optional so that we can initialize it once, when the first widget gets polished. As a drive-by, remove the unused miniSystemFont variable. Fixes: QTBUG-108047 Pick-to: 6.4 6.2 Change-Id: Id750770a563611fdbc6c7031fe102a99ea692be7 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Revert "QMacStyle: paint PE_PanelScrollArea differently"Timur Pocheptsov2022-10-281-6/+6
| | | | | | | | | This reverts commit a43845b75a3eaed9cb0a323a9694c34a601286fb. Reason for revert: As I can see from the pictures generated by the tests, the scroll bar now looks significantly worse and wrong. Change-Id: I454b316b844839ebfc3f44633348e527e2a30f34 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMacStyle: paint PE_PanelScrollArea differentlyTimur Pocheptsov2022-10-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | To make it look more natural (without outline and with proper colors). Otherwise this thing looks bad in both Aqua and Dark themes - can be seen if scrollbars always shown (this option is set in "General" settings). Tried so far: - not to draw this element at all - gives a visible hole in the corner - ask the horizontal bar to render its knob track a bit longer (resetting a clip properly) - gives a weird side-effect when scrolling in Dark mode + unfortunately outline of a track is still visible (it overlaps the vertical bar's track). Alas, good old hardcoded colors/alpha values as a last resort. PE_Frame had -1,-1 adjustment, making a frame line visible in the corner below scrollbars, giving another strange effect. Fixes: QTBUG-106927 Change-Id: Ie0367c3bd6f40b3fa4ca6afac09f27e446fc007d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows 11: draw checked menu items with an explicit backgroundVolker Hilsheimer2022-10-251-0/+11
| | | | | | | | | | | | | | | | | | | On Windows 11, the UXTheme API draws both MBI_PUSHED and MBI_HOT in the exact same color as the icon grove. For menu items with icon, but with no explicit "On" icon, that makes it impossible to see whether the item is checked. Work around this problem by drawing the background in a light version of the highlight color, which simulates the style on Windows 10. Note: In modern Windows 11 menus, checkable items with icons render both the checkmark, and the icon next to each other. Pick-to: 6.4 6.2 Fixes: QTBUG-98354 Change-Id: I830eca5cdb3317f69dd5c863586e0b0eaa8774d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unimplemented function from WinVistaStyleYuhang Zhao2022-10-241-1/+0
| | | | | | | | | | | | | | | The implementation of the "scrollBarGripperBounds" function originally lies in the Windows XP style source code, it was totally removed during the previous refactor commit, but the function declaration was not removed at the same time. We need to either remove the declaration or bring back it's implementation, but since we don't use this function at all (otherwise there will be link errors), it's better to just remove it. Amends commit 46f98147f4e3a09b32042c0655d5de7285a795e3 Change-Id: I76444d63966f1007114d090837092ea11fda0ccb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Refactor windows vista style for Qt widgetsSanthosh Kumar2022-10-1911-5042/+3859
| | | | | | | | | Removed windows xp style and Cleanup windows vista style for Qt widgets. Change-Id: Ia05e8bca9bad477cec535d2288d9773546e0e116 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMacStyle: Set NSControlStateValueOn for selected tabsDoris Verria2022-10-191-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | We draw tab buttons as NSButtons of type PushOnPushOff. To draw a selected tab, we used state ON (NSControlStateValueOn), which gives it the accent color, and state OFF for non-selected tabs. To draw a selected and pressed tab, we use state OFF and set highlight: depending on isPressed. This worked fine up until macOS 11 because when setting highlight to true the push button would draw the accent color no matter the state. In macOS 12, things are different. A highlighted NSButton doesn't draw the accent color anymore, but rather a gray background. So when we draw a selected tab using NSControlStateValueOn (blue/accent color) and then press it (state changes to NSControlStateValueOff), the tab will change color from accent/blue to gray. The text remains white, so it's not clearly visible. To fix, set the NSControlStateValueOn for selected, pressed tabs on macOS 12, so the background color doesn't change when pressing on a selected tab. Fixes: QTBUG-101000 Pick-to: 6.2 6.4 Change-Id: Iaf48a7e2ae536c7c591578bb3c1065bd0e29b2e1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMacStyle: restore control size after re-initializationTimur Pocheptsov2022-10-181-0/+2
| | | | | | | | | | | | | We had to re-initialize NSSlider, due to some hidden problem with stale geometry, when just setting properties of a cached control (the remains of another previous QSlider render, using the same NSSlider). But -initWithFrame: also resets the control size we set earlier, thus 'small'/'mini' becoming 'normal'. Fixes: QTBUG-107450 Pick-to: 6.4 6.2 Change-Id: Ice42c787ec65d89c1c15f9c89462b7804aafe51c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-3/+3
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Replace QPlatformTheme::Appearance by Qt:AppearanceAxel Spoerl2022-09-201-1/+1
| | | | | | | | | | | | | With the introduction of Qt:Appearance, its predecessor in QPlatformTheme has become redundant. This patch replaces all occurrences of QPlatformTheme::Appearance with the new enum class. Task-number: QTBUG-106381 Change-Id: I5406f1b7c19f68571f074617c681318c96a6517e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Apply Q_CONSTINIT where beneficialSona Kurazyan2022-09-011-1/+1
| | | | | | | | | | Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.hSona Kurazyan2022-09-011-0/+2
| | | | | | | | And include qcore_mac_p.h where needed. Task-number: QTBUG-99313 Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-234-4/+4
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove unneeded @available check for macOS <= 10.14 and iOS <= 13Tor Arne Vestbø2022-08-051-7/+3
| | | | | | | | All versions down to Qt 6.2 require macOS 10.14 or iOS 13. Pick-to: 6.2 6.3 6.4 Change-Id: I5048921ea5a149346a0fa84228227d9156004675 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* darwin: Remove unneeded SDK version checks for older versionsTor Arne Vestbø2022-08-051-4/+0
| | | | | | | | | All versions down to 6.2 require at least Xcode 12, which ships with the macOS 11 SDK, and iOS 14 SDK. Pick-to: 6.4 6.3 6.2 Change-Id: I128321ec9e97b670b7c027f1233978e1b8856f88 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-034-0/+12
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QCommandLinkButton: Let the style set the text colorsVolker Hilsheimer2022-07-191-0/+5
| | | | | | | | | | | | Make the hack less hacky by letting the style polish the widget (it does already for the font) to set a dynamic property that the button can test. Use the available palette entires ButtonText and BrightText to set the dark blue and bright blue colors, rather than hardcoding them in the widget code. Pick-to: 6.4 Change-Id: Idfb3b7d18e456a9d14af4962cf723e12ff1c3370 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-152-10/+10
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1614-532/+28
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Macstyle: fix the text color on the disabled buttonTimur Pocheptsov2022-05-021-1/+1
| | | | | | | | | | | Forcing it to black make button look enabled, when it's not true. Baseline test already covers this scenario (but probably took wrong snapshot). Pick-to: 6.3 6.2 Fixes: QTBUG-102782 Change-Id: Ifa9041fbf5bf56a7a560e2d1af291c3db2b134f8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTabBar: let styles draw tab text with foreground roleVolker Hilsheimer2022-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | QTabBar::setTabTextColor's documentation and implementation suggests that the set color will always be used unless invalid, and that the foreground role is used otherwise. QTabBar then sets the foregroundRole palette entry to the specified color before calling the style. The intent is evidently that the tabTextColor is used no matter the foregroundRole (which by default is the role that contrasts with the background role). If the styles always paint the text with WindowText, then the tabTextColor gets ignored if the foregroundRole is not WindowText (perhaps because the backgroundRole is set to Base). Fix this by respecting the widget's foregroundRole when painting the tab label in the common style (which is the only style that implements drawControl for CE_TabBarTabLabel). QMacStyle and QStyleSheetStyle need to be adjusted to prepare the palette consistently with the logic in QTabBar. Pick-to: 6.3 6.2 Fixes: QTBUG-101456 Change-Id: I077a2034eebfe3f56cea28917494f4db01e48747 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* macOS: Remove dead code for focus ring handling in Mac styleTor Arne Vestbø2022-03-181-21/+0
| | | | | | | | | | It was added in 375dd7ad3457e335bd454ff91a66412941ae8f99 but never used. Pick-to: 6.2 6.3 5.15 Task-number: QTBUG-101883 Change-Id: Ibad7e0b1c371bdee63bcdbea0c5280091107408a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Enable tests to turn off Windows Vista animationsVolker Hilsheimer2022-03-162-7/+24
| | | | | | | | | | | | | | | | Animations in that style depend on the current time, which makes it impossible to run baseline tests. Introduce a dynamic property that allows us to set the time that animations use. This way, tests can turn the animation off, or control which time should be used. To keep performance overhead low, check only once whether the dynamic property is set at all. Pick-to: 6.3 Change-Id: I9bc57b9867fb0d852e101570eca4c7609e7fe1a8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Win: Fix use of deprecated isTopLevel()Mårten Nordheim2022-03-071-1/+1
| | | | | | | By using the suggested isWindow() Change-Id: Ic9eb8f3e422a966f1ecbc0ba3d852bdf95928778 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMacStyle: fix tool buttons (in checked mode)Timur Pocheptsov2022-02-281-3/+8
| | | | | | | | | | | | | | | | | While switching to the 'momentary push in' button type, the old code that shows button as pressed/checked was removed. Since 'square' buttons were sharing this part with rounded push buttons, the change broke checked square buttons. So we retain the old code for this particular case. Also, add a minimal baseline test for this scenario: square button, triggering 'toolbutton' style with/out 'checked' state. Fixes: QTBUG-100802 Pick-to: 6.3 6.2 Change-Id: Ib7b15b13ead834c7bb2cd36de76ccd5bedb07810 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMacStyle::standardIcon - use the real file nameTimur Pocheptsov2022-02-011-1/+1
| | | | | | | | | | | When converting to cmake, aliases from the (now deleted) qstyle.qrc were omitted and now we have to use the original names. Pick-to: 6.3 6.2 Fixes: QTBUG-100317 Change-Id: Ieb83e95c62f10c0e2193602e4c12c5fc1667e15a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows XP style: Fix coding style violationsVolker Hilsheimer2022-01-201-375/+329
| | | | | | | | | | | | | | | | | | | | Fix various violations of the coding style or general inconsistencies. No claim for completeness. * indentation and line breaks * consistent scopes for case statements where needed * add curly-brackets for if-statements where needed * removed {} where not needed * const'ify a few obvious local variables * remove random empty lines * use auto when type is obvious from cast Deliberately not touching nested if-statements that could be merged into one. Pick-to: 6.3 Change-Id: Ie22b36568f33e18d5f15c751c7fd76e1490133b9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QMacStyle: fix a regression introduced by a button type changeTimur Pocheptsov2022-01-121-0/+7
| | | | | | | | | | | Since we (re)use NSButton to render tab items, the 'momentary push in' button type breaks the tab. Temporary restore the old 'push on/push off' type if rendering a tab. Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-99743 Change-Id: I54b11c1a35373292ecf0bcd5cf7b4ea4203cc031 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMacStyle: use the 'momentary push in' type for push buttonsTimur Pocheptsov2022-01-051-8/+22
| | | | | | | | | | | | | | | | In the past, we were using different hacks to emulate the 'default' button and a normal button (and them in a pressed/not pressed active/non-active states). In macOS 12 old trick stopped working and UI looks a bit different: non-default buttons never get accent color even if pressed. Instead of relying on a combination of 'push on-push off' type's states and highlight, we can use the 'momentary push in' (highlighted == YES gives an impression of a pressed button) + setting a key equivalent (thanks to Tor Arne for the hint) gives the desired 'default button' look. Pick-to: 6.2 6.3 5.15 Task-number: QTBUG-98483 Change-Id: If7d665d217420b7732b556d98d9e0313258ff93e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Fix QSlider's knob positioning on MontereyVolker Hilsheimer2021-11-181-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMacStyle has a single NSSlider that is used to render any QSlider. For each QStyle API operating on a slider, the style sets the slider up with respecive properties. On macOS 12, the NSSlider maintains some states that make QSlider instances influence each other's knob position when rendering, resulting in uncontrollable jumping of the slider. This can be fixed by not using startTrackingAt/stopTracking APIs, which are however the only way we have to make the slider knob get rendered pressed - there is no property in NSSlider(Cell), and none of the NSCell attributes have any effect. So we need to use startTrackingAt, and work around the side effect by reinitializing the NSSlider by calling initWithFrame. This fixes the positioning error, but also causes flickering of the knob when dragging. To fix the flickering, we have to always call startTrackingAt for a slider that is pressed, even for calls to setupSlider that are made in QStyle APIs that are not drawing anything. Also tried with no complete success (either positiong bug or flicker): * call prepareForReuse on the NSView * always call stopTracking on the NSSlider Fixes: QTBUG-98093 Pick-to: 6.2 6.2.2 Change-Id: I3423b9f7cb125a59831c6722509ab3b74742b6ae Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>