From 596ce989b5efff9d062540544e9c024dabe14e05 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Jun 2016 08:35:58 +0200 Subject: Windows QPA: Improve warning about SetProcessDpiAwareness() failure Silence warning in case DPI awareness was set externally unless debug is enabled. Task-number: QTBUG-54416 Change-Id: Id48769e3d4be3047f582e331633905c640930f21 Reviewed-by: Kai Koehne --- src/plugins/platforms/windows/qwindowscontext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 09c2f7df2e..39054b6a64 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -409,7 +409,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); - if (FAILED(hr)) { + // E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin). + // Silence warning in that case unless debug is enabled. + if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) { qWarning().noquote().nospace() << "SetProcessDpiAwareness(" << dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr) << ", using " << QWindowsContext::processDpiAwareness(); @@ -843,6 +845,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) case E_UNEXPECTED: result += QByteArrayLiteral("E_UNEXPECTED"); break; + case E_ACCESSDENIED: + result += QByteArrayLiteral("E_ACCESSDENIED"); + break; case CO_E_ALREADYINITIALIZED: result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED"); break; -- cgit v1.2.3 From df9aee21504b18decbd5637ca4ce86c559fa3cc3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Jun 2016 15:02:58 +0200 Subject: Fix URL to ANGLE Point to the README.md of the project; the old URL http://code.google.com/p/angleproject is now redirected to the bugtracker. Change-Id: I293fc150d5b6c08f16effe8921010050faa264b5 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 9ae1ca8acb..82ac47e99f 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -513,7 +513,7 @@ QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EG \list \o Install the Direct X SDK \o Checkout and build ANGLE (SVN repository) as explained here: - \l{http://code.google.com/p/angleproject/wiki/DevSetup}{ANGLE-Project}. + \l{https://chromium.googlesource.com/angle/angle/+/master/README.md} When building for 64bit, de-activate the "WarnAsError" option in every project file (as otherwise integer conversion warnings will break the build). -- cgit v1.2.3 From db1a6ac357eaaa09690a8310bcb799c678836320 Mon Sep 17 00:00:00 2001 From: Bernhard Scheirle Date: Sat, 18 Jun 2016 14:30:15 +0200 Subject: Fix shortcut handling for level three and above shortcuts Calling `xkb_state_update_mask` with correctly set `depressed_mods` allows xkb to return keys on level three or above (and not the equivalent level one key). To preserve level two shortcuts (return equivalent level one key) `depressed_mods` gets only set, if the pressed key is on level three or above. Example shortcuts which now will work: Shortcut German Layout (de) [AltGr is a level three switch] Ctrl+@ Ctrl+AltGr+Q Shift+1 Shift+1 (as before) Shortcut German Neo Layout (de neo) [1] [AltGr is a level five switch] Left AltGr+S [1] http://neo-layout.org Task-number: QTBUG-53121 Change-Id: I637a01edc9f2f92a5d3e7a24f5051fb1d3ac2f7f Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 1eeb59a665..28de86b8ba 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -973,10 +973,21 @@ QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED); xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED); xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED); + xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED); - xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); - + xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout); quint32 keycode = event->nativeScanCode(); + // handle shortcuts for level three and above + xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode); + xkb_level_index_t levelIndex = 0; + if (layoutIndex != XKB_LAYOUT_INVALID) { + levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex); + if (levelIndex == XKB_LEVEL_INVALID) + levelIndex = 0; + } + if (levelIndex <= 1) + xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); + xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode); if (sym == XKB_KEY_NoSymbol) { xkb_state_unref(kb_state); -- cgit v1.2.3 From dfd62a8f36a6461c3f3cad390c8a243829bea0e4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 30 Jun 2016 10:04:07 +0200 Subject: winrt: Clean up function signature Change-Id: I006d4a2295103c8e4169945dfb451ee55598ec87 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/winrt/qwinrtdrag.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp index 2ef50aa4e2..055aacbf56 100644 --- a/src/plugins/platforms/winrt/qwinrtdrag.cpp +++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp @@ -504,8 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA class QtDragEventHandler##name : public IDragEventHandler \ { \ public: \ - virtual HRESULT STDMETHODCALLTYPE Invoke(IInspectable *sender, \ - ABI::Windows::UI::Xaml::IDragEventArgs *e) \ + STDMETHODIMP Invoke(IInspectable *sender, \ + ABI::Windows::UI::Xaml::IDragEventArgs *e) \ { \ return qt_##func(sender, e);\ } \ -- cgit v1.2.3 From 3d621af54be7b34e6cc6357b48c4d15f911937ee Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sun, 15 May 2016 16:56:40 +0200 Subject: xcb: Send also "text/plain" when a "text/uri-list" is dropped. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow dropping of files from Qt applications to applications like Skype, which only accept "text/plain", but not "text/uri-list" or "text/x-moz-url". Task-number: QTBUG-53238 Change-Id: I01bca5c8e20647cedfc9323f542ab07f0cc48658 Reviewed-by: Dmitry Shachnev Reviewed-by: Błażej Szczygieł Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbmime.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index 7fea0688cc..cc90da385c 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -125,6 +125,11 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa ret = true; } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { ret = true; + } else if (atomName == QLatin1String("text/plain") + && mimeData->hasFormat(QLatin1String("text/uri-list"))) { + // Return URLs also as plain text. + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + ret = true; } return ret; } @@ -143,8 +148,10 @@ QVector QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con } // special cases for uris - if (format == QLatin1String("text/uri-list")) + if (format == QLatin1String("text/uri-list")) { atoms.append(connection->internAtom("text/x-moz-url")); + atoms.append(connection->internAtom("text/plain")); + } //special cases for images if (format == QLatin1String("image/ppm")) -- cgit v1.2.3 From 9d620483c6b9ac0ba15bb3c8ea2482a09202f1a1 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 29 Jun 2016 16:36:17 -0700 Subject: QCocoaTheme: Remove unreachable code The condition iconType != kGenericApplicationIcon is never false, therefore we will never execute the else statement. Consequently, overlyaIcon will always be null. This was triggered by the deprecation of ProcessSerialNumber related APIs since 10.9. Change-Id: If9eec1d2cc6e7e5b0c5323d4550f0c823a5eb0d8 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoatheme.mm | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 4b73d0af08..5c41c896b7 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -214,34 +214,14 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const } if (iconType != 0) { QPixmap pixmap; - IconRef icon; - IconRef overlayIcon = 0; - if (iconType != kGenericApplicationIcon) { - GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); - } else { - FSRef fsRef; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - GetProcessBundleLocation(&psn, &fsRef); - GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); - if (sp == MessageBoxCritical) { - overlayIcon = icon; - GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); - } - } + IconRef icon = Q_NULLPTR; + GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); if (icon) { pixmap = qt_mac_convert_iconref(icon, size.width(), size.height()); ReleaseIconRef(icon); } - if (overlayIcon) { - QSizeF littleSize = size / 2; - QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize.width(), littleSize.height()); - QPainter painter(&pixmap); - painter.drawPixmap(littleSize.width(), littleSize.height(), overlayPix); - ReleaseIconRef(overlayIcon); - } - return pixmap; } -- cgit v1.2.3 From 1575f2fc3cf74035716f2dc0c31442d77f136561 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Jun 2016 11:03:44 -0700 Subject: XCB: Update the high DPI scaling in more conditions I don't think fae8ee8b428ae7a406199e504b2d0eedd5059dbd was enough. I've started getting small fonts in Qt Creator under some other circumstances. Change-Id: I1cc7601489634e96833cfffd1456caea823aa84a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b5c5028995..29a2cfb57a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -258,8 +258,8 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) } else { screen = createScreen(virtualDesktop, output, outputInfo.data()); qCDebug(lcQpaScreen) << "output" << screen->name() << "is connected and enabled"; - QHighDpiScaling::updateHighDpiScaling(); } + QHighDpiScaling::updateHighDpiScaling(); } } else if (screen) { if (output.crtc == XCB_NONE && output.mode == XCB_NONE) { -- cgit v1.2.3 From abc29084fadf9c7d936fca55d02323090d9986cc Mon Sep 17 00:00:00 2001 From: Roger Maclean Date: Wed, 29 Oct 2014 11:06:20 -0400 Subject: QNX: Ensure invisible 1x1 raster windows are posted. Non-top level raster windows still have screen windows associated with them though they are not intended to be visible. This causes problems if they have children (as they do when QGLWidgets are used) since their children will also not be visible. So, if we have a window with a parent, force them to post but set the transparency to discard so they remain invisible. This allows the example hellogl_es2 to run correctly. Change-Id: I67e24dc59b29ce789376498c2477349fa50020e1 Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxrasterwindow.cpp | 9 ++++++++- src/plugins/platforms/qnx/qqnxwindow.cpp | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 933fce0e33..a764bba00e 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -172,7 +172,7 @@ void QQnxRasterWindow::adjustBufferSize() { // When having a raster window we don't need any buffers, since // Qt will draw to the parent TLW backing store. - const QSize windowSize = window()->parent() ? QSize(1,1) : window()->size(); + const QSize windowSize = window()->parent() ? QSize(0,0) : window()->size(); if (windowSize != bufferSize()) setBufferSize(windowSize); } @@ -188,6 +188,13 @@ void QQnxRasterWindow::resetBuffers() m_currentBufferIndex = -1; m_previousDirty = QRegion(); m_scrolled = QRegion(); + if (window()->parent() && bufferSize() == QSize(1,1)) { + // If we have a parent then we're not really rendering. But if we don't render we'll + // be invisible and any children won't show up. This should be harmless since we're + // rendering into a 1x1 window that has transparency set to discard. + renderBuffer(); + post(QRegion(0,0,1,1)); + } } void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int dy, bool flush) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 4dc1248bd1..da2929d4c0 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -386,7 +386,12 @@ void QQnxWindow::setBufferSize(const QSize &size) // Set the transparency. According to QNX technical support, setting the window // transparency property should always be done *after* creating the window // buffers in order to guarantee the property is paid attention to. - if (window()->requestedFormat().alphaBufferSize() == 0) { + if (size.isEmpty()) { + // We can't create 0x0 buffers and instead make them 1x1. But to allow these windows to + // still be 'visible' (thus allowing their children to be visible), we need to allow + // them to be posted but still not show up. + val[0] = SCREEN_TRANSPARENCY_DISCARD; + } else if (window()->requestedFormat().alphaBufferSize() == 0) { // To avoid overhead in the composition manager, disable blending // when the underlying window buffer doesn't have an alpha channel. val[0] = SCREEN_TRANSPARENCY_NONE; -- cgit v1.2.3 From 145d8462e3daa96b49a921fd4a34cf4dc84071d4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Jun 2016 11:14:22 +0200 Subject: Windows QPA: Accept foreign windows when checking for wheel receivers After change 14efcaa3921687129d4dca9b7d5794668a329cd6, foreign windows no longer have a corresponding QWindowsWindow. This should not block wheel events when checking for blocking modal windows. Amends change 14efcaa3921687129d4dca9b7d5794668a329cd6. Task-number: QTBUG-54430 Change-Id: I1ac87445844946bafc214024e27da08c4f884d79 Reviewed-by: Tim Blechmann Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsmousehandler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 78fff65d84..b92387d397 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -393,6 +393,8 @@ static bool isValidWheelReceiver(QWindow *candidate) { if (candidate) { const QWindow *toplevel = QWindowsWindow::topLevelOf(candidate); + if (toplevel->type() == Qt::ForeignWindow) + return true; if (const QWindowsWindow *ww = QWindowsWindow::windowsWindowOf(toplevel)) return !ww->testFlag(QWindowsWindow::BlockedByModal); } -- cgit v1.2.3 From c8aa7eda3abfba9004eb70db571c7c537494b7f0 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sun, 19 Jun 2016 03:15:43 +0300 Subject: Fix build of the minimal platform plugin for MS Windows when qtbase is configured with -fontconfig and -system-freetype. This fix is necessary after 060e0f6628fd185994911307c59f5355acaaf18f. Used the same approach as in 16864c42d6bc0ee6b3e3fa03123ef5884557ceea. Change-Id: Idece0dc11d89e38266c95de1769be751c06324ef Reviewed-by: Friedemann Kleint --- src/plugins/platforms/minimal/minimal.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index bd6f2d8e6f..3aca27b555 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -11,7 +11,7 @@ HEADERS = qminimalintegration.h \ OTHER_FILES += minimal.json CONFIG += qpa/genericunixfontdatabase -darwin: DEFINES += QT_NO_FONTCONFIG +win32|darwin: DEFINES += QT_NO_FONTCONFIG PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin -- cgit v1.2.3 From deb2728a8677b275613668d1467b636ed1776282 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 7 Jul 2016 15:23:20 +0200 Subject: [macOS] Check that the screen's index is still valid after updating It is possible for a screen to be disconnected while it is doing an update of the available screens. Therefore before returning the pointer to the screen then it should be rechecked that the index is still within the range of available screens. Change-Id: Iaa08070e79a72cb309d8a24cea786a5dccf6b719 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 4 ++++ src/plugins/platforms/cocoa/qnsview.mm | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 933160b2ca..659c803a19 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -450,6 +450,10 @@ QCocoaScreen *QCocoaIntegration::screenAtIndex(int index) if (index >= mScreens.count()) updateScreens(); + // It is possible that the screen got removed while updateScreens was called + // so we do a sanity check to be certain + if (index >= mScreens.count()) + return 0; return mScreens.at(index); } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4e482fb146..913ce08d17 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -469,7 +469,8 @@ QT_WARNING_POP NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen]; if (screenIndex != NSNotFound) { QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenAtIndex(screenIndex); - QWindowSystemInterface::handleWindowScreenChanged(m_window, cocoaScreen->screen()); + if (cocoaScreen) + QWindowSystemInterface::handleWindowScreenChanged(m_window, cocoaScreen->screen()); m_platformWindow->updateExposedGeometry(); } } -- cgit v1.2.3 From 2788fccd29fba84bca7581778f5bc683736f1d0e Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 6 Jul 2016 11:32:54 +0300 Subject: Use QStringLiteral more judiciously Replace it with QL1S in QStringBuilder expressions and in overloaded functions. Replace patterns 'QString::number() + QStringLiteral' and 'QStringLiteral + QString::number()' with QString::asprintf. Saves some text size. Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- .../compose/generator/qtablegenerator.cpp | 2 +- .../platforms/eglfs/qeglfsdeviceintegration.cpp | 2 +- src/plugins/platforms/windows/qwindowscontext.cpp | 21 +++++++++++---------- src/plugins/platforms/windows/qwindowsmime.cpp | 2 +- src/plugins/platforms/windows/qwindowsservices.cpp | 7 +++---- .../platforms/windows/qwindowstabletsupport.cpp | 6 +++--- src/plugins/platforms/windows/qwindowstheme.cpp | 2 +- src/plugins/platforms/winrt/qwinrtclipboard.cpp | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 52d14e5324..d507751d5e 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -278,7 +278,7 @@ QString TableGenerator::findComposeFile() // check if user’s home directory has a file named .XCompose if (cleanState()) { - QString path = qgetenv("HOME") + QStringLiteral("/.XCompose"); + QString path = qgetenv("HOME") + QLatin1String("/.XCompose"); if (QFile::exists(path)) return path; } diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp index 5cbc5dbdb0..fc41dc5643 100644 --- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp @@ -79,7 +79,7 @@ QStringList QEGLDeviceIntegrationFactory::keys(const QString &pluginPath) QCoreApplication::addLibraryPath(pluginPath); list = directLoader()->keyMap().values(); if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") + const QString postFix = QLatin1String(" (from ") + QDir::toNativeSeparators(pluginPath) + QLatin1Char(')'); const QStringList::iterator end = list.end(); diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index fda3f51a48..1cc992dda6 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -509,28 +509,29 @@ QString QWindowsContext::registerWindowClass(const QWindow *w) break; } // Create a unique name for the flag combination - QString cname = QStringLiteral("Qt5QWindow"); + QString cname; + cname += QLatin1String("Qt5QWindow"); switch (type) { case Qt::Tool: - cname += QStringLiteral("Tool"); + cname += QLatin1String("Tool"); break; case Qt::ToolTip: - cname += QStringLiteral("ToolTip"); + cname += QLatin1String("ToolTip"); break; case Qt::Popup: - cname += QStringLiteral("Popup"); + cname += QLatin1String("Popup"); break; default: break; } if (style & CS_DROPSHADOW) - cname += QStringLiteral("DropShadow"); + cname += QLatin1String("DropShadow"); if (style & CS_SAVEBITS) - cname += QStringLiteral("SaveBits"); + cname += QLatin1String("SaveBits"); if (style & CS_OWNDC) - cname += QStringLiteral("OwnDC"); + cname += QLatin1String("OwnDC"); if (icon) - cname += QStringLiteral("Icon"); + cname += QLatin1String("Icon"); return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon); } @@ -828,8 +829,8 @@ static inline QString errorMessageFromComError(const _com_error &comError) return result; } if (const WORD wCode = comError.WCode()) - return QStringLiteral("IDispatch error #") + QString::number(wCode); - return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16); + return QString::asprintf("IDispatch error #%u", uint(wCode)); + return QString::asprintf("Unknown error 0x0%x", uint(comError.Error())); } #endif // !Q_OS_WINCE diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index cb112446fc..b86972996c 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -698,7 +698,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData QByteArray data = getData(CF_UNICODETEXT, pDataObj); if (!data.isEmpty()) { str = QString::fromWCharArray(reinterpret_cast(data.constData())); - str.replace(QStringLiteral("\r\n"), QStringLiteral("\n")); + str.replace(QLatin1String("\r\n"), QLatin1String("\n")); } else { data = getData(CF_TEXT, pDataObj); if (!data.isEmpty()) { diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 3c99e3507e..1fee56aeca 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -94,9 +94,8 @@ static inline QString mailCommand() keyName = QString::fromWCharArray(command); RegCloseKey(handle); } - if (keyName.isEmpty()) - keyName = QStringLiteral("mailto"); - keyName += QStringLiteral("\\Shell\\Open\\Command"); + const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String(); + keyName += mailto + QLatin1String("\\Shell\\Open\\Command"); if (debug) qDebug() << __FUNCTION__ << "keyName=" << keyName; command[0] = 0; @@ -134,7 +133,7 @@ static inline bool launchMail(const QUrl &url) } // Pass the url as the parameter. Should use QProcess::startDetached(), // but that cannot handle a Windows command line [yet]. - command.replace(QStringLiteral("%1"), url.toString(QUrl::FullyEncoded)); + command.replace(QLatin1String("%1"), url.toString(QUrl::FullyEncoded)); if (debug) qDebug() << __FUNCTION__ << "Launching" << command; //start the process diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 3689978b41..dbc0b0a77a 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -246,11 +246,11 @@ QString QWindowsTabletSupport::description() const .arg(implementationVersion >> 8).arg(implementationVersion & 0xFF) .arg(opts, 0, 16); if (opts & CXO_MESSAGES) - result += QStringLiteral(" CXO_MESSAGES"); + result += QLatin1String(" CXO_MESSAGES"); if (opts & CXO_CSRMESSAGES) - result += QStringLiteral(" CXO_CSRMESSAGES"); + result += QLatin1String(" CXO_CSRMESSAGES"); if (m_tiltSupport) - result += QStringLiteral(" tilt"); + result += QLatin1String(" tilt"); return result; } diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 4bf424f5f6..3947f823d6 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -346,7 +346,7 @@ QWindowsTheme::~QWindowsTheme() static inline QStringList iconThemeSearchPaths() { - const QFileInfo appDir(QCoreApplication::applicationDirPath() + QStringLiteral("/icons")); + const QFileInfo appDir(QCoreApplication::applicationDirPath() + QLatin1String("/icons")); return appDir.isDir() ? QStringList(appDir.absoluteFilePath()) : QStringList(); } diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp index aee9fc617d..2811f1f018 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp +++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp @@ -102,7 +102,7 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode) quint32 size; const wchar_t *textStr = result.GetRawBuffer(&size); QString text = QString::fromWCharArray(textStr, size); - text.replace(QStringLiteral("\r\n"), QStringLiteral("\n")); + text.replace(QLatin1String("\r\n"), QLatin1String("\n")); m_mimeData.setText(text); return &m_mimeData; -- cgit v1.2.3 From 38b09d34210805766afa8bdd6a1ef413447a89ed Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 7 Jul 2016 14:33:30 -0700 Subject: QCocoaMenu: Attach late items to their submenu Because the QMenu::aboutToShow() signal is emitted way after -[QCocoaMenuDelegate menu:updateItem: atIndex:shouldCancel:], we miss the opportunity to attach the submenu to the menu item. The solution is to track the "open" state of the NSMenu. Then, if any submenu item gets added while the NSMenu is open, then we immediately attach the native item to the menu. Change-Id: I1f3a84ed3832520344da07e06cb3483ad6bd4ffd Task-number: QTBUG-54633 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoamenu.h | 6 +++++- src/plugins/platforms/cocoa/qcocoamenu.mm | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index c975de166d..98b0eb9c54 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -87,6 +87,9 @@ public: void setAttachedItem(NSMenuItem *item); NSMenuItem *attachedItem() const; + bool isOpen() const; + void setIsOpen(bool isOpen); + private: QCocoaMenuItem *itemOrNull(int index) const; void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem); @@ -94,9 +97,10 @@ private: QList m_menuItems; NSMenu *m_nativeMenu; NSMenuItem *m_attachedItem; + quintptr m_tag; bool m_enabled; bool m_visible; - quintptr m_tag; + bool m_isOpen; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 878c96d33a..155abcc7ea 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -131,12 +131,14 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); - (void) menuWillOpen:(NSMenu*)m { Q_UNUSED(m); + m_menu->setIsOpen(true); emit m_menu->aboutToShow(); } - (void) menuDidClose:(NSMenu*)m { Q_UNUSED(m); + m_menu->setIsOpen(false); // wrong, but it's the best we can do emit m_menu->aboutToHide(); } @@ -251,9 +253,10 @@ QT_BEGIN_NAMESPACE QCocoaMenu::QCocoaMenu() : m_attachedItem(0), + m_tag(0), m_enabled(true), m_visible(true), - m_tag(0) + m_isOpen(false) { QMacAutoReleasePool pool; @@ -324,6 +327,8 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) item->nsItem().target = m_nativeMenu.delegate; if (!item->menu()) [item->nsItem() setAction:@selector(itemFired:)]; + else if (isOpen() && item->nsItem()) // Someone's adding new items after aboutToShow() was emitted + item->menu()->setAttachedItem(item->nsItem()); if (item->isMerged()) return; @@ -347,6 +352,16 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) item->setMenuParent(this); } +bool QCocoaMenu::isOpen() const +{ + return m_isOpen; +} + +void QCocoaMenu::setIsOpen(bool isOpen) +{ + m_isOpen = isOpen; +} + void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) { QMacAutoReleasePool pool; -- cgit v1.2.3 From 7c279d779b32eb61987fc7d4f1143a1eaa1a1bde Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 7 Jul 2016 12:36:33 +0200 Subject: QWindowsTabletSupport: fix new[]/delete mismatch QScopedPointer deletes with delete, but a pointer returned from new[] needs to be deleted with delete[]. Fix by using QVarLengthArray instead of QScopedPointer(new TCHAR[]). Change-Id: I2f1f252379a9ac1ee919901b5efcec9cec31261e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowstabletsupport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 222551a86f..87f3eff409 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -227,7 +227,7 @@ QString QWindowsTabletSupport::description() const const unsigned size = m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, 0); if (!size) return QString(); - QScopedPointer winTabId(new TCHAR[size + 1]); + QVarLengthArray winTabId(size + 1); m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, winTabId.data()); WORD implementationVersion = 0; m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_IMPLVERSION, &implementationVersion); -- cgit v1.2.3 From 7a2f53647bad30a95692bb2d32a9a080f948a20a Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Mon, 4 Jul 2016 13:55:06 +0900 Subject: Bearer/ConnMan: Fix No such slot Change-Id: Icf403b2e2e86d1cb58fd74c0df054bcc43cf9210 Reviewed-by: Lorn Potter --- src/plugins/bearer/connman/qconnmanservice_linux_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 1a10a2260a..7292736e2e 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -211,6 +211,7 @@ protected: private: QVariantMap properties(); QVariantMap propertiesMap; +private Q_SLOTS: void scanReply(QDBusPendingCallWatcher *call); }; -- cgit v1.2.3 From 8ba3fee61030e54ee1bc79c15059170be5bc2add Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 10 Jun 2016 09:54:09 +0200 Subject: QWindowsOpenGLTester: fall back to built-in blacklist if buglist file cannot be resolved if the environment variable is set, but the buglist file cannot be found, we should fall back to the built-in buglist instead of not using any. Change-Id: I370a1f21238efd155b46f0e7071734f5d3c6c343 Reviewed-by: Laszlo Agocs Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsopengltester.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 4ca7f0e413..c24e0ba0ae 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -246,15 +246,16 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c if (!glesOnly && testDesktopGL()) result |= QWindowsOpenGLTester::DesktopGl; - QSet features; const char bugListFileVar[] = "QT_OPENGL_BUGLIST"; + QString buglistFileName = QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json"); + if (qEnvironmentVariableIsSet(bugListFileVar)) { const QString fileName = resolveBugListFile(QFile::decodeName(qgetenv(bugListFileVar))); if (!fileName.isEmpty()) - features = QOpenGLConfig::gpuFeatures(qgpu, fileName); - } else { - features = QOpenGLConfig::gpuFeatures(qgpu, QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json")); + buglistFileName = fileName; } + + QSet features = QOpenGLConfig::gpuFeatures(qgpu, buglistFileName); qCDebug(lcQpaGl) << "GPU features:" << features; if (features.contains(QStringLiteral("disable_desktopgl"))) { // Qt-specific -- cgit v1.2.3 From 21c8a66a152e3184d8f965dc4cf2a1bee234780d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 11 Jul 2016 13:00:15 -0700 Subject: QCocoaMenuBar: Sync items only when they are attached to a menu Another one of Cocoa's capricious behaviors. Evidence shows that the menu item's submenu property needs to be set before we can set the item's hidden property. We ensure this is the case by getting the NSMenuItem through QCocoaMenu::attachedItem() instead of QCocoaMenuBar::nativeItemForMenu() in QCocoaMenuBar::syncMenu(). Change-Id: Id50356dae5f556fa3d745ba9a5982e5a72bf0ac2 Task-number: QTBUG-54637 Reviewed-by: Jake Petroules Reviewed-by: Jason Haslam --- src/plugins/platforms/cocoa/qcocoamenubar.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index a534d2064e..9b03ea17c4 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -173,9 +173,11 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu) } } - NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu); - nativeMenuItem.title = cocoaMenu->nsMenu().title; - nativeMenuItem.hidden = shouldHide; + if (NSMenuItem *attachedItem = cocoaMenu->attachedItem()) { + // Non-nil attached item means the item's submenu is set + attachedItem.title = cocoaMenu->nsMenu().title; + attachedItem.hidden = shouldHide; + } } NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const -- cgit v1.2.3 From 6bb0bc73c809d1defdcedc31c4c464a129d3de4d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 14 Jul 2016 09:35:50 +0200 Subject: QWindowsTheme: Fix the available file icon sizes 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 --- src/plugins/platforms/windows/qwindowscontext.cpp | 3 ++ src/plugins/platforms/windows/qwindowstheme.cpp | 49 +++++++++++++++++------ src/plugins/platforms/windows/qwindowstheme.h | 5 +++ 3 files changed, 45 insertions(+), 12 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 39054b6a64..b6118431d3 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -41,6 +41,7 @@ #include "qwindowsmime.h" #include "qwindowsinputcontext.h" #include "qwindowstabletsupport.h" +#include "qwindowstheme.h" #include #ifndef QT_NO_ACCESSIBILITY # include "accessible/qwindowsaccessibility.h" @@ -1007,6 +1008,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #endif case QtWindows::DisplayChangedEvent: return d->m_screenManager.handleDisplayChange(wParam, lParam); + if (QWindowsTheme *t = QWindowsTheme::instance()) + t->displayChanged(); case QtWindows::SettingChangedEvent: return d->m_screenManager.handleScreenChanges(); default: diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index f673ce5c25..ce0c69f9ed 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -329,6 +329,7 @@ QWindowsTheme::QWindowsTheme() std::fill(m_fonts, m_fonts + NFonts, static_cast(0)); std::fill(m_palettes, m_palettes + NPalettes, static_cast(0)); refresh(); + refreshIconPixmapSizes(); } QWindowsTheme::~QWindowsTheme() @@ -394,16 +395,8 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const return QVariant(int(WindowsKeyboardScheme)); case UiEffects: return QVariant(uiEffects()); - case IconPixmapSizes: { - QList sizes; - sizes << 16 << 32; -#ifdef USE_IIMAGELIST - sizes << 48; // sHIL_EXTRALARGE - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) - sizes << 256; // SHIL_JUMBO -#endif // USE_IIMAGELIST - return QVariant::fromValue(sizes); - } + case IconPixmapSizes: + return m_fileIconSizes; case DialogSnapToDefaultButton: return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false)); case ContextMenuOnMouseRelease: @@ -473,6 +466,15 @@ void QWindowsTheme::refreshFonts() #endif // !Q_OS_WINCE } +enum FileIconSize { + // Standard icons obtainable via shGetFileInfo(), SHGFI_SMALLICON, SHGFI_LARGEICON + SmallFileIcon, LargeFileIcon, + // Larger icons obtainable via SHGetImageList() + ExtraLargeFileIcon, + JumboFileIcon, // Vista onwards + FileIconSizeCount +}; + bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const { return QWindowsDialogs::useHelper(type); @@ -489,6 +491,27 @@ void QWindowsTheme::windowsThemeChanged(QWindow * window) QWindowSystemInterface::handleThemeChange(window); } +static int fileIconSizes[FileIconSizeCount]; + +void QWindowsTheme::refreshIconPixmapSizes() +{ + // Standard sizes: 16, 32, 48, 256 + fileIconSizes[SmallFileIcon] = GetSystemMetrics(SM_CXSMICON); // corresponds to SHGFI_SMALLICON); + fileIconSizes[LargeFileIcon] = GetSystemMetrics(SM_CXICON); // corresponds to SHGFI_LARGEICON + fileIconSizes[ExtraLargeFileIcon] = + fileIconSizes[LargeFileIcon] + fileIconSizes[LargeFileIcon] / 2; + fileIconSizes[JumboFileIcon] = 8 * fileIconSizes[LargeFileIcon]; // empirical, has not been observed to work + QList sizes; + sizes << fileIconSizes[SmallFileIcon] << fileIconSizes[LargeFileIcon]; +#ifdef USE_IIMAGELIST + sizes << fileIconSizes[ExtraLargeFileIcon]; // sHIL_EXTRALARGE + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) + sizes << fileIconSizes[JumboFileIcon]; // SHIL_JUMBO +#endif // USE_IIMAGELIST + qCDebug(lcQpaWindows) << __FUNCTION__ << sizes; + m_fileIconSizes = QVariant::fromValue(sizes); +} + // Defined in qpixmap_win.cpp Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); @@ -706,10 +729,12 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s QPixmap pixmap; const QString filePath = QDir::toNativeSeparators(fileInfo.filePath()); const int width = int(size.width()); - const int iconSize = width > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON; + const int iconSize = width > fileIconSizes[SmallFileIcon] ? SHGFI_LARGEICON : SHGFI_SMALLICON; const int requestedImageListSize = #ifdef USE_IIMAGELIST - width > 48 ? sHIL_JUMBO : (width > 32 ? sHIL_EXTRALARGE : 0); + width > fileIconSizes[ExtraLargeFileIcon] + ? sHIL_JUMBO + : (width > fileIconSizes[LargeFileIcon] ? sHIL_EXTRALARGE : 0); #else 0; #endif // !USE_IIMAGELIST diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h index cacde98601..aafcf320aa 100644 --- a/src/plugins/platforms/windows/qwindowstheme.h +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -37,6 +37,8 @@ #include "qwindowsthreadpoolrunner.h" #include +#include + QT_BEGIN_NAMESPACE class QWindow; @@ -62,6 +64,7 @@ public: QPlatformTheme::IconOptions iconOptions = 0) const Q_DECL_OVERRIDE; void windowsThemeChanged(QWindow *window); + void displayChanged() { refreshIconPixmapSizes(); } static const char *name; @@ -71,11 +74,13 @@ private: void refreshPalettes(); void clearFonts(); void refreshFonts(); + void refreshIconPixmapSizes(); static QWindowsTheme *m_instance; QPalette *m_palettes[NPalettes]; QFont *m_fonts[NFonts]; mutable QWindowsThreadPoolRunner m_threadPoolRunner; + QVariant m_fileIconSizes; }; QT_END_NAMESPACE -- cgit v1.2.3 From 9a00ae8e24a03b25476cc6200bddf4c8fc510733 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 14 Jul 2016 15:00:23 +0200 Subject: Windows QPA: Add warning to setHasBorderInFullScreen() Emit a warning when the function is called before show() as it does not have any effect in that case. Amends change 69839e55c13000ee9bf8d8e9d74b70096a92ae51. Task-number: QTBUG-41309 Change-Id: I7c2bb21735d8e41d525c5e00213b0e278ae5c774 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9c6cb53365..e4888d6b87 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2402,9 +2402,10 @@ void QWindowsWindow::aboutToMakeCurrent() void QWindowsWindow::setHasBorderInFullScreenStatic(QWindow *window, bool border) { - if (!window->handle()) - return; - static_cast(window->handle())->setHasBorderInFullScreen(border); + if (QPlatformWindow *handle = window->handle()) + static_cast(handle)->setHasBorderInFullScreen(border); + else + qWarning("%s invoked without window handle; call has no effect.", Q_FUNC_INFO); } void QWindowsWindow::setHasBorderInFullScreen(bool border) -- cgit v1.2.3