summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowstheme.h
Commit message (Collapse)AuthorAgeFilesLines
* Windows QPA: Move system tray icon implementation into the pluginFriedemann Kleint2017-04-271-0/+3
| | | | | | | | | | | | | | The system tray icon implementation relied on QMenu. After the introduction of QPlatformSystemTrayIcon::contextMenuRequested(), the code can be moved into the plugin, making use of native menus when enabled or falling back to QMenu. This enables the SystemTrayIcon QML Type to work. [ChangeLog][QtGui][Windows] A native system tray icon is now available for SystemTrayIcon. Change-Id: I0fdbfb5cbb815c1ea6fb19305a9bceb9c5bcc034 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Windows QPA: Add native menusFriedemann Kleint2017-04-271-0/+7
| | | | | | | | | | | | | | | | | | | | | Add simple Win32-API based menus (not owner-drawn). Native menus are implemented using Win32 API and are simpler than QMenu-based menus in for example that they do allow for placing widgets on them or changing properties like fonts and do not provide hover signals. They are mainly intended for Qt Quick. By default, they will be used if the application is not an instance of QApplication or for Qt Quick Controls 2 applications. In addition, the command line option -platform windows:menus=native will unconditionally activate them and -platform windows:menus=no turns them off. [ChangeLog][QtGui][Windows] Native menus have been implemented. Task-number: QTBUG-55967 Change-Id: I439a7d949745debea3eb0e5789cf42288a0d526f Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* QWindowsTheme: Run dedicated SHGetFileInfo() threadGabriel de Dietrich2016-12-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The changes are motivated by the following reasons: 1. SHGetFileInfo() needs to be COM-intialized per thread. Microsoft's documentation for CoInitalizeEx() is quite unambiguous about this. 2. Following point 1, using a thread from the global thread pool means we would taint every such thread with the COM-initialization state. This may result in unexpected behavior in other parts of the application. Moreover, systematic COM-uninitialization can be expensive and can't be recommended in this case. 3. Even though the timeout duration is pretty generous, the logic is wrong and could lead to serious errors should the call to SHGetFileInfo() actually take too long. This is because we let the thread run with references to the main thread's stack, namely a reference to the file name string, and pointers to the result variable and SHFILEINFO struct. Running a dedicated thread allows us to ensure points 1 and 2. Point 3 is ensured by making a local copy of the file name and using local instances for the info struct and the result. Then, provided the thread has not been cancelled, we can copy the info and result values back into the main thread's stack referenced memory areas. This also removes all need for QWindowsThreadPoolRunner which will remain in the code base nonetheless. Change-Id: Ic9c2d6204ac015aa409db2b57a09837361203291 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Windows: Replace Q_DECL_OVERRIDE by overrideAlexander Volkov2016-12-081-6/+6
| | | | | | | | We can use 'override' directly since Qt 5.7. Also remove redundant 'virtual'. Change-Id: Ib478f19381d53642e1ed1c2a589d6b9c4d663e3c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtPlatformSupport: Add QAbstractFileIconEngineFriedemann Kleint2016-08-051-4/+7
| | | | | | | | | | | | | | Move the code from QtWidgets/QFileIconEngine into a new class with virtuals in QtPlatformSupport so that platforms can reuse it. Prototypically use the class in the Windows and macOS QPA plugins. Remove QPlatformTheme::fileIconPixmap() and change the type of the hint QPlatformTheme::IconPixmapSizes from QList<int> to QList<QSize> so that it fits better with the icon code. Change-Id: I580e936f3507218757565ca099272cd575b3a779 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-151-0/+5
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakeevaluator.cpp One side changed the iterator to use ranged-for, the other changed its body; they only conflicted because the latter had to add braces around the body, intruding on the for-line. Trivial resolution. Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
| * QWindowsTheme: Fix the available file icon sizesFriedemann Kleint2016-07-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, QWindowsTheme had a hardcoded list of of available file icon sizes. As the sizes depend on the Windows display scale factor, this can lead to undesired scaling of icons. Maintain an array of the standard sizes against which the sizes are matched; refresh in display change. Task-number: QTBUG-54561 Change-Id: If36de2f30c8a230cc7bd8eeb4dfc9f201aeda5e4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-291-0/+2
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qprocess/tst_qprocess.cpp Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
| * QWindowsTheme: Run SHGetFileInfo() in a thread.Friedemann Kleint2016-02-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Windows 10: SHGetFileInfo() (as called by item views on file system models has been observed to trigger a WM_PAINT on the mainwindow for totally obscure reasons, causing a recursive repaint. Suppress this by running it via QThreadPool. Task-number: QTBUG-45298 Task-number: QTBUG-48823 Task-number: QTCREATORBUG-14888 Change-Id: I7479102b9b8fb0771681260298c3d735e66f220f Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-2/+2
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Windows/Direct2D QPA plugins: Fix overrides.Friedemann Kleint2016-01-141-2/+2
| | | | | | | | | | | | | | Fix warnings found by clang. Change-Id: Ia8e7a271e9d33011eded1e63e61dbcaeaf692600 Reviewed-by: Joerg Bornemann <joerg.bornemann@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>
* Clean headers in the Windows plugin.Friedemann Kleint2015-03-051-9/+0
| | | | | Change-Id: Ibc6b904e6e0b21f5daa0730a7eda2cae43cd3dcf Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Windows/Direct2D platform plugins: Add Q_DECL_OVERRIDE.Friedemann Kleint2014-07-291-6/+6
| | | | | | | | | | | | Replace old virtual declarations by Q_DECL_OVERRIDE where applicable. Errors discovered: QWindowsScreen::primaryOrientation() did not overwrite any method, changed to orientation(). Task-number: QTBUG-38858 Task-number: QTBUG-38993 Change-Id: Ie85d5235f3cd35c7a24cac3c1c7693c6508b1009 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Windows: Introduce QFileDialog::DontUseCustomDirectoryIconsSérgio Martins2013-05-091-1/+2
| | | | | | | | | | | | | | | Folders can have a custom icon, set by the user. Some system folders also have one, for example c:\windows\fonts. This option allows you to disable this behavior, you'll get the folder directory icon. As a side-effect, you'll get a very big performance improvement on removable/network media: 2 seconds vs 60 seconds on a SDCard with 10000 folders. Change-Id: Id55ea628186e0a6523585ec7a4ff622d6f5da505 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.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>
* QPA: Introducing QPlatformTheme standardPixmap(), fileIconPixmap()Gabriel de Dietrich2012-10-161-0/+3
| | | | | | | | | | | | | | | | | | | | The basic idea is that the platform theme is now responsible for providing the pixmaps for the given standard name, or any file or directory. Then, the QStyle implementation should query the platform theme for the pixmaps, and build the icons accordingly using ThemeHint::IconPixmapSizes. Same thing for QFileIconProvider. This also opens future support for getting platform dependent pixmaps in QtQuick components. Also includes the implementation for the Cocoa (QCocoaTheme) and Windows (QWindowsTheme) platform plugins. Task-number: QTBUG-27450 Change-Id: I4e8406585d970a9af481be10f6643cf0abbc38a3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@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>
* Expose QPA API under qpa/*Girish Ramakrishnan2012-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += <module>-private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Refactor theme plugin loading.Friedemann Kleint2012-03-151-1/+4
| | | | | | | | | | | | | | | | | | | | In the old implementation, the QPlatformIntegration was asked for the theme first, so there was no way of overriding that by a custom plugin. Also, there was a memory leak in case the platform theme was actually created by a plugin. QGuiApplication now asks the QPlatformIntegration for a list of potential theme names first, tries to load them using the plugin loader and finally invokes a factory method of QPlatformIntegration in case that fails. The theme is now owned by QGuiApplication. In the XCB plugin, the environment variable DESKTOP_SESSION is queried and appended to the list of themes, making it possible to load plugins for other session types. Change-Id: I1a4b4e061815bca16c65b23e591bb7563a3e44e2 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Add fonts to QPlatformTheme.Friedemann Kleint2012-03-071-1/+7
| | | | | | | | | | | | | | | | - Remove QPlatformFontDatabase::defaultFonts() returning a hash containing widget name ->font and the Windows implementation. - Add enumeration and font accessor to QPlatformTheme. The value returned for the enumeration value overwrites the default font of the font database. - Implement for Windows, Mac and KDE. - Add more Windows palettes. Task-number: QTBUG-23686 Change-Id: I8a2abdfd216df23daa7c9630c54264cdf61295db Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Add palette() and further hints to QtGui/QPlatformTheme.Friedemann Kleint2012-02-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | - Move palette() from deprecated QtWidgets/QGuiPlatformPlugin to QtGui/QPlatformTheme, Make it return a const * since QPalette does not have isNull(). - Initialize QGuiApplication::palette() and QApplication::systemPalette() from it. - Do not initialize QPalette from QGuiApplication::palette() unless app_pal is non-null (default to Qt::black if it is 0). This avoids initialization order crashes/recursions in the QPA plugin. Streamline initialization function. - Remove styleName(), systemIconThemeName() and iconSearchPaths() from QGuiPlatformPlugin and re-add them as QPlatformTheme::themeHint(). - Remove styleHint() from QGuiPlatformPlugin, add it to QPlatformTheme::themeHint(). - Add UNIX themes with factory function (Generic, KDE, Gnome), taking it from Qt 4.8 code (stripping the KDE 3 code). - Implement Windows palettes. Task-number: QTBUG-24204 Change-Id: Ie27ec035df4f84c42deaffc4816b2e53ce705462 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Decouple QPlatformTheme from QDialog.Friedemann Kleint2012-01-271-2/+2
| | | | | | | | | | - Use an enumeration for the dialog type. - Implemented on Windows and Mac Reviewed-by: Morten Johan Sorvig <morten.sorvig@nokia.com> Change-Id: I213748a08168efbabc2ac0106308e97ff19d19c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Introduce a QVariant themeHint() to QPlatformTheme.Friedemann Kleint2012-01-111-0/+1
| | | | | | | Start on removing platform-specific code from QtWidgets. Change-Id: Ic2163a0ce6f2db2151cdf7ca93766b2d861eeb55 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Factor out QPlatformTheme from QPlatformPlugin.Friedemann Kleint2011-11-111-0/+60
Implement QCocoaPlatformTheme. The menus and dialog API is moved from the platform to the theme plugin. (Both APIs contain references to QtWidget classes, which we are working towards removing.) The theme plugin is created after the platform plugin, first by asking the platform plugin, then by looking for a separate plugin if the platform does not specify a theme. Initial-patch-by: Morten Sorvig <msorvig@trolltech.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Change-Id: I2778cdd3a205c4ce35ead93e39fe6b4cd58a39f9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>