summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylehelper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace 'Qt Designer' and 'Qt Widgets Designer' in codeKai Köhne5 days1-1/+1
| | | | | | | | Use new term in examples, code comments, error messages and and mime types. Task-number: QTBUG-122253 Change-Id: I355452d6eb02a7a0ffbb20acf82ddb8ebbfa4837 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QStyleHelper: pass devicePixelRatio to uniqueName()Christian Ehrlicher2024-04-221-2/+3
| | | | | | | | | | | QStyleHelper::uniqueName() took the size of the pixmap to cache but not the dpr. This might lead to a situation (e.g. in a multi-display environment) where we use a pixmap with the wrong dpr and get a pixelated result on the screen. Change-Id: Ifdebeddff3380931398b3284a7757b7da950caa9 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
* QStyle: don't use the QPixmapCache when a style sheet is setVolker Hilsheimer2023-07-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a style sheet is active, then the palette in the QStyleOption might be a generated, short-lived, temporary QPalette instance. As QPalette's cacheKey is based on instance-counters of the private data structures, it will always be unique for such a QPalette, even if the brushes are the same as in a previous instance. (QPalette::cacheKey is just a 64bit integer, we cannot possibly encode the entire QPalette data in it in a collision-free way, and since a brush in the palette might contain a pixmap or a gradient we couldn't even generate an efficient string representation for it. We could at most cache and reuse QPalette instances based on the attributes in the style sheet rule and in the base palette of the widget. However, this seems fragile; it might be an opportunity for future optimization.) Some styles use the QPixmapCache, with a key that includes the palette's cache key. The key will always be unique if the palette is based on style sheet rules, and then we fill pixmap cache with pixmaps that can never be reused, making the cache both useless and wasteful. To solve this, generate an empty key if we detect that it is for a style object that is the target of a style sheet. Return an empty cache key string from QStyleHelper::uniqueName, which will make QPixmapCache return immediatey when trying to insert or find an object. This is not pretty, but it makes the change minimal and low-risk. Refactoring the respective code paths to e.g. consistently use the BEGIN_STYLE_PIXMAPCACHE helper macro requires larger changes that can only be verified visually, and so are out of scope for a bug fix. This requires changes to code that uses QStyleHelper::uniqueName, as we need to avoid that other key elements are appended to the generated (and maybe empty) key. As a side effect, this ends up with code that makes better use of QStringBuilder. Pick-to: 6.6 Fixes: QTBUG-114473 Change-Id: I011aed0885f105cbf1e8c0bc6b94c46df47761a3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fusion: better support dark themes in the dialVolker Hilsheimer2022-07-171-2/+6
| | | | | | | | | | A UI in dark mode will have a dark background. Pick a light color to draw the notches. Since in the mac style, the dark mode's 'dark' color is lighter than the 'light' color, pick whichever is lighter. Pick-to: 6.4 Change-Id: I333ea95b80d7a19504000877337b28839b4a8b9f Reviewed-by: Doris Verria <doris.verria@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-151-2/+2
| | | | | | | 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-161-38/+2
| | | | | | | | | | | | | 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>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-261-1/+1
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDial: fix painting QDial when the rect has an offsetChristian Ehrlicher2021-01-291-4/+4
| | | | | | | | | | When the QDial should be painted with an offset, the dial was not draw correct. Fixes: QTBUG-89574 Change-Id: I646c3d42fba34e8c603a8f81f363ed827f04d5de Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-1/+1
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Fix conversion warnings when setting alpha to QColorFriedemann Kleint2020-09-151-1/+1
| | | | | | | Adapt to 5bb4baae0379d5903f547f0399be9620f5ab06a0. Change-Id: Id65f87740f9de8e0d3624ff63c431dcad642f3a5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-221-0/+6
|\ | | | | | | Change-Id: Iace12004afdfe765a3068dfcf6f1320c1123c539
| * QStyle: Use primary screen DPI as default DPIMorten Johan Sørvig2020-02-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change d603ee68 made the default DPI be 96, for cases where a style option is not provided. This causes inconsistencies, since there are in fact several cases where QStyle API is called without a style option. Restore historical Qt behavior of using the primary screen DPI. Single-screen systems should now be consistent, as before. Task-number: QTBUG-82356 Change-Id: I849934ca2e5604b9fb2f045ed4f6058f3e0426ff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
|/ | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDial: use correct button colorChristian Ehrlicher2019-11-261-3/+6
| | | | | | | | | | When the pixmap for the QDial was cached, the button color for the knob was not properly set Fixes: QTBUG-19855 Change-Id: Ib09ac12f0b11c47a0d05f01759fc6eeadbeab06c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Widget style: Use per-screen DPI in QStyleHelper::dpiScaled()Friedemann Kleint2019-08-231-7/+36
| | | | | | | | | | | | | | | | | Pass the style option to dpiScaled() in order to get the correct screen DPI. The style option contains the font, which again contains the current DPI value. Add QFontMetrics::fontDpi() accessors to get the DPI from the QFont. This DPI will/should be updated on screen change. Replace hardcoded Q_OS_MAC DPI with hardcoded base DPI. This makes per-screen DPI testable on macOS, too. Task-number: QTBUG-45055 Change-Id: I75f8b37d45eb50c3334b46b8469a546d29712f1b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QMacStyle: Remove handling of defunct _q_styleObjectWindow propertyTor Arne Vestbø2018-07-301-8/+0
| | | | | | | | | | It was supposed to be used in Qt Quick Controls 1, for the desktop style, but the followup patches in QQC1 never landed, and QQC1 is now deprecated. Change-Id: Iceefd523fc02a9e48b986dc33bb13a41804dd199 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QStyleHelper: Remove unused function setWidgetSizePolicy()Gabriel de Dietrich2018-02-141-8/+0
| | | | | | | | This used to be public back when QMacStyle had public API. Long replaced by the WA_Mac*Size attributes. Change-Id: Ifd948e648ec90ff29b6b3652bc9d5cb1dc9c6a09 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* QStyleHelper: Use palette cache key in pixmap keyGabriel de Dietrich2018-01-051-20/+1
| | | | | | | | | | | | | | | This reverts commit d7bcdc3a442b99c2caebd4cfd38de67e14090e05. Now that QPalette::setBrush() is a bit smarter (see c564779c071b35fddb76f4e50afda4305b634651), we can be confident the palette's cache key won't change so often. Therefore, we can use it again as part of every pixmap's cache key. Change-Id: I5cab2296a937f9149c7745291e0442eea24f4e9d Task-number: QTBUG-65475 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-161-1/+0
|\ | | | | | | Change-Id: I3cf73c53cf131d0babfb558c2507bed0e0fc5f08
| * Remove some unused, local variablesJędrzej Nowacki2017-10-141-1/+0
| | | | | | | | | | Change-Id: I453162d2d396bb3427064d3b1593bb6c71376605 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-201-2/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/util/qcompleter.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmdisubwindow.cpp Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
| * Convert features.spinbox to QT_[REQUIRE_]CONFIGStephan Binner2017-09-121-2/+2
| | | | | | | | | | Change-Id: Idecb6927c20ff009795b0ad94bbb7199df98a8f8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-151-2/+4
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenu.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/widgets/styles/qstylehelper_p.h Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
| * Convert features.scrollbar to QT_[REQUIRE_]CONFIGStephan Binner2017-08-101-0/+2
| | | | | | | | | | Change-Id: Id6ea899c0fddf0de636701cfdc5f01ba20024976 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Convert features.dial to QT_[REQUIRE_]CONFIGStephan Binner2017-08-081-2/+2
| | | | | | | | | | Change-Id: I9fea2451fe3567fdd1af1540e9a55f218f54b569 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-071-0/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/linux-icc/qmake.conf mkspecs/macx-icc/qmake.conf mkspecs/win32-icc/qmake.conf src/gui/painting/qgrayraster.c Change-Id: Ib08c45ea3215be05f986ecb3e1f4b37d209aa775
| * Fix several unused warnings for misc disabled featuresStephan Binner2017-04-041-0/+2
| | | | | | | | | | Change-Id: Id42daf684abeeb888155d65eca143150d9c5f5a7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Move widget size policy methods to QStyleHelperJake Petroules2017-03-031-0/+29
|/ | | | | | | | | While they're relatively Mac-specific, conceivably multiple style implementations could use them, and it breaks a tight coupling between QStyleOption and QMacStyle. Change-Id: I5915c519129538a9ac39a34d5cfc3aeb838145d6 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Fix styles compilation with features removed, round 2Paul Olav Tvete2017-01-251-1/+1
| | | | | Change-Id: I8f09a8844e5edc1ad3e3dfd39eca9f3b42c5c828 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-1/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-1/+21
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| | * QStyleHelper::uniqueName(): Improve palette pixmap cache keyFriedemann Kleint2016-11-081-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QDataStream to obtain cache key for a palettes that are different from the default QPalette. This results in unique keys for palettes created from QStyleSheetStyle's render rules. Task-number: QTBUG-56743 Change-Id: Icbfe165f705ef3e1c9e88cfc9dca88ff1d1e81e6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | | fix build with various QT_NO_* definesNick Shaforostoff2016-08-261-0/+2
|/ / | | | | | | | | | | | | Done-with: Andriy Gerasika <andriy.gerasika@gmail.com> Change-Id: I90883a491dbddb005c3d756c339e42285d50e437 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* / Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QMacStyle: Use NSView rendering for some inactive widgets on 10.10Gabriel de Dietrich2014-09-111-0/+10
| | | | | | | | | | | | | | Right now, we use them for inactive non-editable combo box, check box, and radio button only on Yosemite. We keep as much as possible the previous behavior on older versions. In addition, we add a way for QQuickStyleItem to specify the window the item is on. This is currently without effect, since we don't seem to take the inactive window state into account. Task-number: QTBUG-40833 Change-Id: I2fb2a99e6adf1972f881195b79b07ce85a960273 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* QMac/FusionStyle: fix the background color for transient scrollbarsJ-P Nurmi2014-06-301-0/+10
| | | | | | Task-number: QTBUG-39922 Change-Id: I4b313296ae845bc9e116494aa66c577b432b4a67 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cache QAccessibleInterfaces.Frederik Gladhorn2013-04-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since there already is a one-to-one relationship between QObject and QAccessibleInterface it makes little sense to create and destroy the interfaces on each call to queryAccessibleInterface. Add a cache and keep created interfaces around for the lifetime of the corresponding QObject. This changes the memory management rules: accessible interfaces must no longer be deleted. If you get an QAccessibleIntrface pointer that pointer will stay valid as long as the corresponding QObject is not deleted. This also re-enables accessibility for Mac. We limit the range of the IDs so that they are useable for Windows directly. That means we can get rid of the event cache there. This is based on: Iebf2f374916fc70a9dd29e95f45a6444b85f6cee Change-Id: I9fe6531812c0dbc5b41101ac05830a6dd75e13a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Fix license headers stating QtGui for QtWidgets files.Jake Petroules2013-03-191-1/+1
| | | | | Change-Id: I0ca49e3e1f9f603f0b0f7f3553e854b871efe303 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed QT_NO_ACCESSIBILITY build.Bjoern Breitmeyer2013-02-131-10/+2
| | | | | Change-Id: I14229753fc2e3b54da8a285ae9d27201b73e24be Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add QStyleHelper:isInstanceOf()J-P Nurmi2013-01-071-3/+15
| | | | | | | Task-number: QTBUG-28876 Change-Id: I343dff1c47c52e0431c09b6097da09f34e626f54 Reviewed-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Fix some typosSergio Ahumada2012-12-211-1/+1
| | | | | Change-Id: I4e8d9bd8ea66ec810e4f1fbfd8ddbf25c4b3d980 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Fix warnings about unused variables in stylehelper.Friedemann Kleint2012-11-091-0/+3
| | | | | Change-Id: I6f18fff5277a95301a525209b7d45f0d4f182b97 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Make ToolButton work with Macstyle for componentsJens Bache-Wiig2012-11-011-0/+17
| | | | | | | | | | We needed a new helper function for this. The widget cast was breaking desktop components. By using accessible role, we can make it work for both use cases without depending on the widget. Change-Id: Ic854dc45a4e5b7a50c5be701e903d58a4a914ee5 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Fix incorrectly scaled constants on MacJens Bache-Wiig2012-10-161-0/+5
| | | | | | | | | | | | | This fixes several scaled constants on mac that are inherited from commonstyle. (such as toolbutton arrows) It is probably easiest to see when running Windows style on mac. The problem was that the code assumed a default dpi of 96 would be used on all platforms. Change-Id: I83789589009b268dcb1d96629c3ec9e8f968a891 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QDial: Fix crash when singleStep-property is 0.Friedemann Kleint2012-02-161-1/+3
| | | | | | | | | Task-number: QTBUG-23072 Change-Id: I296b46af23420b24fa5460b9660e33bf203ea29f Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> (cherry picked from commit 6d370a19e367d0ccec59db5c34cbe2e3f7cfc586) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>