summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qicon.h
Commit message (Collapse)AuthorAgeFilesLines
* QIcon: remove unmapped ThemeIcon enum valuesVolker Hilsheimer2024-02-211-94/+0
| | | | | | | | | | | | | | | The ThemeIcon enum provides symbolic names of icons for which most engines provide an icon. We couldn't find a matching icon for several of the XDG icon names, so remove those enum values for which we don't have at least two matches. Also remove names that are too specific for a desktop environment, like icons for certain applications or system-wide actions. Pick-to: 6.7 Change-Id: I5a6c74256bda66d9fde7513f834a8361858605c4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Simplify new QIcon ThemeIcon constants and APIVolker Hilsheimer2024-01-261-2/+253
| | | | | | | | | | | | | | | | | | | | Originally we thought that exposing the string literal through the API would be useful for people that want to know what icon they will get when using a specific constant. But since the mapping from platform independent icon name to platform specific icon name is anyway hidden in the engine implementation, this is no longer useful. Based on header review comments, simplify this by making the ThemeIcon list of constants a scoped enum. If it's really useful for e.g. designers to know which exact icon they get on a specific platform, then we could, in a future release, add a static QIcon::themeIconName API that returns the platform specific icon string for a ThemeIcon constant. Pick-to: 6.7 Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: add theme icon constantsVolker Hilsheimer2023-12-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a list of constant string literals for a subset of icons from the freedesktop specification. Those are icons we document to support today, and that users might have written themes for. Omit icons that are mime types (we have Q(Abstract)FileIconProvider and QPlatformTheme::fileIcon for that), the "flag-aa" icon (where 'aa' is an ISO 3166 country code, and Face* icons. Flags and Face icons can be added as supported QIcon constants, but should then be rendered as emojis from the respective font (they are not provided by any of the native icon libraries or icon fonts). We use string constants instead of an enum so that we have the same code path for icon constants, user-defined icons, and native icons. I.e. in addition to QIcon::fromTheme(QIcon::ThemeIcon::EditCopy), code can request the icon for "trash.circle.fill" on Apple platforms, or or for U"\ue5cd" on platforms where the engine is font-based; or an app can define their own icon name and provide the assets through a theme- description, as before. The downside is that we cannot use arrays for looking up the native icon for an enum-value in the engine implementations, but given that icons are cached this is an acceptable trade-off. To make the list of icon contants more manageable, have them in a separate header file. Since we want those constants to live in the QIcon "namespace", we then include that header in a declaration of a nested struct, "ThemeIcon", resulting in e.g. QIcon::ThemeIcon::EditCopy. Change-Id: Ic20e36ab321e6c4b20806ec0b400bba13fffc983 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace qExchange calls with std::exchangeFabian Kosmale2022-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | qExchange is one of the few remaining functionalities that have not been moved out of qglobal. Given that std::exchange exists in the standard, we can simply move to it everywhere... ...if it weren't for the fact that std::exchange is only constexpr in C++20, and only has its noexceptness specified in (most likely) C++23. Still, we want to move to the existing std functionality where possible, to allow the removal of qglobal includes in lieu of something more fine-grained in the future. So leave any constexpr calls[1] alone for now (and observe that none of our current usages cares about the conditional noexceptness), but replace everything else. [1] QScopedValueRollback' ctor and QExplicitlySharedDataPointerV2::take Task-number: QTBUG-99313 Change-Id: I599cb9846cf319c7ffd3457130938347a75aad25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Purge Q_DUMMY_COMPARISON_OPERATOR usagesFabian Kosmale2022-07-211-2/+0
| | | | | | | | It is a noop on all our supported compilers. Task-number: QTBUG-105098 Change-Id: Ic59d4c86d96ea29a5513d778ddd35df8c7a6877a 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>
* QtGui: compile-optimize inline swap functionsMarc Mutz2022-03-191-1/+1
| | | | | | | | | | | | | | | | | | Instead of using the overly-generic qSwap() monster, use - qt_ptr_swap() for swapping raw pointers - member-swap for swapping smart pointers - std::swap() for swapping scalars In QtCore, this has proven to give a nice reduction in compile time for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358. Pick-to: 6.3 6.2 Task-number: QTBUG-97601 Change-Id: I987ff95e8751a22a4f283655d8225dd16de21178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-031-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Deprecate QIcon API which take a QWindow pointerMorten Johan Sørvig2020-08-291-0/+6
| | | | | | | | | | | - pixmap(QWindow * ...) Use pixmap(size, dpr) instead - actualSize(QWindow *, ...) Use actualSize(size) instead Task-number: QTBUG-85885 Change-Id: Ia2d73eec9f040cd659f39c854463e3cd3ba72b93 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: Add pixmap() overload which take devicePixelRatioMorten Johan Sørvig2020-08-271-0/+1
| | | | | | | | | | | | | Add new QIcon::pixmap() overload: QPixmap pixmap(const QSize &size, qreal devicePixelRatio, ...) This function replaces the existing pixmap() function which take a QWindow pointer, and should be more convenient in use. Task-number: QTBUG-85885 Change-Id: Ie4ca96a266d9278864678dc61bdfc2836cabdb93 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make QCursor constructor explicit to prevent comparison of QPixmapVolker Hilsheimer2020-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | QPixmap doesn't implement operator==, but QCursor had a non-explicit constructor from a QPixmap, which the compiler would use if two pixmaps get compared. Making that QCursor constructor explicit prevents that implicit conversion, at the cost of potential (but trivially resolved) source incompatibility. Also, make QCursor's comparison operators into hidden friends to avoid any other implicit conversions, and allow only QCursor object to be compared. In addition, delete operator== and operator!= in QPixmap so that the compiler generates a useful error message, rather than a screen full of global operator== candidates. Delete these operators in QIcon as well for consistency. Change-Id: I9b3f770da5718360ecc41c35cf327ef4f60d169b Fixes: QTBUG-85993 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove deprecated members from QtGui/image classesVolker Hilsheimer2020-04-291-3/+0
| | | | | | | | Cleaning up those that are trivial to remove because they have direct replacements. Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-4/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in QtGuiAllan Sandfeld Jensen2019-04-051-4/+4
| | | | | Change-Id: I43803b88fea8083782d73ce157c466b022208740 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix qdoc errors in QIcon headerFriedemann Kleint2019-03-151-0/+1
| | | | | | | | | | | Add missing forward declaration, fixing: src/gui/image/qicon.h:93:16: error: unknown type name 'QPainter' This apparently only happens for qdoc. Change-Id: I39e78258f16628d477b629778241c4f5031820c4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Allow setting the QIcon fallback themeAlbert Astals Cid2018-08-201-0/+3
| | | | | | | | | | | | | | | This allows apps that know their icons are in a given icon theme to set that theme as fallback, so in case the user theme does not include them, the icons can still be found. This solves the problem of missing icons that often happens when running KDE applications on a GNOME desktop. Change-Id: I4e5543d598012352a29ff79dab0357506d986b6d Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Introduce QIcon::fallbackSearchPaths()Alexander Volkov2018-01-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | ... that will be used if an icon can't be found in the current theme. The Icon Theme Specification https://standards.freedesktop.org/icon-theme-spec/latest/ar01s05.html states that unthemed icons must be searched in the base directories, i.e. /usr/share/icons, ... But in practice unthemed icons are installed into /usr/share/pixmaps and this dir is not used as a base dir for icon themes. So it's better to explicitly specify fallback dirs to avoid needless access to the filesystem. Also some KDE application install their own unthemed icons (into /usr/share/<appname>/pics), that can't be found by QIconLoader. With this change it would be possible for them to specify dirs with unthemed icons and thus be displayed correctly in non-KDE environments. [ChangeLog][QtGui][QIcon] Added fallbackSearchPaths() that will be used to find icons missing in the current icon theme. Change-Id: I0dc55ba958b29356a3b0a2123d6b8faa24d4c91e Task-number: QTBUG-33123 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-2/+2
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add qtguiglobal.h and qtguiglobal_p.hLars Knoll2016-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. A similar scheme and naming convention is already being used for many other modules (e.g. printsupport, qml, quick). That header will later on #include the configuration file for Qt Gui. For now it defines the Q_GUI_EXPORT macro for this library. In addition, add a private global header, qtguiglobal_p.h, that can later on include the private config header for Qt Gui for things we don't want to export to the world. Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* 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>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-181-1/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/network/kernel/qnetworkinterface_winrt.cpp tools/configure/configureapp.cpp Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
| * Make qt_findAtNxFile return the source device pixel ratioOlivier Goffart2015-11-131-1/+2
| | | | | | | | | | | | | | | | QTextImageHandler needs it. And QQuickImageBase will also need it. Change-Id: Ica5d17519c4c6c06e25bab7d2b1d3733f4058425 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * Add support for "@3x" image loading.Morten Johan Sørvig2015-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement as generic "@Nx" support in an exported qt_findAtNxFile function. 3x devices now get one extra file existence test in cases where @3x versions are not present. 1x devices are still on the fast path where there are no extra file system accesses. Add an @3x image to the highdpi manual test. Change-Id: I4ce3fc245ada01ea410abe1443ceb1e3abf7c17f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | QIcon: add a new overload of QIcon that does not call availableSizesOlivier Goffart2015-09-111-1/+2
|/ | | | | | | | | | | | | | This is done so icons from QIcon::fromTheme are loaded lazily and we do not pay for looking up icons that are never used [ChangeLog][QtGui][QIcon] Split fromTheme() in two different overload, one of which would only lazily lookup the icons, in order to speed up startup of applications that initialize many icons that are not necessarily visible. Change-Id: I2ba3aa3a0eae6c8f1ff041a0f5bbb10ad32e3991 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Add ability for QIcons to be marked as template images.James Turner2015-07-091-0/+3
| | | | | | | | | | | | | | | | This allows end users to create QSystemTrayIcons that are properly displayed as monochrome images on OS X, which is especially important on Yosemite and above when Dark Mode is turned on. [ChangeLog][QtGui][QIcon] Add ability for QIcons to be marked as template images. This allows end users to create QSystemTrayIcons that are properly displayed as monochrome images on OS X, which is especially important on Yosemite and above when Dark Mode is turned on. Task-number: QTBUG-42109 Change-Id: I095fb71355ffa572d0abb4769341f68b89b877c4 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* QIcon: use (Qt-) canonical form of move special member functionsMarc Mutz2015-07-061-3/+3
| | | | | | | | | In particular the move constructor now performs only two instead of four assignments. Change-Id: I033d75635288fbd44060a1ba5f2da23b7e7729f6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add noexcept to move constructors and assignment operatorsAllan Sandfeld Jensen2015-05-041-5/+7
| | | | | | | | | Add the noexcept attribute to all move constructors and assignment operators in QtGui that didn't already have it. Change-Id: Idcdf79ae8349b8793e7394b5ae7c08e6111fbc9a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* 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>
* QIcon: Added a move constructor.Keith Gardner2013-04-081-0/+4
| | | | | Change-Id: Idedb935352bf8a0cd7d4293f7b8530d5b9b17616 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QIcon generate high-dpi pixmaps.Morten Johan Sørvig2013-03-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | QIcon::pixmap() can now return pixmaps that are larger than the requested size, This is a behavior change that may require updating existing application code, and is enabled by setting Qt::AA_UseHighDPIIamges. Add new pixmap() and actualSize() overloads that take a window pointer. For 100% correctness you want to target pixmap generation to a specific window, in case the system has a mix of normal and high-dpi displays. (The non-window versions uses QGuiApplication:: devicePixelRatio(), which returns the ratio for the "best" display on the system.) actualSize now returns the size in device-independent pixels - not the pixmap pixel size. This matches its intended use case which is layout calculations. Change-Id: I2eefc4ed4aa48b036a7019446694e56213070efa Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.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>
* 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>
* Q_DECLARE_SHARED: mark the type movableMarc Mutz2012-07-101-1/+0
| | | | | | | | | | All implicitly shared classes are by definition movable, so this patch adds Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE) to Q_DECLARE_SHARED. Change-Id: Idf8989ae1a7ed6d1ac13fccb7eaef7395a875350 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QIcon: move back to QtGuiOlivier Goffart2012-05-181-0/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move the files and tests git mv src/widgets/kernel/qicon* qrc/gui/image/ git mv tests/auto/widgets/kernel/qicon/ tests/auto/gui/image/ - update the include of QIcon git grep -O"sed -i s,QtWidgets/qicon,QtGui/qicon," "QtWidgets/qicon" git grep -O"sed -i s,QtWidgets/QIcon,QtGui/QIcon," "QtWidgets/QIcon" - Adapt QIcon \ingroup documentation sed -i s/QtWidgets/QtGui/ src/gui/images/qicon* - Adapt export macro sed -i s/Q_WIDGETS_EXPORT/Q_GUI_EXPORT/g src/gui/image/qicon* - Update .pri and .pro files - Remove the use of QStyle::alignedRect by copying its content (and adapt slightly - Use QGuiApplication::palette() instead of QApplication::palette() - Add a hook in QGuiApplicationPrivate to call the QStyle::generatedIconPixmap() from QtWidgets Another commit follows to adjust QMetaType::Icon and move the QVariant and QMetaType icon handler back in QtGui Change-Id: I1b63759f892ebc02dfc30f41bb6e76e0b7451182 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
* moving some more files around.Lars Knoll2011-05-041-143/+0
|
* remove more QT3_SUPPORT codeLars Knoll2011-05-031-19/+0
|
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+162
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12