summaryrefslogtreecommitdiffstats
path: root/src/gui/platform
Commit message (Collapse)AuthorAgeFilesLines
* macOS: include QUrl in QAppleFileIconEngineVolker Hilsheimer11 days1-0/+1
| | | | | | | | | | | | The type is only forward declared via qmetatype.h so far, and building (presumably) only worked due to pre-compiled headers. Amends f036bd0edadf0f59757f4a8fa695706273eb72d2. Fixes: QTBUG-138100 Task-number: QTBUG-134239 Change-Id: Icc39b23cc08a309cba46c1d9ec598a6a0639754f Reviewed-by: Tor Arne Vestbø <[email protected]>
* iOS: implement file icon providerVolker Hilsheimer2025-06-183-1/+120
| | | | | | | | | | | | | | | | | | | | | | | | Move the existing QCocoaFileIconEngine into a separate file in the darwin platform code, from where we can use it from both the cocoa and the iOS theme. Refactor the implementation for macOS to create and retain the NSImage as a member of the engine, and cache the QPixmap when it's requested, reusing it as long as it has the correct size. The iOS implementation is similar, except we need to go through UIDocumentInteractionController to get the icons for the file's URL. Explicitly make sure that we maintain the aspect ratio of the image we get. Augment the iconbrowser manual test to generate temporary files with certain extensions, and include those in the UI, allowing us to test that the icons we get from QAbstractFileIconProvider match the file type. Fixes: QTBUG-134239 Change-Id: I8fb63b3c518a6eb200f5948a1c38fd485e3b1c6d Reviewed-by: Tor Arne Vestbø <[email protected]>
* Apple icon engine: define more symbolsVolker Hilsheimer2025-06-181-2/+3
| | | | | | | | | | | | | | | On iOS, the native icon engine is used for the standard icons of QAbstractFileIconProvider. For File, we map to text-x-generic, and for Network to network-workgroup. Map those to sensible icons from SF Symbols. For the Desktop icon, switch to the same icon that Finder is using for that. Task-number: QTBUG-134239 Pick-to: 6.10 Change-Id: I962809543bcbd1d900c1083ff0bb85b9b7f162f8 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QGnomeTheme, QGtk3Theme: Refactor and Simplify DBus InteractionsMohammadHossein Qanbari2025-05-308-282/+436
| | | | | | | | | | | | | | | | | | | | This patch refactors the DBus integration in both QGnomeTheme and QGtk3Theme to centralize and simplify the portal and settings access logic. Previously, the codebase contained duplicated and scattered DBus logic for querying GNOME/GTK appearance settings, such as color scheme and contrast, which were implemented separately in both QGnomeTheme and QGtk3Theme. The patch introduces a new QGnomePortalInterface class which encapsulates all DBus interactions related to GNOME/GTK appearance settings. The old DBus interface logic is removed from QGtk3Theme and QGnomeTheme, and replaced with calls to the unified QGnomePortalInterface. The update also ensures signal-based updates for theme and appearance changes via the new interface. Change-Id: I5440f7ac00f956b846b18bd890113af0044482f0 Reviewed-by: Oliver Eftevaag <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* Dbus: Enhance process of determining color scheme and contrastMohammadHossein Qanbari2025-05-303-36/+170
| | | | | | | | | | | | | | | | | | | | | | The XDG portal has changed some interfaces since version 2. We already support the changes in version 2. The DBus listener and GNOME theme do not work properly if the machine uses version 1. This patch ensures that the color scheme and contrast preferences work fine with the older version. Regarding contrast preference, the XDG desktop portal introduces the `contrast` interface in version 2. This patch uses the GNOME settings as a fallback method to determine the contrast preference in case the XDG contrast interface is not accessible. The contrast value retrieved from the DBus varies depending on the provider. Regarding the color-scheme interface, the only difference between XDG portal versions 1 and 2 is the method name. The method name to read the color-scheme value from the portal setting changed to `ReadOne` from `Read`. This is also used for reading the contrast value. Change-Id: Id4d81ecf5465bbbab64c41e431a8d4d86e63849a Reviewed-by: Oliver Eftevaag <[email protected]>
* QGnomeTheme: Enhance system color scheme detectionMohammadHossein Qanbari2025-05-292-28/+72
| | | | | | | | | | | | | | | | | | | | | | Previously, QGnomeTheme relied on the theme name to determine the system's color scheme when a "SettingChanged" signal was emitted via dbus. However, this approach overlooked the "color-scheme" property in the signal, which directly provides the updated light/dark mode information. This patch updates QGnomeTheme to use the "color-scheme" property from the dbus signal, ensuring accurate detection of changes in the system's color scheme. The theme name fallback is retained for scenarios where "color-scheme" data is not provided. See also the XDG Desktop Portal documentation: https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html Related to this commit: 4ac89dad78772ce90649b9846efa17319deba28f Task-number: QTBUG-133595 Change-Id: I2c3982fd9871d76184f1b4233d95e7a5e0a34ad1 Reviewed-by: Oliver Eftevaag <[email protected]>
* macOS: Port from deprecated NSAppearance.currentAppearanceTor Arne Vestbø2025-05-221-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the system appearance changes, it will be reflected through NSApp.effectiveAppearance, but NSAppearance.currentAppearance and NSAppearance.currentDrawingAppearance will remain as is for some reason (perhaps as a compatibility for apps that were not ready to handle dark mode). The original way to deal with this was to explicitly set the NSAppearance.currentAppearance to the new effective appearance, which would take effect for the thread from that point on. But this API has been deprecated, most likely because overriding it globally could mess up views or logic that was not prepared for dark mode). The replacement API, NSAppearance performAsCurrentDrawingAppearance is given a block, and will only override NSAppearance.currentAppearance during the block, which isolates it from other fragile components. We generally use NSApp.effectiveAppearance in our own code when resolving dark mode, so we only need to wrap AppKit APIs we use with performAsCurrentDrawingAppearance, including NSColor for our palette, and NSView/NSControl drawing in our styles. For the latter case we introduce a helper that we can also use in the Qt Quick Mac style. This helper can also be the basis of shared style functionality between Widgets and Quick going forward. Fixes: QTBUG-135789 Done-with: Volker Hilsheimer <[email protected]> Change-Id: I4d006b8b1fbbd7ff888da8b903066c183adad188 Reviewed-by: Doris Verria <[email protected]>
* macOS: Use dedicated content CALayer for Metal/Raster contentTor Arne Vestbø2025-04-281-1/+0
| | | | | | | | | | | | | | | | | | By making the content layer a sublayer of the view's root layer (our container layer) we open up the possibility of manually managing the z-order between the content and other sublayers of the view's layer, for example sublayers added as a result of adding NSVisualEffectView child views to our view. [ChangeLog][macOS] Metal and Raster windows no longer render their content directly to the root CALayer of the window's NSView, but to a sublayer of the root layer. This is an implementation detail that should not be relied on, but may affect client code that pokes into the NSView of the QWindow in unsupported ways. To opt out of the new mode, set QT_MAC_NO_CONTAINER_LAYER=1. Change-Id: I7053d7530b6966ed7dd4d1a4d1b7e94754767c57 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* dbusmenu: Skip registration with the registrar on WaylandVlad Zahorodnii2025-04-111-14/+19
| | | | | | | | | | | | | | | | | | The RegisterWindow request expects a window id. The QDBusMenuBar uses the QWindow::winId() property for that. On X11, the winId() returns the XID of the window. On Wayland, the winId() returns an integer that has meaning only to the application, there are no global window ids on Wayland. The menubar should be registered using other means, for example using the kde-appmenu protocol, which QtWayland already does. The QDBusMenuBar can skip synchronously calling the RegisterWindow request on Wayland because the menu will be registered using a different api. Pick-to: 6.9 Change-Id: I6b2968624c5c9ddbdc93807f65eac369dc7a993a Reviewed-by: David Edmundson <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* QGnomeTheme: Prevent leak of QDBusPendingCallWatcherDavid Redondo2025-04-102-3/+4
| | | | | | | | Otherwise the watcher can outlive the theme and the connected lambda calls into the already destroyed theme. Change-Id: I55e7834d1eb806d9f5f1945a4e1016d14b2969b6 Reviewed-by: Axel Spoerl <[email protected]>
* Account for Qt::AA_MacDontSwapCtrlAndMeta when mapping Latin ⌘-shortcutsTor Arne Vestbø2025-04-091-3/+8
| | | | | | | | | | | | | To follow the system we map key events that include ⌘ as if they had been made using a Latin/Roman keyboard layout. However when looking for the ⌘-keymap, we were not taking Qt::AA_MacDontSwapCtrlAndMeta into account, and since the keymap differs whether the attribute is set or not we ended up pulling the Meta-keymap instead. Fixes: QTBUG-133963 Pick-to: 6.9 6.8 Change-Id: I32dd06025e1e1d93f3792952e6ad842efc6245a6 Reviewed-by: Timur Pocheptsov <[email protected]>
* Remove double negation ifdefs in QKdeThemeAxel Spoerl2025-04-072-10/+10
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I186c779f3c4ed36a1fb082993e792e9c28ee20f0 Reviewed-by: Samuli Piippo <[email protected]>
* Remove double negation ifdefs in QGnomethemeAxel Spoerl2025-04-072-14/+14
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I7dd44a6f5496e6f12c16ee1ecef3a004e5580d17 Reviewed-by: Samuli Piippo <[email protected]>
* Remove double negation ifdefs in QGenericUnixThemeAxel Spoerl2025-04-072-12/+12
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: Ifca080594358df0d836db25721b43ad31129cf48 Reviewed-by: Samuli Piippo <[email protected]>
* GnomeTheme: Add missing QtDBus includesMichael Weghorn2025-03-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following build error seen in a local -no-pch Clang 19 build: [1677/16903] Building CXX object qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o FAILED: qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o /usr/bin/ccache /usr/bin/clang++ -DENABLE_PIXMAN_DRAWHELPERS -DGui_EXPORTS -DMD4C_USE_UTF8 -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_GUI_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_LEAN_HEADERS=1 -DQT_MOC_COMPAT -DQT_NO_CAST_TO_ASCII -DQT_NO_CONTEXTLESS_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_NO_STD_FORMAT_SUPPORT -DQT_NO_USING_NAMESPACE -DQT_QPA_DEFAULT_PLATFORM_NAME=\"xcb\" -DQT_STRICT_QLIST_ITERATORS -DQT_USE_NODISCARD_FILE_OPEN -DQT_USE_QSTRINGBUILDER -D_GLIBCXX_ASSERTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/michi/development/git/qt5/qtbase/src/gui/Gui_autogen/include -I/home/michi/development/git/qt5/qtbase/include -I/home/michi/development/git/qt5/qtbase/include/QtGui -I/home/michi/development/git/qt5/qtbase/src/gui -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/VulkanMemoryAllocator -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/D3D12MemoryAllocator -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0/QtGui -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/libmount -I/usr/include/blkid -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/md4c -I/home/michi/development/git/qt5/qtbase/include/QtCore -I/home/michi/development/git/qt5/qtbase/mkspecs/linux-clang -I/home/michi/development/git/qt5/qtbase/src/corelib -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0/QtCore -I/home/michi/development/git/qt5/qtbase/include/QtDBus -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/sysprof-6 -isystem /usr/include/harfbuzz -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -D_GLIBCXX_DEBUG -g -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fPIC -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-copy-with-user-provided-copy -Wno-error=unused-but-set-variable -fcf-protection=full -ftrivial-auto-var-init=pattern -fstack-protector-strong -fno-exceptions -pthread -MD -MT qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o -MF qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o.d -o qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o -c /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:41:32: error: incomplete type 'QDBusMessage' named in nested name specifier 41 | QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), | ^~~~~~~~~~~~~~ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:34:7: note: forward declaration of 'QDBusMessage' 34 | class QDBusMessage; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:41:22: error: variable has incomplete type 'QDBusMessage' 41 | QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), | ^ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:34:7: note: forward declaration of 'QDBusMessage' 34 | class QDBusMessage; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:47:9: error: no template named 'QDBusReply' 47 | QDBusReply<QVariant> reply = dbus.call(message); | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:9: error: unknown type name 'QDBusPendingCallWatcher'; did you mean 'QDBusPendingCall'? 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ | QDBusPendingCall /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: 'QDBusPendingCall' declared here 35 | class QDBusPendingCall; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:48: error: unknown type name 'QDBusPendingCallWatcher'; did you mean 'QDBusPendingCall'? 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ | QDBusPendingCall /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: 'QDBusPendingCall' declared here 35 | class QDBusPendingCall; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:48: error: allocation of incomplete type 'QDBusPendingCall' 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: forward declaration of 'QDBusPendingCall' 35 | class QDBusPendingCall; ... Change-Id: I40bc994f7af3dd5a314d051018991d81087844b4 Reviewed-by: Axel Spoerl <[email protected]>
* GnomeTheme: read the initial color-scheme value from dbusOliver Eftevaag2025-03-281-18/+39
| | | | | | | | | | | | | | The initial color-scheme value was never initialized, and would thus, always be 'Unknown', until the user changes the color scheme in the system settings. The xdg settings portal method ReadAll is currently omitting the contrast setting from the reply. Because of this, two separate dbus calls are necessary to get both the initial color-scheme and contrast setting. Change-Id: Ie32371efd830e19727922efd2c9c32595395d11a Reviewed-by: Axel Spoerl <[email protected]>
* Add virtual member QPlatformTheme::contrastPreference()Oliver Eftevaag2025-03-285-12/+70
| | | | | | | | | | | | | | | | | This function can be overridden by individual platform themes, in order to read contrast settings from the platform's system settings, and report the result back to Qt. This information is relevant for our styles, and can be used to determine color palette values, and additional elements like outline thickness for controls/widgets. Currently only the Windows, macOS, Gnome and Flatpak themes support this feature. Task-number: QTBUG-133595 Change-Id: I3aff519aa7f07c8b2fdcc1e7fb35ec719ab8efcc Reviewed-by: Tor Arne Vestbø <[email protected]>
* QDesktopUnixServices: don't leak the QDBusPendingCallWatcherMarc Mutz2025-03-282-3/+6
| | | | | | | | | | | | | | | | | | | | | When, like in tst_QApplication::qtbug_103611(), a QApplication object is destroyed without calling exec(), then QDesktopUnixServices leaked its QDBusPendingCallWatcher, because the connection to the slot that would deleteLater() the watcher was disconnected, and the watcher had no QObject parent that would otherwise reap it. Fix by actually deleting the watcher in ~QDesktopUnixServices(), if it still exists (which implies disconnecting, of course). This makes tst_QApplication asan-clean on Linux/X11 (was: "75466 bytes leaked in 965 allocations"). Amends de609d84b9cee4a481d1718c00b09105d8c2ae69. Pick-to: 6.9 6.8 6.5 Change-Id: I28a08abdb1be65a8746702ad304282de4e1100d7 Reviewed-by: Liang Qi <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* QGenericUnixTheme: Fix build w/o xcb and waylandAxel Spoerl2025-03-271-3/+4
| | | | | | | | | Add ifdef condition to consider QKdeTheme only if Qt is built either with wayland or xcb. Fixes: QTBUG-135204 Change-Id: I27941bf6bd576c1532ac23992c1c94f9ace53683 Reviewed-by: Samuli Piippo <[email protected]>
* Correctly name pragma macro in qgenericunixtheme_p.hAxel Spoerl2025-03-251-3/+3
| | | | | | | | | | | It was forgotten to rename the macro from plural to singular. Fix it. Amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Task-number: QTBUG-132929 Change-Id: I76def400324ae47e61528e62f8589c05c5b3e4e2 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QKdeTheme: de-inline dtor; make ctor explicitMarc Mutz2025-03-242-1/+5
| | | | | | | | | | | | | | | | | | | | 1/ A QStringList and an int are not a faithful representation of a KDE Theme, so the ctor should be explicit. Make it so™. 2/ As a polymorphic class, the (undeclared, therefore inline) dtor may cause weak vtables to be emitted, with all the bad side-effects described in the docs of -Wweak-vtable and QTBUG-45582. Mark the dtor out-of-line in the usual way (= default'ing, but in the .cpp file). Amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Task-number: QTBUG-45582 Task-number: QTBUG-132929 Task-number: QTBUG-135037 Change-Id: Ie0c14e60d76d2205c2025598ac31a917dbf870b1 Reviewed-by: Axel Spoerl <[email protected]>
* QKdeTheme: Don't leak resources on shutdownFabian Kosmale2025-03-211-0/+1
| | | | | | | | | | | | The theme stores an array of pointers to allocated QFonts, which need to be freed. While this is not a "hard" leak (the OS will clean up the memory on shutdown, and QKdeTheme lives as long as the application), it creates ASAN warnings, which distract from more severe issues. Change-Id: Iaa57138e5273c300c616ba85340283f18a267b09 Reviewed-by: Piotr Wierciński <[email protected]>
* QDBusListener: remove ChangeSignal's defaut ctorMarc Mutz2025-03-212-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity complained that the default ctor didn't initialize its two members. This is true, and it even remains true if the user of the type explicitly asks for value-initialization (ChangeSignal s = {}) as opposed to default-construction (ChangeSignal s;). Remove the default ctor as the minimally-possible fix. It was only needed because of a call to QFlatMap::value(1-arg), which, incidentally, constitutes a double-lookup, because it is following a contains() call. Replacing that combo with find() and it.value() avoids the double-lookup and removes the need for the type to be default-constructible. Amends 0328e4297e339de8a2acd84979c667936f6fadf8. Coverity picked this up as a new issue following 53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another CID for this for the same code in the old location, but my Coverity search-foo is insufficient to find the corresponding CID, without undue effort, so I didn't try. Coverity-Id: 478089 Pick-to: 6.9 6.8 6.5 Change-Id: I912bf2af343b98fe62faf2d4bf8a6d1f385593e8 Reviewed-by: Giuseppe D'Angelo <[email protected]> Reviewed-by: Axel Spoerl <[email protected]>
* QGenericUnixTheme: de-pessimise xdgFileIcon()Marc Mutz2025-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity complained about a missing std::move() on the return in L270, but adding that would, of course, not help, because the QIcon object being returned is const. If NRVO would (at least theoretically) kick in, this would be harmless, but NRVO can't kick in, because it's unknown at the time of construction whether this will be the object that end up being returned to the caller, so the compiler will have to copy the object into the return value when that decision is made (post the isNull() check). By not making the object const, we enable it to be moved instead, which is what Coverity originally wanted us to do. Amends 46ea82188e3678c5b7a2338d536da6c621822f2f. Coverity picked this up as a new issue following 53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another CID for this for the same code in the old location, but my Coverity search-foo is insufficient to find the corresponding CID, without undue effort, so I didn't try. Not picking back, as this is a "low impact" issue, according to Coverity (and me). Coverity-Id: 478087 Change-Id: I7f36cdbe83525a23ea0dfa27157091dbdf73a28b Reviewed-by: Friedemann Kleint <[email protected]>
* Clean up QKdeThemeAxel Spoerl2025-03-192-62/+68
| | | | | | | | | | | | | | | | QKdeTheme used a ResourceHelper class to implement std::array of QFont and QPalette points. The latter has never been used: Only the first row was polulated with a KDE system palette. All other rows remained nullptr. Remove ResourceHelper. Make the font array a member of QKdeThemePrivate. Use a QPalette pointer member of QKdeThemePrivate instead of the obsolete array a member of QKdeThemePrivate. Task-number: QTBUG-132929 Change-Id: Ia8254182b2b824363253e2bfc71648cdfe55a403 Reviewed-by: Piotr Wierciński <[email protected]>
* Re-implement QPlatformTheme::requestColorScheme() in QKdeThemeAxel Spoerl2025-03-172-13/+46
| | | | | | | | | | | | | | | | | | | QKdeTheme remained unresponsive to programmatic color scheme changes, after QPlatformTheme::requestColorScheme() had been introduced. Add functionality to QKdeTheme. Fall back to qt_fusion_palette, when the requested color scheme isn't supported by the current KDE theme (e.g. Adwaita-dark doesn't support light mode). Functionality has to be manually tested with the widget gallery example. Task-number: QTBUG-132929 Fixes: QTBUG-134023 Change-Id: I37e56cc36803dcb8527a897ddcada29b322a5ada Reviewed-by: Santhosh Kumar <[email protected]> Reviewed-by: Piotr Wierciński <[email protected]>
* QGenericUnixTheme: Fix build, adding missing #includesThiago Macieira2025-03-123-0/+6
| | | | | | | | | | | | qdbuslistener.cpp:105:5: error: ‘QJsonParseError’ was not declared in this scope qgenericunixtheme.cpp:247:21: error: invalid use of incomplete type ‘class QDBusConnectionInterface’ qkdetheme.cpp:91:109: error: ‘QSettings’ was not declared in this scope; did you mean ‘QString’? qkdetheme.cpp:712:30: error: ‘QStandardPaths’ has not been declared Probably amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Change-Id: I673a2fa3f34c162d4d76fffdf160ed8a7af1fc66 Reviewed-by: Joerg Bornemann <[email protected]>
* Refactor qgeneericunixthemes_p.h/cppAxel Spoerl2025-03-119-933/+1090
| | | | | | | | | | | | | | | Header and implementation file of QGenericUnixTheme contained several helper functions and classes. It also contained the implementation of QGnomeTheme and QKdeTheme, both of which are not generic. Split qgenericunixthemes_p.h/cpp up into separate files. Group all helpers as static member functions in QGenericUnixTheme. Inherit QGnomeTheme and QKdeTheme from QGenericUnixTheme. Task-number: QTBUG-132929 Change-Id: Idfa6198a2b7f669edd009dc165375a9b2960fcad Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Piotr Wierciński <[email protected]>
* QGenericUnixTheme: reduce unnecessary relocationsMarc Mutz2025-03-061-32/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of static constexpr QL1SV objects (which force the compiler to allocate storage for them and therefore cause relocations), use inline functions or mere automatic objects (which don't). We'd normally call the inline functions fooKey() { return "foo"_L1; }, but since one of them "foo"s ends with "Key" already, put them into a namespace instead, the name of which is taken from the comment that used to introduce the static constexpr objects in the old code. For the QL1SVs in the ctor: port them to QStringLiterals, because their only use is to pass them to a function taking const QString&, so this saves allocations. There never was a need to make these objects static, as constexpr would be enough to force the compiler to constant-fold them. Unlike my earlier advice about how to create an empty QString most efficiently, don't keep using ""_L1, use u""_s. This is because there's no shared empty QString in Qt 6 anymore. It might still make sense to add a more light-weight way to create an empty QString, esp. one which is not referencing local data, but QString::_empty, to extend the lifetime of the payload until QtCore unload time, but that is outside the scope of the current patch. Difference: qgenericunixthemes.cpp.o: - 0000000000000000 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::signal - 0000000000000040 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::interface - 0000000000000080 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::path 00000000000000c0 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::service 0000000000000000 l d .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000000 .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000000 l d .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000000 .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000000 l d .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000000 .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000000 l d .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 0000000000000000 .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 0000000000000000 l d .data.rel.ro.local 0000000000000000 .data.rel.ro.local - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000000 l d .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000000 .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000000 u O .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 00000000000000d8 QMetaSequence::MetaSequence<QList<Qt::Key> >::value 0000000000000000 w O .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000020 .hidden vtable for QGenericUnixThemePrivate 0000000000000000 w O .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000020 .hidden vtable for QGnomeThemePrivate 0000000000000000 w O .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000020 .hidden vtable for QKdeThemePrivate - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_root - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_signals - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusLocation - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusKey - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_provider - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_setting - 0000000000000000 u O .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000070 .hidden QtPrivate::QMetaTypeInterfaceWrapper<void>::metaType RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV24QGenericUnixThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV16QKdeThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV18QGnomeThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE]: See https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343 for the script to generate this output. See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why we care. Amends 0328e4297e339de8a2acd84979c667936f6fadf8. Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-100536 Change-Id: I1fd65e3ed5bceeb2a49141834dbd12f4bf42cc8c Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Axel Spoerl <[email protected]>
* Add logging category for platform servicesDavid Redondo2025-02-251-9/+5
| | | | | | | Rather than being hidden behind a compile time flag or uncategorized Change-Id: I3bc1781351220441134fb9815644e905273a1e40 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add Qt::Key_KeyboardKai Uwe Broulik2025-02-171-0/+1
| | | | | | | | | Adds a "media key" for the "Keyboard settings" key found on some laptops. Change-Id: Id041a551844f095f1d7d2fd25d37346da30407a3 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: David Edmundson <[email protected]>
* QDesktopUnixServices: Fix #endif commentDavid Redondo2025-01-301-1/+1
| | | | | | | | So it doesn't confuse me or anyone else again Pick-to: 6.9 Change-Id: I8ad5d4cb1b00e0edaffa90ed67e30246211e1a97 Reviewed-by: Liang Qi <[email protected]>
* Platform: unix - avoid modifying the environmentTim Blechmann2025-01-291-7/+16
| | | | | | | | | | | | | | Modifying the process environment can cause crashes in application code that accesses the environment via non-qt functions on worker threads. When launching a process, we can avoid modifying the environment of the caller by using QProcess with setEnvironment. The codepaths without QProcess support is still prone to these issues and could potentially be improved via execve Task-number: QTBUG-129222 Pick-to: 6.8 6.9 Change-Id: I4e2d93abaa0e392b341041faaae0ffd11e225bcb Reviewed-by: Tor Arne Vestbø <[email protected]>
* QDesktopUnixServices: avoid to call virtual function in constructorLiang Qi2025-01-231-1/+1
| | | | | | | | This amends 1969b1a90a79dad049694bd1540f8627d5f26875 . Pick-to: 6.9 6.8 6.5 Change-Id: I1be4e229d531f8a91e1ad3133a5b62784d18bb41 Reviewed-by: Edward Welbourne <[email protected]>
* platforms: rename QGenericUnixServices to QDesktopUnixServicesLiang Qi2025-01-213-28/+28
| | | | | | | | | | The implementation follows XDG Desktop Portal mostly, and is for desktop, not generic unix. Task-number: QTBUG-130884 Pick-to: 6.9 Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f Reviewed-by: Tor Arne Vestbø <[email protected]>
* QGenericUnixServices: avoid dbus calls on non xdg envsLiang Qi2025-01-211-0/+3
| | | | | | | Fixes: QTBUG-130884 Pick-to: 6.9 6.8 6.5 Change-Id: I2525293f776676cda63e61c3c5093045dbafcf38 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Fix the unsupported Q_UNREACHABLE_RETURN statement in constexpr functionsAlexey Edelev2025-01-171-3/+18
| | | | | | | | | | | | | | | GCC 8.x does not treat __builtin_unreachable() as constexpr and disallows using the Q_UNREACHABLE_RETURN macro. Guard the statements with the respective checks. Amends b0b34c56a99130bfc9c82cb006653ce6b8f0516e Pick-to: 6.8 6.9 Task-number: QTBUG-125285 Fixes: QTBUG-132804 Change-Id: I88cdbe3bae1a336edc255e3e93e8d948bde253da Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Marc Mutz <[email protected]>
* Replace qgetenv() calls converted to QString with qEnvironmentVariable()Thiago Macieira2025-01-012-5/+5
| | | | | | | | It's slightly more efficient. Pick-to: 6.9 Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d Reviewed-by: Ahmad Samir <[email protected]>
* Apple: Use automatic rendering mode for icon engineTor Arne Vestbø2024-12-201-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | When requesting symbol icons the OS automatically chooses a rendering mode per icon. Most icons use the monochrome rendering mode by default, but some of them use the hierarchical. We don't want to override this choice by always using hierarchical, as that doesn't match the look of most icons in the system and may be surprising to the user. We still want to support tinted icons, based on the QPalette. For iOS this is easy via [UIImage withTintColor:] but for macOS we have to do an extra render pass. Unfortunately we can't use configurationWithPaletteColors with a single color, as for the hierarchical icons this will produce a different looking icon than if we tint the entire icon. [ChangeLog][macOS/iOS] The Apple icon engine, used for theme icons on macOS and iOS, will now use the default rendering mode for icons, typically monochrome, instead of always using hierarchical icons. Pick-to: 6.9 6.8 Change-Id: I9e66d848222e8ed0f7f20897454f27446bf0fd81 Reviewed-by: Volker Hilsheimer <[email protected]>
* Guard the usages of QPlatformIntegration::services()Liang Qi2024-11-251-1/+2
| | | | | | | Task-number: QTBUG-130884 Pick-to: 6.8 6.5 Change-Id: I6c8060ce8b7a4e525c46e2e1fec227f46fe8c4d6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Introduce VxKeyboard input pluginMichał Łoś2024-10-301-0/+15
| | | | | | | | | | | | | | | | | | Introduce VxKeyboard plugin which is responsible for handling keyboard on VxWorks OS. Due to the fact that VxWorks is using its own, not fully compatible with Unix/Linux implementation of libevdev, it requires it's own plugin. This way, changes in evdev plugins will not be blocked/complicated by VxWorks stalled implementation. Implement VxKeyboard plugin and its backend, adding support for it in eglfs. This is a preparatory change, as there is no keyboard detection for VxWorks yet. Task-number: QTBUG-115777 Change-Id: I4ca5729c6f210fb7477bc31371a137071e12fdad Reviewed-by: Volker Hilsheimer <[email protected]>
* macOS: Release main thread transaction block as soon as we're done with itTor Arne Vestbø2024-10-211-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | Since 9122d826d25b9afab230771dc86e1ff6158e6cbc we're presenting drawables on the main thread, even those produced on the Qt Quick render thread, if we are part of a displayLayer call, as we're then presenting the Metal layer within a Core Animation transaction. We do this by assigning a block to the layer, that we then call on the main thread in displayLayer. This block retains the drawable, so when we're done calling the block we need to dispose of the block as soon as possible, to avoid stalls due to running out of drawables. To improve on this we add a local auto-release pool around the clearing of the main thread transaction block. In the case of displayLayer we need to take care to also include the referencing of the transaction block in the auto-release pool, as that makes a separate auto-released copy of the block (and hence also the drawable). Pick-to: 6.8 Task-number: QTBUG-129839 Change-Id: I7663862c63977adab7b1f22a136416c8bc910c6e Reviewed-by: Laszlo Agocs <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* xcb: Report location of DBus menubar on window propertiesDavid Edmundson2024-10-104-7/+36
| | | | | | | | | | | | | | | KDE extended the DBus menubar protocol to report the DBus service and path on the window itself, this makes looking it up easier than going through a broker. On Qt5 this worked because we handled the entire DBus menu from scratch in KDE's own platformtheme, but given Qt now has direct dbusmenu bar support it makes sense to have the remaining reporting side all in one place. Change-Id: I78044992fa1840c40a66384033ed790ce0cd7f96 Task-number: QTBUG-116352 Reviewed-by: Liang Qi <[email protected]>
* QChar: disable implicit conversions on most ctor argumentsMarc Mutz2024-10-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QChar ctor overload set is a mess, as it allows implicit conversions from other types. E.g. char32_t is using one of the int/uint overloads. Ditto wchar_t on Unix. Disallow implicit conversions by making all¹ ctors templates and constraining them on just the types we want. ¹ except the (uchar, uchar) one This also removes the need to maintain the SFINAE-unfriendly =delete'd char/uchar ctors in QT_NO_CAST_FROM_ASCII builds. Needed to fix a few QChar(Qt::Key) users in Apple code. [ChangeLog][QtCore][Potentially Source-Incompatible Changes] QChar constructors no longer perform implicit conversions. They only accept the exact types listed in the documentation. A backwards-compatible fix is to explicitly cast to one of the explicitly-supported argument types. [ChangeLog][QtCore][QChar] The constructors no longer perform implicit conversions. They only accept the exact types listed in the documentation. A backwards-compatible fix is to cast to one of the explicitly-supported argument types. Change-Id: I5db96948b4724e96c6a0ede9a8ff5cae3bfa3280 Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* De-inline dtors of QAbstractEventDispatcherPrivate subclassesMarc Mutz2024-10-082-0/+4
| | | | | | | | | | | ... pinning the vtables to a single TU each, instead of duplicating them for every user. Pick-to: 6.8 Task-number: QTBUG-45582 Change-Id: I3b7bce14567dc8be89795a48f6871eb24fe908aa Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Lena Biliaieva <[email protected]>
* QGenericUnixServices: properly disconnect signals in dtorChristian Ehrlicher2024-08-302-1/+14
| | | | | | | | | | | | Since QGenericUnixServices does not derive from QObject, the connection to QDBusPendingCallWatcher made in the ctor might outlive the lifetime of QGenericUnixServices. Fix it by explicitly disconnecting it in the dtor. Fixes: QTBUG-125239 Pick-to: 6.8 6.7 6.5 Change-Id: I5fac4fd5831b2dde16b3d7b479a8ee616bfb7e3a Reviewed-by: Thiago Macieira <[email protected]>
* QMacMimeRtfText: Remove stray newline when converting RTF to HTMLTor Arne Vestbø2024-08-131-1/+6
| | | | | | | | | | | | | | | | | | NSAttributedString wrongly inserts a newline at the end of the string when generating HTML from RTF. The rules for HTML parsing specify that this newline, after the closing </html> tag, should be treated the same way as if it had been part of the body. - https://html.spec.whatwg.org/multipage/syntax.html#start-tags - https://html.spec.whatwg.org/multipage/parsing.html#the-after-after-body-insertion-mode This results in an additional space character if the HTML is converted to a QTextDocument by QTextHtmlParser, for example when inserting text from another application via the clipboard or drag-and-drop. Pick-to: 6.8 6.5 6.2 5.15 Change-Id: If17cfcdc9ad5452e7b516fc6b50d834bd5184e23 Reviewed-by: Michael Brüning <[email protected]>
* Apple: cache all pixmaps from the icon engineVolker Hilsheimer2024-08-032-18/+32
| | | | | | | | | | | | | | | | | | So far we have only cached the most recently requested pixmap, under the assumption that this is the one usually requested several times in a row. However, our menu integration requests the pixmaps for all available sizes when populating the native menu item with an NSImage. Not caching the pixmaps for all sizes results in repeated rendering of the image, which significantly slows down the opening of native menus e.g. using Qt Quick's labs.platform Menu. Use a per-icon-engine cache for the pixmaps, with a cache key that is a struct holding the mode, state, size, and scale factor. Pick-to: 6.8 6.7 Fixes: QTBUG-127614 Change-Id: Ie13cae8c69a8ee979907d4b9ea01bcdd89dd585b Reviewed-by: Tor Arne Vestbø <[email protected]>
* Icon engines: don't paint on a null-pixmapVolker Hilsheimer2024-07-311-3/+5
| | | | | | | | | | | If the pixmap created is null (perhaps because the size is null), then don't paint into it. It might crash as we might end up with an invalid device context. Task-number: QTBUG-127085 Pick-to: 6.8 6.7 Change-Id: I03b3beabe02f150a2970013c15842369d3a27596 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QGUTheme: add Pantheon to the list of GTK based desktop environmentsLiang Qi2024-07-121-0/+1
| | | | | | | | | | Pantheon is the desktop environment of elementary OS. It is written in Vala, using GTK 3 and Granite. Fixes: QTBUG-52292 Pick-to: 6.8 6.7 6.5 6.2 5.15 Change-Id: I01140d8a2f3b0f2736515c1279e5d3150a0c313d Reviewed-by: Axel Spoerl <[email protected]>