From c5b19f252188a01dd7b12090f4776420e3714000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 28 Nov 2013 15:33:06 +0100 Subject: iOS: Forward [UIApplicationDelegate handleOpenURL:] to QDesktopServices The user may use QDesktopServices::setUrlHandler() in combination with the appropriate Info.plist keys (CFBundleURLTypes, CFBundleURLSchemes) to react to URL requests from other applications. This is among other things useful for handling OAuth authentication from applications such as Dropbox. See: https://www.dropbox.com/developers/core/start/ios We protect against recursive URL opening, but an application may still redirect a request to open a URL by opening another URL, eg a website. Task-number: QTBUG-35201 Change-Id: I9f1d246206c5594b1b65bb11fa98c6bcdefc443e Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 20 ++++++++++++++++++++ src/plugins/platforms/ios/qiosservices.h | 7 +++++++ src/plugins/platforms/ios/qiosservices.mm | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index cf702c82af..9cf1047a6b 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -41,9 +41,14 @@ #include "qiosapplicationdelegate.h" +#include "qiosintegration.h" +#include "qiosservices.h" #include "qiosviewcontroller.h" #include "qioswindow.h" +#include +#include + #include @implementation QIOSApplicationDelegate @@ -82,6 +87,21 @@ return YES; } +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +{ + Q_UNUSED(application); + Q_UNUSED(sourceApplication); + Q_UNUSED(annotation); + + if (!QGuiApplication::instance()) + return NO; + + QIOSIntegration *iosIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + QIOSServices *iosServices = static_cast(iosIntegration->services()); + + return iosServices->handleUrl(QUrl::fromNSURL(url)); +} + - (void)dealloc { [window release]; diff --git a/src/plugins/platforms/ios/qiosservices.h b/src/plugins/platforms/ios/qiosservices.h index 692b3a0b99..aa39fbbed4 100644 --- a/src/plugins/platforms/ios/qiosservices.h +++ b/src/plugins/platforms/ios/qiosservices.h @@ -41,6 +41,8 @@ #ifndef QIOSSERVICES_H #define QIOSSERVICES_H + +#include #include QT_BEGIN_NAMESPACE @@ -50,6 +52,11 @@ class QIOSServices : public QPlatformServices public: bool openUrl(const QUrl &url); bool openDocument(const QUrl &url); + + bool handleUrl(const QUrl &url); + +private: + QUrl m_handlingUrl; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm index 32203aeb71..0ac6c590ca 100644 --- a/src/plugins/platforms/ios/qiosservices.mm +++ b/src/plugins/platforms/ios/qiosservices.mm @@ -42,6 +42,7 @@ #include "qiosservices.h" #include +#include #import @@ -49,6 +50,9 @@ QT_BEGIN_NAMESPACE bool QIOSServices::openUrl(const QUrl &url) { + if (url == m_handlingUrl) + return false; + if (url.scheme().isEmpty()) return openDocument(url); @@ -66,4 +70,19 @@ bool QIOSServices::openDocument(const QUrl &url) return QPlatformServices::openDocument(url); } +/* Callback from iOS that the application should handle a URL */ +bool QIOSServices::handleUrl(const QUrl &url) +{ + QUrl previouslyHandling = m_handlingUrl; + m_handlingUrl = url; + + // FIXME: Add platform services callback from QDesktopServices::setUrlHandler + // so that we can warn the user if calling setUrlHandler without also setting + // up the matching keys in the Info.plist file (CFBundleURLTypes and friends). + bool couldHandle = QDesktopServices::openUrl(url); + + m_handlingUrl = previouslyHandling; + return couldHandle; +} + QT_END_NAMESPACE -- cgit v1.2.3 From 9b782dca45331c0e0246b8439d5cf007a440afc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 27 Nov 2013 18:20:10 +0100 Subject: iOS: Update screen properties when we trigger statusbar changes on iOS7 Ideally we'd have a callback from iOS when this happens, so we can also react to changes done outside of Qt, but willChangeStatusBarFrame and friends do not seem to give us what we want. Change-Id: I686ce7950395a83c4257372363c773a95c3935ed Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 57522cb1a3..96410952f9 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -189,6 +189,9 @@ void QIOSScreen::updateProperties() void QIOSScreen::updateStatusBarVisibility() { + if (!isQtApplication()) + return; + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the status @@ -199,20 +202,26 @@ void QIOSScreen::updateStatusBarVisibility() return; UIView *view = reinterpret_cast(focusWindow->handle()->winId()); + QIOSViewController *viewController = static_cast(view.viewController); + + bool currentStatusBarVisibility = [UIApplication sharedApplication].statusBarHidden; + if (viewController.prefersStatusBarHidden == currentStatusBarVisibility) + return; + #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { - [view.viewController setNeedsStatusBarAppearanceUpdate]; + [viewController setNeedsStatusBarAppearanceUpdate]; + dispatch_async(dispatch_get_main_queue(), ^{ + updateProperties(); + }); } else #endif { - bool wasHidden = [UIApplication sharedApplication].statusBarHidden; - QIOSViewController *viewController = static_cast(view.viewController); [[UIApplication sharedApplication] setStatusBarHidden:[viewController prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone]; - if ([UIApplication sharedApplication].statusBarHidden != wasHidden) - updateProperties(); + updateProperties(); } } -- cgit v1.2.3 From 0312cb3ffe3d29f7c74c142515ed4ffbc86c03ff Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 11:51:18 -0200 Subject: BlackBerry: Fix QFileDialog show()/hide() QFileDialog::show() no longer worked after the dialog had already been shown and hidden before. Task-number: QTBUG-34983 Change-Id: I7300374b74805308e0966db7b3545e5fd8470465 Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfiledialoghelper.h | 3 +++ src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index e7c68f6ff5..c2033c16d3 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -87,6 +87,9 @@ public: Q_SIGNALS: void dialogClosed(); +private Q_SLOTS: + void emitSignals(); + private: void setNameFilter(const QString &filter); void setNameFilters(const QStringList &filters); diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp index dc841eb1a9..e3b1e2dc4d 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp @@ -68,6 +68,7 @@ QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) m_selectedFilter(), m_result(QPlatformDialogHelper::Rejected) { + connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals); } QQnxFileDialogHelper::~QQnxFileDialogHelper() @@ -85,11 +86,6 @@ void QQnxFileDialogHelper::exec() QEventLoop loop; connect(m_dialog, SIGNAL(closed()), &loop, SLOT(quit())); loop.exec(); - - if (m_dialog->selectedFiles().isEmpty()) - Q_EMIT reject(); - else - Q_EMIT accept(); } bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) @@ -197,6 +193,14 @@ QString QQnxFileDialogHelper::selectedNameFilter() const return m_selectedFilter; } +void QQnxFileDialogHelper::emitSignals() +{ + if (m_dialog->selectedFiles().isEmpty()) + Q_EMIT reject(); + else + Q_EMIT accept(); +} + void QQnxFileDialogHelper::setNameFilter(const QString &filter) { qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter; -- cgit v1.2.3 From f60e38391764bf1f8d3d747472b302b1bfbdc469 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 11:52:51 -0200 Subject: BlackBerry: remove unused variable m_result is not used by qqnxfiledialoghelper_bb10.cpp, only by its playbook counterpart. Change-Id: I4fae924283560703393c5313527c5c9c2005d35b Reviewed-by: Tobias Koenig Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfiledialoghelper.h | 2 +- src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index c2033c16d3..e83fc445d6 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -99,8 +99,8 @@ private: QFileDialogOptions::AcceptMode m_acceptMode; QString m_selectedFilter; - QPlatformDialogHelper::DialogCode m_result; #if defined(Q_OS_BLACKBERRY_TABLET) + QPlatformDialogHelper::DialogCode m_result; QList m_paths; #endif }; diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp index e3b1e2dc4d..fa6e26977a 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp @@ -65,8 +65,7 @@ QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) m_integration(integration), m_dialog(new QQnxFilePicker), m_acceptMode(QFileDialogOptions::AcceptOpen), - m_selectedFilter(), - m_result(QPlatformDialogHelper::Rejected) + m_selectedFilter() { connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals); } -- cgit v1.2.3 From 2e7a90bac15ab486475884600bd55d8a04da35a0 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 17:18:37 -0200 Subject: BlackBerry: properly clean up QFileDialog files Task-number: QTBUG-34983 Change-Id: I1af5c6a9c43eba77394b11d31d1d223af8bc221f Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfilepicker.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 5229d1f1f5..56c804a5b4 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -84,6 +84,9 @@ void QQnxFilePicker::open() if (m_invocationHandle) return; + // Clear any previous results + m_selectedFiles.clear(); + int errorCode = BPS_SUCCESS; errorCode = navigator_invoke_invocation_create(&m_invocationHandle); -- cgit v1.2.3 From 26a0a3ed85008c3a0edae125fca48c7c36a7437f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 2 Dec 2013 00:26:17 +0100 Subject: Respect the custom paper size settings on Mac When the user added a custom paper size then it would be silently ignored when printing on Mac. This now ensures that it is respected when appropriate. [ChangeLog][Platform Specific Changes][OS X][QtPrintSupport] Respect the custom paper size settings when printing. Task-number: QTBUG-34700 Change-Id: I08afe24e0e67a50e9301abf4642c6f65bb0df1fe Reviewed-by: John Layt --- src/plugins/platforms/cocoa/qprintengine_mac.mm | 77 ++++++++++++++++-------- src/plugins/platforms/cocoa/qprintengine_mac_p.h | 1 + 2 files changed, 53 insertions(+), 25 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index ee8d7ea157..f363b1772f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -40,8 +40,7 @@ ****************************************************************************/ #include "qprintengine_mac_p.h" -#include -#include +#include #include #include @@ -141,30 +140,51 @@ QMacPrintEnginePrivate::~QMacPrintEnginePrivate() void QMacPrintEnginePrivate::setPaperSize(QPrinter::PaperSize ps) { Q_Q(QMacPrintEngine); - QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); - QCFType formats; + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + } + hasCustomPaperSize = (ps == QPrinter::Custom); PMPrinter printer; - - if (PMSessionGetCurrentPrinter(session(), &printer) == noErr - && PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { - CFIndex total = CFArrayGetCount(formats); - PMPageFormat tmp; - PMRect paper; - for (CFIndex idx = 0; idx < total; ++idx) { - tmp = static_cast( - const_cast(CFArrayGetValueAtIndex(formats, idx))); - PMGetUnadjustedPaperRect(tmp, &paper); - int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); - int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); - if (newSize.width() == wMM && newSize.height() == hMM) { - PMCopyPageFormat(tmp, format()); - // reset the orientation and resolution as they are lost in the copy. - q->setProperty(QPrintEngine::PPK_Orientation, orient); - if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { - // Don't know, warn for the moment. - qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { + if (ps != QPrinter::Custom) { + QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); + QCFType formats; + if (PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { + CFIndex total = CFArrayGetCount(formats); + PMPageFormat tmp; + PMRect paper; + for (CFIndex idx = 0; idx < total; ++idx) { + tmp = static_cast(const_cast(CFArrayGetValueAtIndex(formats, idx))); + PMGetUnadjustedPaperRect(tmp, &paper); + int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); + int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); + if (newSize.width() == wMM && newSize.height() == hMM) { + PMCopyPageFormat(tmp, format()); + // reset the orientation and resolution as they are lost in the copy. + q->setProperty(QPrintEngine::PPK_Orientation, orient); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + } + break; + } } - break; + } + } else { + QCFString paperId = QCFString::toCFStringRef(QUuid::createUuid().toString()); + PMPaperMargins paperMargins; + paperMargins.left = leftMargin; + paperMargins.top = topMargin; + paperMargins.right = rightMargin; + paperMargins.bottom = bottomMargin; + PMPaperCreateCustom(printer, paperId, QCFString("Custom size"), customSize.width(), customSize.height(), &paperMargins, &customPaper); + PMPageFormat tmp; + PMCreatePageFormatWithPMPaper(&tmp, customPaper); + PMCopyPageFormat(tmp, format()); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting paper name"); } } } @@ -183,6 +203,11 @@ QPrinter::PaperSize QMacPrintEnginePrivate::paperSize() const void QMacPrintEnginePrivate::setPaperName(const QString &name) { Q_Q(QMacPrintEngine); + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + hasCustomPaperSize = false; + } PMPrinter printer; if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { @@ -419,6 +444,8 @@ void QMacPrintEnginePrivate::releaseSession() { PMSessionEndPageNoDialog(session()); PMSessionEndDocumentNoDialog(session()); + if (hasCustomPaperSize) + PMRelease(customPaper); [printInfo release]; printInfo = 0; } @@ -665,10 +692,10 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va { PMOrientation orientation; PMGetOrientation(d->format(), &orientation); - d->hasCustomPaperSize = true; d->customSize = value.toSizeF(); if (orientation != kPMPortrait) d->customSize = QSizeF(d->customSize.height(), d->customSize.width()); + d->setPaperSize(QPrinter::Custom); break; } case PPK_PageMargins: diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h index 28183118d8..644a07184f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h +++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h @@ -135,6 +135,7 @@ public: qreal rightMargin; qreal bottomMargin; QHash valueCache; + PMPaper customPaper; QMacPrintEnginePrivate() : mode(QPrinter::ScreenResolution), state(QPrinter::Idle), orient(QPrinter::Portrait), printInfo(0), paintEngine(0), hasCustomPaperSize(false), hasCustomPageMargins(false) {} -- cgit v1.2.3 From 1f6c4a514c6bbc9bdc50aff4c0079ffccfffe76f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 29 Nov 2013 12:35:52 +0100 Subject: Use case insensitive comparison when checking platform plugin keys. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iff44698dcc941ca244b476f0e6c6a993f2ad75f3 Reviewed-by: Kevin Krammer Reviewed-by: Jørgen Lind --- src/plugins/platforms/android/src/androidplatformplugin.cpp | 2 +- src/plugins/platforms/cocoa/main.mm | 3 +-- src/plugins/platforms/directfb/main.cpp | 2 +- src/plugins/platforms/eglfs/main.cpp | 2 +- src/plugins/platforms/ios/plugin.mm | 2 +- src/plugins/platforms/kms/main.cpp | 2 +- src/plugins/platforms/linuxfb/main.cpp | 2 +- src/plugins/platforms/minimal/main.cpp | 2 +- src/plugins/platforms/minimalegl/main.cpp | 2 +- src/plugins/platforms/offscreen/main.cpp | 2 +- src/plugins/platforms/openwfd/main.cpp | 2 +- src/plugins/platforms/qnx/main.cpp | 2 +- src/plugins/platforms/xcb/main.cpp | 2 +- 13 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/src/androidplatformplugin.cpp b/src/plugins/platforms/android/src/androidplatformplugin.cpp index 79e23c2d32..2cf5aa1e01 100644 --- a/src/plugins/platforms/android/src/androidplatformplugin.cpp +++ b/src/plugins/platforms/android/src/androidplatformplugin.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QAndroidPlatformIntegrationPlugin::create(const QString &key, const QStringList ¶mList) { Q_UNUSED(paramList); - if (key.toLower() == "android") + if (!key.compare(QLatin1String("android"), Qt::CaseInsensitive)) return new QAndroidPlatformIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index b730514b12..dd063b5da0 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -61,8 +61,7 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co Q_UNUSED(paramList); QCocoaAutoReleasePool pool; - - if (system.toLower() == "cocoa") + if (!system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive)) return new QCocoaIntegration; return 0; diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 5ba1b0996b..423e33efd5 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -68,7 +68,7 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, Q_UNUSED(paramList); QDirectFbIntegration *integration = 0; - if (system.toLower() == "directfb") + if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive)) integration = new QDirectFbIntegration; QT_EGL_BACKEND_CREATE(system, integration) diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index d8e7a3792e..245f2a6236 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "eglfs") + if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) return new QEglFSIntegration; return 0; diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index efb1ad8d74..3505e39a0b 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -56,7 +56,7 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "ios") + if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)) return new QIOSIntegration; return 0; diff --git a/src/plugins/platforms/kms/main.cpp b/src/plugins/platforms/kms/main.cpp index db0582e694..3027e23c04 100644 --- a/src/plugins/platforms/kms/main.cpp +++ b/src/plugins/platforms/kms/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration *QKmsIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "kms") + if (!system.compare(QLatin1String("kms"), Qt::CaseInsensitive)) return new QKmsIntegration; return 0; diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 579984d2fc..27aa91aefe 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "linuxfb") + if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) return new QLinuxFbIntegration(paramList); return 0; diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 7846b5b387..a690a13d81 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "minimal") + if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) return new QMinimalIntegration; return 0; diff --git a/src/plugins/platforms/minimalegl/main.cpp b/src/plugins/platforms/minimalegl/main.cpp index c951bfb0dc..be85fa082e 100644 --- a/src/plugins/platforms/minimalegl/main.cpp +++ b/src/plugins/platforms/minimalegl/main.cpp @@ -63,7 +63,7 @@ QStringList QMinimalEglIntegrationPlugin::keys() const QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "minimalegl") + if (!system.compare(QLatin1String("minimalegl"), Qt::CaseInsensitive)) return new QMinimalEglIntegration; return 0; diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index f48451d00d..e89116351b 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "offscreen") + if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) return QOffscreenIntegration::createOffscreenIntegration(); return 0; diff --git a/src/plugins/platforms/openwfd/main.cpp b/src/plugins/platforms/openwfd/main.cpp index cea3c50e56..5f5d7594cd 100644 --- a/src/plugins/platforms/openwfd/main.cpp +++ b/src/plugins/platforms/openwfd/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QOpenWFDIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "openwfd") + if (!system.compare(QLatin1String("openwfd"), Qt::CaseInsensitive)) return new QOpenWFDIntegration; return 0; diff --git a/src/plugins/platforms/qnx/main.cpp b/src/plugins/platforms/qnx/main.cpp index fb81928625..50779d3e12 100644 --- a/src/plugins/platforms/qnx/main.cpp +++ b/src/plugins/platforms/qnx/main.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - if (system.toLower() == QLatin1String("qnx")) + if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) return new QQnxIntegration(paramList); return 0; diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index e114827703..f21ea03cf5 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) { - if (system.toLower() == "xcb") + if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) return new QXcbIntegration(parameters, argc, argv); return 0; -- cgit v1.2.3 From 28d77c24c2deec2eee8c735b299f0da792d75c9f Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 2 Dec 2013 11:15:31 +0200 Subject: xcb qpa: initialize EGL for non-XLib builds Move the EGL initialization code outside of the XLib ifdefs, so it can be enabled for non-XLib builds as well Change-Id: Ie025551e4e99bb0b365f025356bd9725f4283b82 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 4d2735ca85..c00b4d551b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -274,21 +274,22 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra XSetEventQueueOwner(dpy, XCBOwnsEventQueue); XSetErrorHandler(nullErrorHandler); m_xlib_display = dpy; -#ifdef XCB_USE_EGL - EGLDisplay eglDisplay = eglGetDisplay(dpy); - m_egl_display = eglDisplay; - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - m_has_egl = eglInitialize(eglDisplay,&major,&minor); -#endif //XCB_USE_EGL } #else + EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY; m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen); #endif //XCB_USE_XLIB if (!m_connection || xcb_connection_has_error(m_connection)) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); +#ifdef XCB_USE_EGL + EGLDisplay eglDisplay = eglGetDisplay(dpy); + m_egl_display = eglDisplay; + EGLint major, minor; + m_has_egl = eglInitialize(eglDisplay, &major, &minor); +#endif //XCB_USE_EGL + m_reader = new QXcbEventReader(this); m_reader->start(); -- cgit v1.2.3 From 17333720e05bbe5d84d246c0850c8c2c047a141e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 29 Nov 2013 12:06:45 +0100 Subject: Minimal plugin: Use a dummy font database for command line tools. Suppress warnings like: QFontDatabase: Cannot find font directory '...' - is Qt installed correctly? occurring for example when using qmlplugindump. Add option flags (similar to Windows plugin) to the integration class to be used for QT_DEBUG_BACKINGSTORE and other functionality. Add a dummy font database with empty populate() function to be used unless the debug flag for the backing store is used. Task-number: QTBUG-33674 Task-number: QTCREATORBUG-10685 Change-Id: I7eaff3025de12e6b0471a3430f986b0cd810e22c Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/minimal/main.cpp | 3 +- .../platforms/minimal/qminimalbackingstore.cpp | 6 +-- .../platforms/minimal/qminimalbackingstore.h | 2 +- .../platforms/minimal/qminimalintegration.cpp | 50 +++++++++++++++++++++- .../platforms/minimal/qminimalintegration.h | 17 +++++++- 5 files changed, 70 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index a690a13d81..5e0388a0af 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -55,9 +55,8 @@ public: QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - Q_UNUSED(paramList); if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) - return new QMinimalIntegration; + return new QMinimalIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp index 3aac1bfe33..f58458cd31 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.cpp +++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp @@ -41,6 +41,7 @@ #include "qminimalbackingstore.h" +#include "qminimalintegration.h" #include "qscreen.h" #include #include @@ -49,10 +50,9 @@ QT_BEGIN_NAMESPACE QMinimalBackingStore::QMinimalBackingStore(QWindow *window) - : QPlatformBackingStore(window),mDebug(false) + : QPlatformBackingStore(window) + , mDebug(QMinimalIntegration::instance()->options() & QMinimalIntegration::DebugBackingStore) { - if (QT_PREPEND_NAMESPACE(qgetenv)("QT_DEBUG_BACKINGSTORE").toInt() > 0) - mDebug = true; if (mDebug) qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (quintptr)this; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h index 5f1fd0f4d3..9265a09d18 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.h +++ b/src/plugins/platforms/minimal/qminimalbackingstore.h @@ -60,7 +60,7 @@ public: private: QImage mImage; - bool mDebug; + const bool mDebug; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index a08cede76a..76b4b5b0eb 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -50,11 +50,31 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -QMinimalIntegration::QMinimalIntegration() +static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE"; + +static inline unsigned parseOptions(const QStringList ¶mList) +{ + unsigned options = 0; + foreach (const QString ¶m, paramList) { + if (param == QLatin1String("enable_fonts")) + options |= QMinimalIntegration::EnableFonts; + } + return options; +} + +QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters) + : m_dummyFontDatabase(0) + , m_options(parseOptions(parameters)) { + if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable) + && qgetenv(debugBackingStoreEnvironmentVariable).toInt() > 0) { + m_options |= DebugBackingStore | EnableFonts; + } + QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); @@ -64,6 +84,11 @@ QMinimalIntegration::QMinimalIntegration() screenAdded(mPrimaryScreen); } +QMinimalIntegration::~QMinimalIntegration() +{ + delete m_dummyFontDatabase; +} + bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { @@ -73,6 +98,24 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } +// Dummy font database that does not scan the fonts directory to be +// used for command line tools like qmlplugindump that do not create windows +// unless DebugBackingStore is activated. +class DummyFontDatabase : public QPlatformFontDatabase +{ +public: + virtual void populateFontDatabase() {} +}; + +QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const +{ + if (m_options & EnableFonts) + return QPlatformIntegration::fontDatabase(); + if (!m_dummyFontDatabase) + m_dummyFontDatabase = new DummyFontDatabase; + return m_dummyFontDatabase; +} + QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const { Q_UNUSED(window); @@ -95,4 +138,9 @@ QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const #endif } +QMinimalIntegration *QMinimalIntegration::instance() +{ + return static_cast(QGuiApplicationPrivate::platformIntegration()); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 7dc01e1d51..a737057085 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -67,13 +67,28 @@ public: class QMinimalIntegration : public QPlatformIntegration { public: - QMinimalIntegration(); + enum Options { // Options to be passed on command line or determined from environment + DebugBackingStore = 0x1, + EnableFonts = 0x2 + }; + + explicit QMinimalIntegration(const QStringList ¶meters); + ~QMinimalIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; + QPlatformFontDatabase *fontDatabase() const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QAbstractEventDispatcher *createEventDispatcher() const; + + unsigned options() const { return m_options; } + + static QMinimalIntegration *instance(); + +private: + mutable QPlatformFontDatabase *m_dummyFontDatabase; + unsigned m_options; }; QT_END_NAMESPACE -- cgit v1.2.3 From 2b70b318e39aaee6f6d2988c6666666d1a9f4188 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 3 Dec 2013 15:02:24 +0200 Subject: Android: use binary name when using loadClass. QtAndroid::findClass uses loadClass methods to find Qt's java classes. The documentation says that we should use a binary name. Change-Id: I2146789235435b7052827cde58b7719b7d62dc1d Reviewed-by: Christian Stromme --- src/plugins/platforms/android/src/qandroidinputcontext.cpp | 4 ++-- src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 8556e8ebf1..326972e71e 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE static QAndroidInputContext *m_androidInputContext = 0; -static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection"; -static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText"; +static char const *const QtNativeInputConnectionClassName = "org.qtproject.qt5.android.QtNativeInputConnection"; +static char const *const QtExtractedTextClassName = "org.qtproject.qt5.android.QtExtractedText"; static jclass m_extractedTextClass = 0; static jmethodID m_classConstructorMethodID = 0; static jfieldID m_partialEndOffsetFieldID = 0; diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp index f379402e18..4c91e76e0f 100644 --- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -184,7 +184,7 @@ static JNINativeMethod methods[] = { bool registerNatives(JNIEnv *env) { - jclass clazz = QtAndroid::findClass("org/qtproject/qt5/android/QtMessageDialogHelper", env); + jclass clazz = QtAndroid::findClass("org.qtproject.qt5.android.QtMessageDialogHelper", env); if (!clazz) { __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt() , "org/qtproject/qt5/android/QtMessageDialogHelper"); -- cgit v1.2.3 From ec03058fa5b84b4570a2158bf2179f7ba4d83b99 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 Dec 2013 12:03:33 +0100 Subject: Clear QCocoaGLContext's m_currentWindow when window is hidden. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-35363 Change-Id: I1b3d883ed10200af8a2d4188fb1725b36eb78022 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 2 ++ src/plugins/platforms/cocoa/qcocoaglcontext.mm | 10 ++++++++++ src/plugins/platforms/cocoa/qcocoawindow.mm | 2 ++ 3 files changed, 14 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index e1d4b602c9..30f1cdc278 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -75,6 +75,8 @@ public: bool isSharing() const; bool isValid() const; + void windowWasHidden(); + private: void setActiveWindow(QWindow *window); void updateSurfaceFormat(); diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 144144338f..777d4a871b 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -165,6 +165,16 @@ QSurfaceFormat QCocoaGLContext::format() const return m_format; } +void QCocoaGLContext::windowWasHidden() +{ + // If the window is hidden, we need to unset the m_currentWindow + // variable so that succeeding makeCurrent's will not abort prematurely + // because of the optimization in setActiveWindow. + // Doing a full doneCurrent here is not preferable, because the GL context + // might be rendering in a different thread at this time. + m_currentWindow.clear(); +} + void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) { QWindow *window = static_cast(surface)->window(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b5b9cec2be..1aace958ed 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -388,6 +388,8 @@ void QCocoaWindow::setVisible(bool visible) [m_contentView setHidden:NO]; } else { // qDebug() << "close" << this; + if (m_glContext) + m_glContext->windowWasHidden(); if (m_nsWindow) { if (m_hasModalSession) { QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); -- cgit v1.2.3 From 95822e28e2b83730bab01b0c2f79f3c5a17d4090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:32:47 +0100 Subject: iOS: Don't claim that windows with zero width and/or height are exposed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When sending expose events to Qt, Qt will ask us if we're exposed, and we need to tell it that we're not, so that clients will not try to makeCurrent on a CA layer that has a zero width and/or height. Note that this only works because we flush expose events. Change-Id: Idfbe03a2f35681084061376a3c650a8da027fda4 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.h | 2 ++ src/plugins/platforms/ios/qioswindow.mm | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index a5e122bda1..d36a81180c 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -74,6 +74,8 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation); void setVisible(bool visible); + bool isExposed() const Q_DECL_OVERRIDE; + void raise() { raiseOrLower(true); } void lower() { raiseOrLower(false); } void requestActivateWindow(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 0dd810bdf6..587ecad61c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -579,6 +579,11 @@ void QIOSWindow::applyGeometry(const QRect &rect) [m_view layoutIfNeeded]; } +bool QIOSWindow::isExposed() const +{ + return window()->isVisible() && !window()->geometry().isEmpty(); +} + void QIOSWindow::setWindowState(Qt::WindowState state) { // Update the QWindow representation straight away, so that -- cgit v1.2.3 From cd1ce77bf8a3520dee1c2703405c2bf2762360a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:35:28 +0100 Subject: iOS: Apply default geometry to platform window if not set on QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a platform window is created from a QWindow without setting a valid size or position on the QWindow, the platform window is expected to apply sane defaults. We use the baseclass initialGeometry() function for this, similar to other platform plugins. The default geometry unless otherwise set and/or calculated based on size hints is that of the screen's available geometry. An improvement to this is to detect whenever we apply the screen geometry, and also apply the appropriate window state, but that needs more testing. Change-Id: I02b12064ce6d55c04fe0cc2cd1d2816ca1113f40 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 587ecad61c..7ab136e8b9 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -449,10 +449,18 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) - , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { setParent(QPlatformWindow::parent()); + + // Resolve default window geometry in case it was not set before creating the + // platform window. This picks up eg. minimum-size if set, and defaults to + // the "maxmized" geometry (even though we're not in that window state). + // FIXME: Detect if we apply a maximized geometry and send a window state + // change event in that case. + m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(), + screen()->availableGeometry().width(), screen()->availableGeometry().height()); + setWindowState(window->windowState()); } -- cgit v1.2.3