summaryrefslogtreecommitdiffstats
path: root/src/gui/image
Commit message (Collapse)AuthorAgeFilesLines
...
* qplatformpixmap: use rvalue overloads moreAnton Kudryavtsev2023-09-191-7/+7
| | | | | Change-Id: Ie5b6f6d6ffbcc0bca7a1464ad2eadbf47a707abb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Rework QIcon theme documentationTor Arne Vestbø2023-09-081-55/+82
| | | | | | | | | Generalized the documentation, and clarified behaviors, in preparation for adding additional platform icon engines. Pick-to: 6.6 Change-Id: I4a694dc2cedd08cb195c738048c7dae72cbfe867 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qt_getImageTextFromDescription: use tokenize instead of splitAnton Kudryavtsev2023-09-061-2/+1
| | | | | | | to avoid creation of tmp list Change-Id: I53917263fe9e904596ccc5af6a72bb3d906b21dc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qbmphandler: use const moreAnton Kudryavtsev2023-09-061-1/+1
| | | | | | | to avoid implicit detach Change-Id: Ic07746b2715a2a804f20db772e63d3cb389ee581 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove redundant QPair includesAhmad Samir2023-09-061-1/+0
| | | | | | | | Nothing in those files uses QPair; and a local build finished fine without them. Task-number: QTBUG-115841 Change-Id: I669cfecaa9129bce6b31e464826287f138b159db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qplatformpixmap: use rvalue overload moreAnton Kudryavtsev2023-09-041-2/+2
| | | | | | | to reuse internal buffers Change-Id: I7cfd6b599912cc38f796356197748f97da3eb47d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* qimagereaderwriterhelpers: deduplicate literalAnton Kudryavtsev2023-09-021-3/+5
| | | | | | | Extract literal to constexpr function and reuse it Change-Id: I0a1ec24cb67e413222c826f2f26d78e16459ff8c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* imageFormatsForMimeType: port to QBAVAnton Kudryavtsev2023-09-012-3/+3
| | | | | | | to reduce allocations Change-Id: Ic48616d0627cb1dfee5f844bee263a59a430d9ba Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Delete links to removed examplesAndreas Eliasson2023-08-183-5/+3
| | | | | | | | | | The examples have been removed as part of the examples revamp project. This patch resolves a number of qdoc warnings. Pick-to: 6.6 6.5 Change-Id: Ie3d2f5637136c631d7e9f7a8ffd93baea52f77d8 Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert "QIconLoader: clear cache when the key becomes invalid"Volker Hilsheimer2023-08-171-2/+1
| | | | | | | | | | | | | | This reverts commit e2f0495e7efffefe927e43b26fa3a3a610aa003f. Cleaning the cache is not be needed, as the invalidated key will make sure that the cached QThemeIconEngine engine will not reuse the previous engine to generate the pixmap, but request a new engine from QPA. This way, a new pixmap will be generated also if system settings change that will influence the pixmap generated by the platform engine. Pick-to: 6.6 Change-Id: I9632c37c4ec86fe46acb701ec69a7868b3434322 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIconLoader: add some more debugging helpVolker Hilsheimer2023-07-211-4/+5
| | | | | | | | | | As a drive-by, re-use the result from the first QFile::exists check. Pick-to: 6.6 Change-Id: I6b36b165ba3d1f82c9b4be18d44a671f71e8507e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QIconLoader: reset search paths when theme name is clearedVolker Hilsheimer2023-07-211-0/+6
| | | | | | | | | | | When we reset the theme so that icons should be provided by the system theme, then reset the search paths to the system-provided paths as well. Otherwise we'll keep looking for the system theme in user-provided search paths, which can't work. Pick-to: 6.6 Change-Id: I10bcb404db9924e038f6fdc8970e53bbb69ac7d1 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QIconLoader: clear cache when the key becomes invalidVolker Hilsheimer2023-07-211-1/+2
| | | | | | Pick-to: 6.6 Change-Id: I6f2745715b902ccbc87d78b1c90f6883cfdd76ae Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QIcon: use fallback also with platform icon engineVolker Hilsheimer2023-07-211-4/+8
| | | | | | | | | | | | | Amends a452e2254644ffbed289fdf051eaf41d7e6a3b0d. No new tests, existing tests fails when QPlatformTheme returns a QIconEngine implementation that provides the tested icons. However, the existing test fails when the platform icon engine provides and address-book-new icon, and depends on the order of test functions, as the name() test function modifies the global theme name and search path. Fix those issues in the test. Pick-to: 6.6 Change-Id: Ie1c1d14f08fad5e906296bab662df5cfacdbbf07 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QPixmapCache: assert that the key is invalid if we failed to insertVolker Hilsheimer2023-07-101-0/+1
| | | | | | | | | | | QCache::insert on failure destroys the QPixmapCacheEntry, which calls releaseKey(), which invalidates the key. That's hard to follow, so add an assert to make it more explicit and prevent future errors. Pick-to: 6.6 Change-Id: I9c062ef5a6e34c783c064330c914ce4f9a3f9984 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QPixmapCache: ignore insertion or searches with empty keyVolker Hilsheimer2023-07-031-3/+3
| | | | | | | | | | | | | | | | | When a key for a pixmap cannot be generated, then the only meaningful way to indicate that failure is to return an empty string. Instead of plastering checks for the generated key being empty all over our styling code, reject attempts to insert a pixmap with an empty key string in the QPixmapCache, and fail to find immediately. Such a key makes no sense either way. [ChangeLog][Gui][QPixmapCache] Trying to insert or find a pixmap with an empty key string now always fails immediately. Pick-to: 6.6 Task-number: QTBUG-114473 Change-Id: I15bf8064ac7a4fe715722d98f2df2b8608809c7f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Mark QThemeIconEngine, QIconLoaderEngine classes as \internalTopi Reinio2023-06-211-0/+4
| | | | | | | | | Fixes QDoc warning: 'Documentation for class has no \inmodule command' for both classes. Pick-to: 6.6 Change-Id: I59eb5f5b935ea30f756d655158a06f390d2ebc54 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPixmapCache: Move qHash(Key) from _p.h to public headerMarc Mutz2023-06-213-5/+12
| | | | | | | | | | | | | | | | ... and make it a hidden friend. This avoids ODR violations when, because they can't use ours (private, and not exported), users try to produce their own version of qHash(Key). [ChangeLog][QtGui][QPixmapCache] Made the qHash() overload for QPixmapCache::Key public (was: private) API. Pick-to: 6.6 Change-Id: I324ed001c0ae0a251ac2e1d04713013452ffff9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPixmapCache: don't leak QString keys of evicted pixmapMarc Mutz2023-06-202-28/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's not a real leak in that the string data is being freed on program exit (or, more recently, QPixmapCache::clear()), but it can lead to lots of memory being bound for much longer than expected when users put in new QString keys without attempting to retrive them again. It can also lead to problems with QStringLiterals lingering around until after their underlying data has been freed. A bug in the Fusion style, generating new string keys for identical state, exposed this misbehavior, and one way to fix the resulting issue for the user is to make sure that QPixmapCache doesn't leak QString keys. The Fusion style issue with generating non-repeating keys for use with QPixmapCache should also be fixed, eventually, but this patch relegates that to an optimization issue (the caching is effectively non-existent), the resource exhaustion is gone now. The issue exists because the QString keys are internally mapped to QPixmapCache::Key's by way of a QHash<QString, Key> cacheKeys data structure. When the QCache, indexed by Key, not QString, decides to evict an entry, the Key is invalidated, but no-one was removing the corresponding entry from cacheKeys. So make the existing releaseKey(), used to invalidate copies of Keys referring to evicted pixmaps, do that, now. So as not to have to scan the whole cacheKeys QHash for the right Key, store the QString key, if any, inside the Key, so releaseKey() can retrieve it and use it for O(1) erasure from cacheKey. This allows removing the previous work-around in clear() (6ab0d25a09f5aeb7a5a062f7fd44e95ca761e21e), greatly simplify object(QString), and requires to rewrite all code that holds iterators or references into cacheKeys over an insertion into or removal from the QCache. Two (insert() and remove()) have already been done in prequel commits, so only flushDetachedPixmaps() was left. Fixes: QTBUG-112200 Pick-to: 6.6 6.5 Change-Id: Ic93b0ed388ae963267fe242b491c6c941d146b99 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPixmapCache: DRY insert()Marc Mutz2023-06-201-16/+7
| | | | | | | | | | | | Implement insert(QString, QPixmap) in terms of insert(QPixmap) to avoid duplicating code and to separate concerns: insert(QString, QPixmap) is now only dealing with the cacheKeys, insert(QPixmap) is only concerned with the Key-based lookup. Task-number: QTBUG-112200 Pick-to: 6.6 6.5 6.2 Change-Id: I30394da43a5e93b7bd41ef9ce9c7aea044523c30 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPixmapCache: simplify remove(QString)Marc Mutz2023-06-201-7/+2
| | | | | | | | | | | | | | The previous code used `cacheKey` as the name of an iterator, which made the code hard to understand. Instead of renaming that to the more idiomatic `it`, use QHash::take() to get an actual `cacheKey` back, and then delegate to QPMCache::remove(QPixmapCache::Key) for the actual removal. Pick-to: 6.6 6.5 6.2 Task-number: QTBUG-112200 Change-Id: I9311c19f12a05cad694702672f17ae19ba339b04 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcon::fromTheme(): Always consult "hicolor" theme lastTor Arne Vestbø2023-06-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Freedesktop Icon Theme Specification [1] describes that, if a theme does not specify anything for its 'Inherits' key, "implementations are required to add the 'hicolor' theme to the inheritance tree. An implementation may optionally add other default themes in between the last specified theme and the hicolor theme." And later, when describing the lookup algorithm, that "The lookup is done first in the current theme, and then recursively in each of the current theme's parents, and finally in the default theme called 'hicolor' (implementations may add more default themes before 'hicolor', but 'hicolor' must be last)". But it doesn't explicitly describe the behavior when a theme does specify a list of inherited themes via the 'Inherits' key, and this list explicitly includes 'hicolor'. In that case, our custom fallback theme, which we inject after the theme's explicit parents, will be prioritized after 'hicolor'. As it's likely that the theme author added 'hicolor' to their parent list to ensure that 'hicolor' is at some point consulted, but didn't intent it to be priorized, and that the spec puts focus on 'hicolor' being last, it seems reasonable that we can move the 'hicolor' theme to the end of the fallback list, and as a result always prioritize fallbackThemeName() over 'hicolor'. [ChangeLog][QtGui][QIcon] The 'hicolor' theme will now always be prioritized last when looking up fallback themes, even if explicitly declared as a theme parent in a theme. [1] https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html Pick-to: 6.6 Change-Id: I76538e4e7e9e395f9e5a38e704c60fb6b9688885 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Consult QIcon::fallbackThemeName() even when theme name is emptyTor Arne Vestbø2023-06-181-7/+8
| | | | | | | | | | | | We still need to consult fallbackThemeName() when computing the parent list for an individual theme, as the Freedesktop Theme Icon spec mandates that the "hicolor" theme comes last, but we no longer need to do explicit fallback to fallbackThemeName() if a theme is not found. Pick-to: 6.5 6.6 Change-Id: I6c0b5a45d8258c5b6eaa761402944a735b1606ba Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Consult QIcon::fallbackSearchPaths() even when theme name is emptyTor Arne Vestbø2023-06-182-2/+13
| | | | | | | | | | | The use of fallback icons should not depend on a theme being set. [ChangeLog][QtGui][QIcon] QIcon::fallbackSearchPaths() will now be consulted for fallback icons even if the current theme name is empty. Pick-to: 6.5 6.6 Change-Id: Ia8d14062de7c53601fd9dac30f87a9e672aa2207 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Consult QIcon::fallbackThemeName() even for themes with explicit parentsTor Arne Vestbø2023-06-183-12/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We would previously only use the fallback theme for themes that did not exist, or for themes that did not declare any parent theme. We now unconditionally use the fallback theme, even for themes that declare their own parent themes, so that a QIcon::fromTheme("foo") that doesn't exist in the current theme, nor any of its parents, nor in "hicolor", will still be looked up in the fallback theme. The reason this seemed to work in the existing tests was because our test themes inherit system themes such as crystalsvg and gnome, and we didn't provide a hicolor theme. Any of these themes missing would lead us into the code path where we use the fallback theme for a missing theme, masking that fact that we had not added the fallback theme to the list of fallbacks for the theme that had explicit parents declared. The logic has been moved out of the theme parsing and into an accessor in QIconTheme, so that we're not caching the fallback theme lookup. [ChangeLog][QtGui][QIcon] QIcon::fallbackThemeName() will now be used as fallback even for themes that declare a parent theme. Pick-to: 6.5 6.6 Change-Id: Ib0ce1dfe97030f23893460ed624073a719a3ebd1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Invalidate QIconLoader cache when setting fallback themeTor Arne Vestbø2023-06-181-0/+1
| | | | | | | | | | Setting a fallback theme will affect the lookup strategy, so we need to invalidate earlier lookups. Pick-to: 6.5 6.6 Change-Id: I962245ddb3a20b7798d5ce831ed8a369b0ab76b4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Skip clearing the QIcon cache on QIconLoader theme key changeTor Arne Vestbø2023-06-171-2/+3
| | | | | | | | | | QThemeIconEngine takes care of creating a new icon engine when the icon theme key changes, so we don't need to invalidate the entire QIcon cache. Pick-to: 6.6 Change-Id: Ie3bca00a9146d1f429b2a6f8ab0b39e15834d158 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Unify QIcon theme icon loading and cache invalidationTor Arne Vestbø2023-06-175-46/+261
| | | | | | | | | | | | | | | | | | | | | | The logic for invalidating a theme QIcon when the platform theme changed, or when the user set an explicit icon theme, was tied to QIconLoaderEngine, so any platform theme implementing QPlatformTheme::createIconEngine() with a custom icon engine would not take part in this cache invalidation. As we want users of QIcon::fromTheme to be agnostic to where the icon is actually coming from, and have a consistent behavior for the various QIcon APIs for setting explicit themes, the logic for invalidating the themed icon has now been moved up one layer, to a new QThemeIconEngine, that is responsible for lazily creating the actual engine based on the name. The engine proxies the actual icon loading through to the real engine via a new QProxyIconEngine helper class. Pick-to: 6.6 Change-Id: I474589981f751d7467e3073533cba542182f2d36 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QIconLoader: Invalidate cache even if system theme hasn't changed nameTor Arne Vestbø2023-06-161-4/+5
| | | | | | | | | | The platform theme's icon loading logic may still have changed, even if the theme name has not, so we still need to invalidate the theme cache. Pick-to: 6.5 6.6 Change-Id: Id3635c235fadb007df86d93ce3beb5622d26b8bf Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Use systemFallbackThemeName in QIconLoader::updateSystemTheme()Tor Arne Vestbø2023-06-161-1/+1
| | | | | | | | | | | The fallback logic in QIconLoader::updateSystemTheme() has been updated to match QIconLoader::ensureInitialized(), by using the systemFallbackThemeName() directly, rather than the possibly user set QIconLoader::fallbackThemeName(). Pick-to: 6.5 6.6 Change-Id: Ib5aab62bbfb22683d3bddf87c4e798eca4a5af62 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Update QIconLoader system theme unconditionally on ThemeChangeTor Arne Vestbø2023-06-161-12/+7
| | | | | | | | | | | | | We cache the system theme name in QIconLoader, so when a theme change comes in we need to update the system icon theme name regardless of whether a user theme has been set. The updated system theme name will not be reflected through the QiconLoader::themeNamed() unless the user theme is cleared/unset. Pick-to: 6.6 6.5 Change-Id: Id949e55e2fa12e40818ba54cf2a10ce48fe10815 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* De-inline QIconLoader::themeName()Tor Arne Vestbø2023-06-152-1/+6
| | | | | | | | | The method is more than a plain getter, so keep it with the other logic of the class. Pick-to: 6.5 6.6 Change-Id: I34aa185a51f04e3db3c1918f9723e53f33e5e9e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Replace {add,sub,mul}_overload with q{Add,Sub,Mul}OverloadMarc Mutz2023-06-122-5/+5
| | | | | | | | | | | | | | | | | | | These APIs started out as private APIs in qnumeric_p.h, but have since been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just forward to the qnumeric.h ones, so just use the latter. This is in preparation of removing the {add,sub,mul}_overflow versions, which, despite being defined in the unnamed namespace, don't sport the q prefix, so potentially clash with global symbols. The change is a simple textual search and replace, manually excluding qnumeric_p.h. Picking to 6.5 to avoid cherry-pick conflicts going forward. Pick-to: 6.6 6.5 Change-Id: Ic0f7c92f7c47923317109e8a9dc06fa66bdff2c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPixmapCache: deprecate replace()Marc Mutz2023-06-102-29/+27
| | | | | | | | | | | | | | | | | | | | | | | The replace() implementation overwrites the passed Key key with a new version, const_cast'ing away the const from the key passed by reference-to-const. This is UB if the Key was originally declared const. Deprecate the function. Also inline the const_cast, so compilers can readily detect the UB even if users don't enable deprecation warnings. Due to the severity of the issue (UB), immediate deprecation is warranted. There appear to be no in-tree user of the API outside of tst_qpixmapcache.cpp. [ChangeLog][Deprecation Notice][QtGui][QPixmapCache] The `replace(key, pixmap)` function has been deprecated, because passing a `const Key` to it results in undefined behavior. Use `remove(key, pixmap)` followed by `key = insert(pixmap)` instead. Pick-to: 6.6 Change-Id: Ic5060ce3271f2a1b6dc561da8716b452a2355d4c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPixmapCache: add a comment on how failed insert() invalidates cacheKeyMarc Mutz2023-06-091-1/+1
| | | | | | | | | It wasn't obvious to me, at least, and I only found out about it when I failed to construct a test failure based on this. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I339132d7bb2cb8a76f0f1feec37891d6131c4d7b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPixmapCache: fix leaking of QStrings and Keys on clear()Marc Mutz2023-06-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | QPixmapCache maintains a mapping from QString to QPixmapCache::Key, in the form of the cacheKeys QHash, but QPixmapCache::clear() didn't touch it, leading to the string data (as well as the Keys) being retained after any possible use. This can lead to memory slowly being eaten up, as reported in QTBUG-112200, and prevents a periodic calling of QPixmapCache::clear() from being a work-around for the issue in the bug report. Fix by clearing cacheKeys in QPixmapCache::clear(). This is designed as a low-risk enabler of a work-around, not a fix for the issue. The work-around enabled by this is periodic calling of QPixmapCache::clear(). [ChangeLog][QtGui][QPixmapCache] Fixed QString key data not being freed on clear(). Pick-to: 6.6 6.5 6.2 5.15 Task-number: QTBUG-112200 Change-Id: Ica6fa0e27e1b47b8df58d5e996378a2ececa5f9c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Image IO: increase the default allocation limitEirik Aavitsland2023-05-231-1/+3
| | | | | | | | | | | Time passes, Moore's law is working. As a drive-by, make the doc more informative. Fixes: QTBUG-113637 Pick-to: 6.5 Change-Id: Ic388b8850ace02c429d4d8175d31db86912d3afe Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add QIconLoader debug logging to aid fallback logic investigationTor Arne Vestbø2023-05-121-7/+43
| | | | | | | | | | The icon loader machinery is a bit opaque, so let's add some logging to understand the interactions. Pick-to: 6.5 Change-Id: Ic400b6043607795ad92771f9d9f189699f185366 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Revert "QIconLoader: use system fallback theme as the first fallback option"Tor Arne Vestbø2023-05-111-4/+0
| | | | | | | | | | | | This reverts commit 4710fb3528873e630b6b1e34c947a1c811e0e854. The theme it responsible for defining a set of good fallbacks, and we should respect that order. We should also respect any override the application developer does of the fallback theme, and not unconditionally fall back to the system fallback theme. Change-Id: I77f1a74c71a2a7db70464666b1a96a00fb4a1d8f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QIconLoader: use system fallback theme as the first fallback optionJan Grulich2023-05-111-0/+4
| | | | | | | | | | | | | | | | | | | When searching for an icon, we either use the system theme or the theme set as a fallback through QPlatformTheme, it's only one or the other. It can easily happen that the fallback theme we pick as a parent theme will not fit into the application style (color-wise). For example using KDE apps on GNOME, where we use "Adwaita" icon theme, we would always fallback to "Breeze", however, using dark theming, we want to fallback to "Breeze-dark" and this can be easily set through QPlatformTheme integration, but it's not going to be used when the system icon theme is valid and in such case the fallback theme will be ignored. This change makes the system fallback theme used as the default fallback by putting it to the list of parent themes. Pick-to: 6.5 6.2 5.15 Change-Id: I966cd8ddd0e5576e3593d349fe7ee7139136bfdf Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QImage: when saving fails, print the writer's error stringVolker Hilsheimer2023-04-111-2/+7
| | | | | | | | | | | | In debug builds, don't fail silently in QImage::save, but emit the error string of the QImageWriter to the warning stream so that developers have a chance to know what's going on. Task-number: QTBUG-103257 Task-number: QTBUG-41043 Pick-to: 6.5 Change-Id: I29718b1445d0c99a3b35d57b58ec915a503cd5f0 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Cache null icons and remove them upon system icon theme changeAxel Spoerl2023-04-114-8/+21
| | | | | | | | | | | | | | | | | | | | | | Since Qt 6, qIconCache does not store null icons. In case an icon name lookup is unsuccessful, the (expensive) lookup is repeated each time. This patch reverts 9e7c5670509ac81efdf78b691e70e5ce3d408a09, which removes a null icon from the cache once it has been found in the cache. In fact, that could no longer happen due to 4dc7102c8410f5699af93b6c55ba1c7df7755bc2, which prevented null icons from being cached at all. Therefore, it is also reverted by this patch. The cache will be cleared when - the system icon theme name changes or - QGuiApplicationPrivate::processThemeChanged is called (e.g. due to a change of the system's color scheme) Fixes: QTBUG-112257 Pick-to: 6.5 Change-Id: I80cd21fa39dc31c4bae60a8e66e78d9da20e9b4b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtMiscUtils: add isAsciiPrintable() helperAhmad Samir2023-03-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | - isAsciiPrintable: borrowed the logic from isPrintable(uchar) in qdebug.cpp, now isPrintable(uchar) calls isAsciiPrintable - Replace ::isspace() with ascii_isspace() from qlocale_p.h Functions from ctype.h have a couple of issues: - they're locale-dependent, which isn't what's required here, the code is only interested in ASCII - their args should be representable as uchar or EOF otherwise it's undefined behavior An Early-Warning could use something like: grep -rP "\b(isalnum|isalpha|isblank|iscntrl|isdigit|islower|isgraph|\ "isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper)\b" Pick-to: 6.5 Task-number: QTBUG-111262 Change-Id: I1f47f41bd56735297078ff0d0ddc2ebf999abf8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: implement startTimer(int) in terms of startTimer(chrono)Ahmad Samir2023-03-111-1/+4
| | | | | | | | | | I.e. use chrono first, this means the API isn't limited by the size of int, but by the size of whatever chrono::milliseconds uses (typically int64_t), and chrono units are much more readable as well. Task-number: QTBUG-110059 Change-Id: Ie7f2d90864782361a89866693011803be6f8545e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-282-2/+2
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add special thread pool for Qt GuiAllan Sandfeld Jensen2023-02-252-9/+11
| | | | | | | | | To avoid gui slowdowns due to global pool being blocked. Fixes: QTBUG-109511 Pick-to: 6.5 6.4 6.2 Change-Id: I4e8d91e8fb0bd2e395072a082e992a3c5d3464ad Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Trace: Autogenerate metadata in qtgui moduleAntti Määttä2023-02-101-45/+2
| | | | | | | | Pick-to: 6.5 Change-Id: I300ecb9d25f0ecb7208c643704adf66bdf0a4b56 Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Trace: Use includes instead of forward declarationsAntti Määttä2023-02-101-3/+1
| | | | | | | | | | Some platforms do not work with forward declarations, mainly android. Pick-to: 6.5 Change-Id: Ie34a30ecb8554d77c1bea4b65a752d63ba819af9 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* QtGui: Add a header declaring the Windows image conversion functionsFriedemann Kleint2023-02-082-8/+47
| | | | | | | | | | The declarations with default parameters cause conflicts in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Icf48193498d70dfacadf1b2499cb3359169f72c0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtMiscUtils: add some more character helpersAhmad Samir2023-02-072-12/+13
| | | | | | | | | | | | | isHexDigit, isOctalDigit, isAsciiDigit, isAsciiLower, isAsciiUpper, isAsciiLetterOrNumber. This de-duplicates some code through out. Rename two local lambdas that were called "isAsciiLetterOrNumber" to not conflict with the method in QtMiscUtils. Change-Id: I5b631f95b9f109136d19515f7e20b8e2fbca3d43 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>