summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-18 09:29:17 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-20 08:00:26 +0200
commite32f1a4d61f0c55d066a43657ad607131be8ca34 (patch)
tree81ea388722187e1650b2c2b2d9c22eafae5c0527 /src
parentfdb956a3ede6cb0a25112c1e1af6c93fd2051de1 (diff)
parentee2eed350f95285b65e3dd9647e5f366e16fd5a4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
Diffstat (limited to 'src')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java7
-rw-r--r--src/corelib/global/qcompilerdetection.h22
-rw-r--r--src/corelib/global/qglobal.cpp42
-rw-r--r--src/corelib/global/qsysinfo.h8
-rw-r--r--src/corelib/global/qsystemdetection.h27
-rw-r--r--src/corelib/io/qfileselector.cpp6
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h3
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp59
-rw-r--r--src/corelib/kernel/qfunctions_winrt.h3
-rw-r--r--src/corelib/kernel/qmetaobject.h2
-rw-r--r--src/corelib/kernel/qppsobject.cpp4
-rw-r--r--src/corelib/thread/qthread_unix.cpp55
-rw-r--r--src/corelib/tools/qstring.cpp1
-rw-r--r--src/gui/image/qiconloader.cpp2
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/image/qimage.h2
-rw-r--r--src/gui/image/qimage_conversions.cpp19
-rw-r--r--src/gui/text/qdistancefield.cpp7
-rw-r--r--src/gui/text/qdistancefield_p.h4
-rw-r--r--src/network/network.pro3
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp90
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm2
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp1
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp12
-rw-r--r--src/plugins/platforms/ios/qiosapplicationstate.h7
-rw-r--r--src/plugins/platforms/ios/qiosapplicationstate.mm134
-rw-r--r--src/plugins/platforms/ios/qioscontext.h5
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm159
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h5
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm58
-rw-r--r--src/plugins/platforms/ios/qioswindow.h4
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm11
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri2
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro2
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h4
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp43
41 files changed, 524 insertions, 315 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 48510b3fdf..04b8e6a06f 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -93,6 +93,7 @@ public class QtNative
private static final int m_moveThreshold = 0;
private static ClipboardManager m_clipboardManager = null;
private static Method m_checkSelfPermissionMethod = null;
+ private static Boolean m_tabletEventSupported = null;
private static final Runnable runPendingCppRunnablesRunnable = new Runnable() {
@Override
public void run() {
@@ -385,6 +386,9 @@ public class QtNative
{
int pointerType = 0;
+ if (m_tabletEventSupported == null)
+ m_tabletEventSupported = isTabletEventSupported();
+
switch (event.getToolType(0)) {
case MotionEvent.TOOL_TYPE_STYLUS:
pointerType = 1; // QTabletEvent::Pen
@@ -395,7 +399,7 @@ public class QtNative
// TODO TOOL_TYPE_MOUSE
}
- if (pointerType != 0) {
+ if (m_tabletEventSupported && pointerType != 0) {
tabletEvent(id, event.getDeviceId(), event.getEventTime(), event.getAction(), pointerType,
event.getButtonState(), event.getX(), event.getY(), event.getPressure());
} else {
@@ -762,6 +766,7 @@ public class QtNative
// pointer methods
// tablet methods
+ public static native boolean isTabletEventSupported();
public static native void tabletEvent(int winId, int deviceId, long time, int action, int pointerType, int buttonState, float x, float y, float pressure);
// tablet methods
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 669ab136ac..33e42a944d 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1073,16 +1073,18 @@
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
#endif
-#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR constexpr
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR constexpr
-#elif defined Q_COMPILER_CONSTEXPR
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR const
+#if defined Q_COMPILER_CONSTEXPR
+# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR constexpr
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR constexpr
+# else
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR const
+# endif
#else
# define Q_DECL_CONSTEXPR
# define Q_DECL_RELAXED_CONSTEXPR
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6ca2ecff91..d87e4da9f7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1187,6 +1187,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_10_9 OS X 10.9
\value MV_10_10 OS X 10.10
\value MV_10_11 OS X 10.11
+ \value MV_10_12 macOS 10.12
\value MV_Unknown An unknown and currently unsupported platform
\value MV_CHEETAH Apple codename for MV_10_0
@@ -1201,6 +1202,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_MAVERICKS Apple codename for MV_10_9
\value MV_YOSEMITE Apple codename for MV_10_10
\value MV_ELCAPITAN Apple codename for MV_10_11
+ \value MV_SIERRA Apple codename for MV_10_12
\value MV_IOS iOS (any)
\value MV_IOS_4_3 iOS 4.3
@@ -1216,6 +1218,10 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_IOS_8_3 iOS 8.3
\value MV_IOS_8_4 iOS 8.4
\value MV_IOS_9_0 iOS 9.0
+ \value MV_IOS_9_1 iOS 9.1
+ \value MV_IOS_9_2 iOS 9.2
+ \value MV_IOS_9_3 iOS 9.3
+ \value MV_IOS_10_0 iOS 10.0
\value MV_None Not a Darwin operating system
@@ -1230,10 +1236,24 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
+ \macro Q_OS_MAC
+ \relates <QtGlobal>
+
+ Deprecated synonym for \c Q_OS_DARWIN. Do not use.
+ */
+
+/*!
\macro Q_OS_OSX
\relates <QtGlobal>
- Defined on OS X.
+ Deprecated synonym for \c Q_OS_MACOS. Do not use.
+ */
+
+/*!
+ \macro Q_OS_MACOS
+ \relates <QtGlobal>
+
+ Defined on macOS.
*/
/*!
@@ -2648,10 +2668,12 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X
+ \b{Darwin, OS X and iOS note}: this function returns "macos" for macOS
systems, "ios" for iOS systems and "darwin" in case the system could not be
determined.
+ \b{OS X note}: this function returns "osx" for versions of macOS prior to 10.12.
+
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2683,8 +2705,11 @@ QString QSysInfo::productType()
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
-#elif defined(Q_OS_OSX)
- return QStringLiteral("osx");
+#elif defined(Q_OS_MACOS)
+ const QAppleOperatingSystemVersion version = qt_apple_os_version();
+ if (version.major == 10 && version.minor < 12)
+ return QStringLiteral("osx");
+ return QStringLiteral("macos");
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
@@ -2766,7 +2791,7 @@ QString QSysInfo::prettyProductName()
{
#if defined(Q_OS_IOS)
return QLatin1String("iOS ") + productVersion();
-#elif defined(Q_OS_OSX)
+#elif defined(Q_OS_MACOS)
// get the known codenames
const char *basename = 0;
switch (int(MacintoshVersion)) {
@@ -2800,12 +2825,15 @@ QString QSysInfo::prettyProductName()
case MV_ELCAPITAN:
basename = "OS X El Capitan (";
break;
+ case MV_SIERRA:
+ basename = "macOS Sierra (";
+ break;
}
if (basename)
return QLatin1String(basename) + productVersion() + QLatin1Char(')');
- // a future version of OS X
- return QLatin1String("OS X ") + productVersion();
+ // a future version of macOS
+ return QLatin1String("macOS ") + productVersion();
#elif defined(Q_OS_WINPHONE)
return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
#elif defined(Q_OS_WIN)
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index b74fc80468..d1a4102f29 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -145,6 +145,7 @@ public:
MV_10_9 = Q_MV_OSX(10, 9),
MV_10_10 = Q_MV_OSX(10, 10),
MV_10_11 = Q_MV_OSX(10, 11),
+ MV_10_12 = Q_MV_OSX(10, 12),
/* codenames */
MV_CHEETAH = MV_10_0,
@@ -159,6 +160,7 @@ public:
MV_MAVERICKS = MV_10_9,
MV_YOSEMITE = MV_10_10,
MV_ELCAPITAN = MV_10_11,
+ MV_SIERRA = MV_10_12,
/* iOS */
MV_IOS = 1 << 8,
@@ -174,7 +176,11 @@ public:
MV_IOS_8_2 = Q_MV_IOS(8, 2),
MV_IOS_8_3 = Q_MV_IOS(8, 3),
MV_IOS_8_4 = Q_MV_IOS(8, 4),
- MV_IOS_9_0 = Q_MV_IOS(9, 0)
+ MV_IOS_9_0 = Q_MV_IOS(9, 0),
+ MV_IOS_9_1 = Q_MV_IOS(9, 1),
+ MV_IOS_9_2 = Q_MV_IOS(9, 2),
+ MV_IOS_9_3 = Q_MV_IOS(9, 3),
+ MV_IOS_10_0 = Q_MV_IOS(10, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 1e95d1a2ec..1e852ae538 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -48,7 +48,7 @@
The operating system, must be one of: (Q_OS_x)
DARWIN - Any Darwin system (OS X, iOS, watchOS, tvOS)
- OSX - OS X
+ MACOS - macOS
IOS - iOS
WATCHOS - watchOS
TVOS - tvOS
@@ -115,7 +115,7 @@
# else
# // there is no "real" OS X define (rdar://22640089),
# // assume any non iOS-based platform is OS X for now
-# define Q_OS_OSX
+# define Q_OS_MACOS
# endif
# else
# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
@@ -229,15 +229,16 @@
#ifdef Q_OS_DARWIN64
#define Q_OS_MAC64
#endif
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#define Q_OS_MACX
+#define Q_OS_OSX
#endif
#ifdef Q_OS_DARWIN
# include <Availability.h>
# include <AvailabilityMacros.h>
#
-# ifdef Q_OS_OSX
+# ifdef Q_OS_MACOS
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
# undef __MAC_OS_X_VERSION_MIN_REQUIRED
# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
@@ -266,6 +267,9 @@
# if !defined(__MAC_10_11)
# define __MAC_10_11 101100
# endif
+# if !defined(__MAC_10_12)
+# define __MAC_10_12 101200
+# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
@@ -281,6 +285,9 @@
# if !defined(MAC_OS_X_VERSION_10_11)
# define MAC_OS_X_VERSION_10_11 101100
# endif
+# if !defined(MAC_OS_X_VERSION_10_12)
+# define MAC_OS_X_VERSION_10_12 101200
+# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
@@ -321,6 +328,18 @@
# if !defined(__IPHONE_9_0)
# define __IPHONE_9_0 90000
# endif
+# if !defined(__IPHONE_9_1)
+# define __IPHONE_9_1 90100
+# endif
+# if !defined(__IPHONE_9_2)
+# define __IPHONE_9_2 90200
+# endif
+# if !defined(__IPHONE_9_3)
+# define __IPHONE_9_3 90300
+# endif
+# if !defined(__IPHONE_10_0)
+# define __IPHONE_10_0 100000
+# endif
#endif
#ifdef __LSB_VERSION__
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 4ac12fc9ea..29ef0f937e 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -386,8 +386,12 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
# endif
QString productName = QSysInfo::productType();
+# ifdef Q_OS_MACOS
+ if (productName != QStringLiteral("osx"))
+ ret << QStringLiteral("osx"); // compatibility
+# endif
if (productName != QLatin1String("unknown"))
- ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
+ ret << productName; // "opensuse", "fedora", "macos", "ios", "android"
#endif
return ret;
}
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index fd204b00de..f31ac75425 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1186,8 +1186,6 @@ QByteArray QIODevice::read(qint64 maxSize)
}
/*!
- \overload
-
Reads all remaining data from the device, and returns it as a
byte array.
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 6e59790d5c..f92e418ebf 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -111,7 +111,8 @@ public:
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
bool filterNativeEvent(const QByteArray &eventType, void *message, long *result);
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED bool filterEvent(void *message) { return filterNativeEvent("", message, 0); }
+ QT_DEPRECATED bool filterEvent(void *message)
+ { return filterNativeEvent("", message, Q_NULLPTR); }
#endif
Q_SIGNALS:
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 601733b939..0e2d4e2324 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -55,7 +55,10 @@ QT_BEGIN_NAMESPACE
int appCmdShow = 0;
-#if defined(Q_OS_WINRT)
+// GetModuleFileName only exists for MSVC2015 and upwards for WinRT, meaning
+// Windows 10 (Mobile). Hence take the first argument passed to the
+// QCoreApplication contructor for older versions as a fallback on older platforms.
+#if defined(Q_OS_WINRT) && _MSC_VER < 1900
Q_CORE_EXPORT QString qAppFileName()
{
@@ -67,31 +70,7 @@ QString QCoreApplicationPrivate::appName() const
return QFileInfo(QCoreApplication::arguments().constFirst()).baseName();
}
-#else
-
-Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
-{
- return GetModuleHandle(0);
-}
-
-Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle
-{
- return 0;
-}
-
-Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command
-{
-#if defined(Q_OS_WINCE)
- return appCmdShow;
-#else
- STARTUPINFO startupInfo;
- GetStartupInfo(&startupInfo);
-
- return (startupInfo.dwFlags & STARTF_USESHOWWINDOW)
- ? startupInfo.wShowWindow
- : SW_SHOWDEFAULT;
-#endif
-}
+#else // !(defined(Q_OS_WINRT) && _MSC_VER < 1900)
Q_CORE_EXPORT QString qAppFileName() // get application file name
{
@@ -139,6 +118,34 @@ QString QCoreApplicationPrivate::appName() const
return QFileInfo(qAppFileName()).baseName();
}
+#endif // !(defined(Q_OS_WINRT) && _MSC_VER < 1900)
+
+#ifndef Q_OS_WINRT
+
+Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
+{
+ return GetModuleHandle(0);
+}
+
+Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle
+{
+ return 0;
+}
+
+Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command
+{
+#if defined(Q_OS_WINCE)
+ return appCmdShow;
+#else
+ STARTUPINFO startupInfo;
+ GetStartupInfo(&startupInfo);
+
+ return (startupInfo.dwFlags & STARTF_USESHOWWINDOW)
+ ? startupInfo.wShowWindow
+ : SW_SHOWDEFAULT;
+#endif
+}
+
/*****************************************************************************
qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp
*****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index 4012f8019c..e0777b8df8 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -211,6 +211,9 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
return hr;
+ hr = asyncInfo->Close();
+ if (FAILED(hr))
+ return hr;
return ec;
}
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index f7c60cc309..85ac7e77e4 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -187,7 +187,7 @@ private:
// signature() has been renamed to methodSignature() in Qt 5.
// Warning, that function returns a QByteArray; check the life time if
// you convert to char*.
- char *signature(struct renamedInQt5_warning_checkTheLifeTime * = 0) Q_DECL_EQ_DELETE;
+ char *signature(struct renamedInQt5_warning_checkTheLifeTime * = Q_NULLPTR) Q_DECL_EQ_DELETE;
#endif
static QMetaMethod fromSignalImpl(const QMetaObject *, void **);
diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp
index dbff997c88..30498a380d 100644
--- a/src/corelib/kernel/qppsobject.cpp
+++ b/src/corelib/kernel/qppsobject.cpp
@@ -175,7 +175,7 @@ QPpsAttribute QPpsObjectPrivate::decodeNumber(pps_decoder_t *decoder)
// In order to support more number types, we have to do something stupid because the PPS
// library won't let us work any other way. Basically, we have to probe the encoded type in
// order to try to get exactly what we want.
- long long llValue;
+ int64_t llValue;
double dValue;
int iValue;
QPpsAttribute::Flags flags;
@@ -193,7 +193,7 @@ QPpsAttribute QPpsObjectPrivate::decodeNumber(pps_decoder_t *decoder)
return QPpsAttribute();
}
flags = readFlags(decoder);
- return QPpsAttributePrivate::createPpsAttribute(llValue, flags);
+ return QPpsAttributePrivate::createPpsAttribute(static_cast<long long>(llValue), flags);
default:
qWarning("QPpsObjectPrivate::decodeNumber: pps_decoder_get_int failed");
return QPpsAttribute();
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index e7a31e0b70..deedd61c17 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_THREAD
-Q_STATIC_ASSERT(sizeof(pthread_t) == sizeof(Qt::HANDLE));
+Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE));
enum { ThreadPriorityResetFlag = 0x80000000 };
@@ -210,6 +210,30 @@ static void clear_thread_data()
pthread_setspecific(current_thread_data_key, 0);
}
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, Qt::HANDLE>::Type to_HANDLE(T id)
+{
+ return reinterpret_cast<Qt::HANDLE>(static_cast<intptr_t>(id));
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type from_HANDLE(Qt::HANDLE id)
+{
+ return static_cast<T>(reinterpret_cast<intptr_t>(id));
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, Qt::HANDLE>::Type to_HANDLE(T id)
+{
+ return id;
+}
+
+template <typename T>
+static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, T>::Type from_HANDLE(Qt::HANDLE id)
+{
+ return static_cast<T>(id);
+}
+
void QThreadData::clearCurrentThreadData()
{
clear_thread_data();
@@ -231,7 +255,7 @@ QThreadData *QThreadData::current(bool createIfNecessary)
}
data->deref();
data->isAdopted = true;
- data->threadId = (Qt::HANDLE)pthread_self();
+ data->threadId = to_HANDLE(pthread_self());
if (!QCoreApplicationPrivate::theMainThread)
QCoreApplicationPrivate::theMainThread = data->thread.load();
}
@@ -311,7 +335,7 @@ void *QThreadPrivate::start(void *arg)
thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag));
}
- data->threadId = (Qt::HANDLE)pthread_self();
+ data->threadId = to_HANDLE(pthread_self());
set_thread_data(data);
data->ref();
@@ -328,7 +352,7 @@ void *QThreadPrivate::start(void *arg)
// sets the name of the current thread.
QString objectName = thr->objectName();
- pthread_t thread_id = reinterpret_cast<pthread_t>(data->threadId);
+ pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId);
if (Q_LIKELY(objectName.isEmpty()))
setCurrentThreadName(thread_id, thr->metaObject()->className());
else
@@ -391,7 +415,7 @@ void QThreadPrivate::finish(void *arg)
Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
{
// requires a C cast here otherwise we run into trouble on AIX
- return (Qt::HANDLE)pthread_self();
+ return to_HANDLE(pthread_self());
}
#if defined(QT_LINUXBASE) && !defined(_SC_NPROCESSORS_ONLN)
@@ -617,18 +641,17 @@ void QThread::start(Priority priority)
}
}
- int code =
- pthread_create(reinterpret_cast<pthread_t *>(&d->data->threadId), &attr,
- QThreadPrivate::start, this);
+ pthread_t threadId;
+ int code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);
if (code == EPERM) {
// caller does not have permission to set the scheduling
// parameters/policy
#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING)
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
#endif
- code = pthread_create(reinterpret_cast<pthread_t *>(&d->data->threadId), &attr,
- QThreadPrivate::start, this);
+ code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);
}
+ d->data->threadId = to_HANDLE(threadId);
pthread_attr_destroy(&attr);
@@ -650,7 +673,7 @@ void QThread::terminate()
if (!d->data->threadId)
return;
- int code = pthread_cancel(reinterpret_cast<pthread_t>(d->data->threadId));
+ int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId));
if (code) {
qWarning("QThread::start: Thread termination error: %s",
qPrintable(qt_error_string((code))));
@@ -663,7 +686,7 @@ bool QThread::wait(unsigned long time)
Q_D(QThread);
QMutexLocker locker(&d->mutex);
- if (reinterpret_cast<pthread_t>(d->data->threadId) == pthread_self()) {
+ if (from_HANDLE<pthread_t>(d->data->threadId) == pthread_self()) {
qWarning("QThread::wait: Thread tried to wait on itself");
return false;
}
@@ -705,7 +728,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
int sched_policy;
sched_param param;
- if (pthread_getschedparam(reinterpret_cast<pthread_t>(data->threadId), &sched_policy, &param) != 0) {
+ if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param) != 0) {
// failed to get the scheduling policy, don't bother setting
// the priority
qWarning("QThread::setPriority: Cannot get scheduler parameters");
@@ -721,15 +744,15 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
}
param.sched_priority = prio;
- int status = pthread_setschedparam(reinterpret_cast<pthread_t>(data->threadId), sched_policy, &param);
+ int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);
# ifdef SCHED_IDLE
// were we trying to set to idle priority and failed?
if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) {
// reset to lowest priority possible
- pthread_getschedparam(reinterpret_cast<pthread_t>(data->threadId), &sched_policy, &param);
+ pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param);
param.sched_priority = sched_get_priority_min(sched_policy);
- pthread_setschedparam(reinterpret_cast<pthread_t>(data->threadId), sched_policy, &param);
+ pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);
}
# else
Q_UNUSED(status);
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 85da174366..629a0bc744 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -601,6 +601,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
}
# else
// 32-bit, we can't do MOVQ to load 8 bytes
+ Q_UNUSED(nullmask);
enum { MaxTailLength = 15 };
# endif
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 2f24165069..0233ccbf87 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -563,7 +563,7 @@ static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize)
return dir.size == iconsize;
} else if (dir.type == QIconDirInfo::Scalable) {
- return dir.size <= dir.maxSize &&
+ return iconsize <= dir.maxSize &&
iconsize >= dir.minSize;
} else if (dir.type == QIconDirInfo::Threshold) {
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 36595025f5..d33e1053c8 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -3134,6 +3134,8 @@ void QImage::mirrored_inplace(bool horizontal, bool vertical)
return;
detach();
+ if (!d->own_data)
+ *this = copy();
do_mirror(d, d, horizontal, vertical);
}
@@ -3280,6 +3282,8 @@ void QImage::rgbSwapped_inplace()
return;
detach();
+ if (!d->own_data)
+ *this = copy();
switch (d->format) {
case Format_Invalid:
@@ -4763,7 +4767,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
return true;
// No in-place conversion if we have to detach
- if (ref.load() > 1 || ro_data)
+ if (ref.load() > 1 || !own_data)
return false;
InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat];
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 2aa19a8465..6f8e214b11 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -321,7 +321,7 @@ public:
static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW;
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QString text(const char* key, const char* lang=0) const;
+ QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
QT_DEPRECATED inline QStringList textLanguages() const;
QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 3c80b070e3..bb0b76d55f 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -769,8 +769,8 @@ static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConver
static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_Indexed8);
- if (!data->own_data)
- return false;
+ Q_ASSERT(data->own_data);
+
const int depth = 32;
const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
@@ -823,8 +823,8 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_Indexed8);
- if (!data->own_data)
- return false;
+ Q_ASSERT(data->own_data);
+
const int depth = 32;
const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
@@ -874,8 +874,7 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags flags)
{
Q_ASSERT(data->format == QImage::Format_Indexed8);
- if (!data->own_data)
- return false;
+ Q_ASSERT(data->own_data);
if (data->has_alpha_clut) {
for (int i = 0; i < data->colortable.size(); ++i)
@@ -892,8 +891,8 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio
static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_Indexed8);
- if (!data->own_data)
- return false;
+ Q_ASSERT(data->own_data);
+
const int depth = 16;
const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
@@ -949,8 +948,8 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_RGB32);
- if (!data->own_data)
- return false;
+ Q_ASSERT(data->own_data);
+
const int depth = 16;
const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index d90134482d..5a696807b4 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -550,7 +550,9 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
QPoint n(to.y() - from.y(), from.x() - to.x());
if (n.x() == 0 && n.y() == 0)
continue;
- int scale = qRound((offs << 16) / qSqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
+ int scale = qRound((offs << 16) / qSqrt(qreal(n.x()) * n.x() + qreal(n.y()) * n.y())); // 8:16
+ Q_ASSERT(scale != 0);
+
n.rx() = n.x() * scale >> 8;
n.ry() = n.y() * scale >> 8;
normals.append(n);
@@ -805,8 +807,9 @@ QDistanceFieldData *QDistanceFieldData::create(const QPainterPath &path, bool do
{
int dfMargin = QT_DISTANCEFIELD_RADIUS(doubleResolution) / QT_DISTANCEFIELD_SCALE(doubleResolution);
int glyphWidth = qCeil(path.boundingRect().width() / QT_DISTANCEFIELD_SCALE(doubleResolution)) + dfMargin * 2;
+ int glyphHeight = qCeil(path.boundingRect().height() / QT_DISTANCEFIELD_SCALE(doubleResolution)) + dfMargin * 2;
- QDistanceFieldData *data = create(QSize(glyphWidth, QT_DISTANCEFIELD_TILESIZE(doubleResolution)));
+ QDistanceFieldData *data = create(QSize(glyphWidth, glyphHeight));
makeDistanceField(data,
path,
diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h
index 7cd385587b..c6c5e6b650 100644
--- a/src/gui/text/qdistancefield_p.h
+++ b/src/gui/text/qdistancefield_p.h
@@ -58,7 +58,6 @@
QT_BEGIN_NAMESPACE
#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54
-#define QT_DISTANCEFIELD_DEFAULT_TILESIZE 64
#define QT_DISTANCEFIELD_DEFAULT_SCALE 16
#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80
#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000
@@ -66,9 +65,6 @@ QT_BEGIN_NAMESPACE
#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \
(NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \
QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE)
-#define QT_DISTANCEFIELD_TILESIZE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2 : \
- QT_DISTANCEFIELD_DEFAULT_TILESIZE)
#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \
(NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \
QT_DISTANCEFIELD_DEFAULT_SCALE)
diff --git a/src/network/network.pro b/src/network/network.pro
index 7a05f927c5..256d718df6 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -34,7 +34,8 @@ ANDROID_PERMISSIONS += \
MODULE_WINRT_CAPABILITIES = \
internetClient \
- internetClientServer
+ internetClientServer \
+ privateNetworkClientServer
MODULE_PLUGIN_TYPES = \
bearer
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index dd43615f98..9817d4c57d 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -259,31 +259,23 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::
// Start processing incoming data
if (d->socketType == QAbstractSocket::TcpSocket) {
HRESULT hr;
- hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, this]() {
+ QEventDispatcherWinRT::runOnXamlThread([d, &hr, socket, this]() {
ComPtr<IBuffer> buffer;
HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer);
- RETURN_HR_IF_FAILED("initialize(): Could not create buffer");
-
+ RETURN_OK_IF_FAILED("initialize(): Could not create buffer");
ComPtr<IInputStream> stream;
hr = socket->get_InputStream(&stream);
- RETURN_HR_IF_FAILED("initialize(): Could not obtain input stream");
+ RETURN_OK_IF_FAILED("initialize(): Could not obtain input stream");
hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, d->readOp.GetAddressOf());
- if (FAILED(hr)) {
- qErrnoWarning(hr, "initialize(): Failed to read from the socket buffer (%s).",
+ RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).",
socketDescription(this).constData());
- return E_FAIL;
- }
hr = d->readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get());
- if (FAILED(hr)) {
- qErrnoWarning(hr, "initialize(): Failed to set socket read callback (%s).",
+ RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).",
socketDescription(this).constData());
- return E_FAIL;
- }
return S_OK;
});
- if (hr == E_FAIL)
+ if (FAILED(hr))
return false;
- Q_ASSERT_SUCCEEDED(hr);
}
d->socketState = socketState;
@@ -335,11 +327,14 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
Q_ASSERT_SUCCEEDED(hr);
d->socketState = QAbstractSocket::ConnectingState;
- hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
+ QEventDispatcherWinRT::runOnXamlThread([d, &hr]() {
+ hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
d, &QNativeSocketEnginePrivate::handleConnectOpFinished).Get());
+ RETURN_OK_IF_FAILED("connectToHostByName: Could not register \"connectOp\" callback");
+ return S_OK;
});
- Q_ASSERT_SUCCEEDED(hr);
+ if (FAILED(hr))
+ return false;
return d->socketState == QAbstractSocket::ConnectedState;
}
@@ -348,19 +343,21 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
{
Q_D(QNativeSocketEngine);
HRESULT hr;
- hr = QEventDispatcherWinRT::runOnXamlThread([address, d, port, this]() {
- HRESULT hr;
+ // runOnXamlThread may only return S_OK (will assert otherwise) so no need to check its result.
+ // hr is set inside the lambda though. If an error occurred hr will point that out.
+ bool specificErrorSet = false;
+ QEventDispatcherWinRT::runOnXamlThread([address, d, &hr, port, &specificErrorSet, this]() {
ComPtr<IHostName> hostAddress;
if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) {
ComPtr<IHostNameFactory> hostNameFactory;
hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory);
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not obtain hostname factory");
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not obtain hostname factory");
const QString addressString = address.toString();
HStringReference addressRef(reinterpret_cast<LPCWSTR>(addressString.utf16()));
hr = hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress);
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname.");
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname.");
}
QString portQString = port ? QString::number(port) : QString();
@@ -371,13 +368,13 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
if (!d->tcpListener) {
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(),
&d->tcpListener);
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not create tcp listener");
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not create tcp listener");
}
hr = d->tcpListener->add_ConnectionReceived(
Callback<ClientConnectedHandler>(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(),
&d->connectionToken);
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not register client connection callback");
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not register client connection callback");
hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op);
} else if (d->socketType == QAbstractSocket::UdpSocket) {
hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op);
@@ -385,15 +382,40 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
if (hr == E_ACCESSDENIED) {
qErrnoWarning(hr, "Unable to bind socket (%s:%hu/%s). Please check your manifest capabilities.",
qPrintable(address.toString()), port, socketDescription(this).constData());
- return hr;
+ d->setError(QAbstractSocket::SocketAccessError,
+ QNativeSocketEnginePrivate::AccessErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ specificErrorSet = true;
+ return S_OK;
}
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Unable to bind socket");
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Unable to bind socket");
hr = QWinRTFunctions::await(op);
- RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not wait for bind to finish");
+ if (hr == 0x80072741) { // The requested address is not valid in its context
+ d->setError(QAbstractSocket::SocketAddressNotAvailableError,
+ QNativeSocketEnginePrivate::AddressNotAvailableErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ specificErrorSet = true;
+ return S_OK;
+ // Only one usage of each socket address (protocol/network address/port) is normally permitted
+ } else if (hr == 0x80072740) {
+ d->setError(QAbstractSocket::AddressInUseError,
+ QNativeSocketEnginePrivate::AddressInuseErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ specificErrorSet = true;
+ return S_OK;
+ }
+ RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not wait for bind to finish");
return S_OK;
});
- Q_ASSERT_SUCCEEDED(hr);
+ if (FAILED(hr)) {
+ if (!specificErrorSet) {
+ d->setError(QAbstractSocket::UnknownSocketError,
+ QNativeSocketEnginePrivate::UnknownSocketErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ }
+ return false;
+ }
d->socketState = QAbstractSocket::BoundState;
return d->fetchConnectionParameters();
@@ -853,20 +875,22 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
case QAbstractSocket::TcpSocket: {
ComPtr<IStreamSocket> socket;
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket);
- Q_ASSERT_SUCCEEDED(hr);
+ RETURN_FALSE_IF_FAILED("createNewSocket: Could not create socket instance");
socketDescriptor = qintptr(socket.Detach());
break;
}
case QAbstractSocket::UdpSocket: {
ComPtr<IDatagramSocket> socket;
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket);
- Q_ASSERT_SUCCEEDED(hr);
+ RETURN_FALSE_IF_FAILED("createNewSocket: Could not create socket instance");
socketDescriptor = qintptr(socket.Detach());
- hr = QEventDispatcherWinRT::runOnXamlThread([this]() {
- HRESULT hr = udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken);
- return hr;
+ QEventDispatcherWinRT::runOnXamlThread([&hr, this]() {
+ hr = udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken);
+ RETURN_OK_IF_FAILED("createNewSocket: Could not add \"message received\" callback")
+ return S_OK;
});
- Q_ASSERT_SUCCEEDED(hr);
+ if (FAILED(hr))
+ return false;
break;
}
default:
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index c7b4875134..b3820aea97 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1192,6 +1192,11 @@ bool QSslSocketBackendPrivate::startHandshake()
#endif
if (!checkSslErrors())
return false;
+ // A slot, attached to sslErrors signal can call
+ // abort/close/disconnetFromHost/etc; no need to
+ // continue handshake then.
+ if (q->state() != QAbstractSocket::ConnectedState)
+ return false;
} else {
sslErrors.clear();
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 533e0e2d5b..e1f4ddd360 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -212,6 +212,12 @@ void QCoreTextFontDatabase::populateFontDatabase()
if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
continue;
+#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
+ // Skip font families with no corresponding fonts
+ if (![UIFont fontNamesForFamilyName:(NSString*)familyNameRef].count)
+ continue;
+#endif
+
QPlatformFontDatabase::registerFontFamily(familyName);
#if defined(Q_OS_OSX)
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 3f8f80fc85..52e76219e6 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -85,7 +85,7 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time
[locker lock];
QMacAutoReleasePool pool;
notificationCenter = [NSNotificationCenter defaultCenter];
- currentInterface = [CWInterface interfaceWithName:nil];
+ currentInterface = [CWInterface interface];
[notificationCenter addObserver:self selector:@selector(notificationHandler:) name:CWPowerDidChangeNotification object:nil];
[locker unlock];
return self;
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 6026e06b55..5d34e0ea38 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -306,7 +306,6 @@ QWindowSystemInterface::TouchPoint QTuioHandler::cursorToTouchPoint(const QTuioC
tp.normalPosition = m_transform.map(tp.normalPosition);
tp.state = tc.state();
- tp.area = QRectF(0, 0, 1, 1);
// we map the touch to the size of the window. we do this, because frankly,
// trying to figure out which part of the screen to hit in order to press an
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index 064a0c095c..5be128a0c5 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -252,9 +252,19 @@ namespace QtAndroidInput
QWindowSystemInterface::handleTouchEvent(window, touchDevice, m_touchPoints);
}
+ static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/)
+ {
+#ifdef QT_NO_TABLETEVENT
+ return false;
+#else
+ return true;
+#endif // QT_NO_TABLETEVENT
+ }
+
static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action,
jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure)
{
+#ifndef QT_NO_TABLETEVENT
QPointF globalPosF(x, y);
QPoint globalPos((int)x, (int)y);
QWindow *tlw = topLevelWindowAt(globalPos);
@@ -296,6 +306,7 @@ namespace QtAndroidInput
QWindowSystemInterface::handleTabletEvent(tlw, ulong(time),
localPos, globalPosF, QTabletEvent::Stylus, pointerType,
buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier);
+#endif // QT_NO_TABLETEVENT
}
static int mapAndroidKey(int key)
@@ -783,6 +794,7 @@ namespace QtAndroidInput
{"mouseUp", "(III)V", (void *)mouseUp},
{"mouseMove", "(III)V", (void *)mouseMove},
{"longPress", "(III)V", (void *)longPress},
+ {"isTabletEventSupported", "()Z", (void *)isTabletEventSupported},
{"tabletEvent", "(IIJIIIFFF)V", (void *)tabletEvent},
{"keyDown", "(IIIZ)V", (void *)keyDown},
{"keyUp", "(IIIZ)V", (void *)keyUp},
diff --git a/src/plugins/platforms/ios/qiosapplicationstate.h b/src/plugins/platforms/ios/qiosapplicationstate.h
index e487407d7b..1c77b26da1 100644
--- a/src/plugins/platforms/ios/qiosapplicationstate.h
+++ b/src/plugins/platforms/ios/qiosapplicationstate.h
@@ -41,10 +41,11 @@
#define QIOSAPPLICATIONSTATE_H
#include <QtCore/qglobal.h>
+#include <QtCore/qvector.h>
-QT_BEGIN_NAMESPACE
+Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
-@class QIOSApplicationStateListener;
+QT_BEGIN_NAMESPACE
class QIOSApplicationState
{
@@ -52,7 +53,7 @@ public:
QIOSApplicationState();
~QIOSApplicationState();
private:
- QIOSApplicationStateListener *m_listener;
+ QVector<NSObject*> m_observers;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm
index afb61a134b..7b923e4692 100644
--- a/src/plugins/platforms/ios/qiosapplicationstate.mm
+++ b/src/plugins/platforms/ios/qiosapplicationstate.mm
@@ -42,100 +42,21 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/qcoreapplication.h>
-#import <UIKit/UIKit.h>
-
-@interface QIOSApplicationStateListener : NSObject
-@end
+#include <QtGui/private/qguiapplication_p.h>
-@implementation QIOSApplicationStateListener
-
-- (id)init
-{
- self = [super init];
- if (self) {
- // Listen for application state changes.
- // Note: We use notifications rather than application delegate callbacks to
- // also support hybrid applications were QIOSApplicationDelegate is not in use.
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(applicationDidBecomeActive)
- name:UIApplicationDidBecomeActiveNotification
- object:nil];
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(applicationWillResignActive)
- name:UIApplicationWillResignActiveNotification
- object:nil];
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(applicationDidEnterBackground)
- name:UIApplicationDidEnterBackgroundNotification
- object:nil];
-
- // Update the current state now, since we have missed all the updates
- // posted from AppKit so far. But let QPA finish initialization first.
- dispatch_async(dispatch_get_main_queue(), ^{
- [self handleApplicationStateChanged:[UIApplication sharedApplication].applicationState];
- });
- }
- return self;
-}
-
-- (void)dealloc
-{
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:UIApplicationDidBecomeActiveNotification
- object:nil];
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:UIApplicationWillResignActiveNotification
- object:nil];
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:UIApplicationDidEnterBackgroundNotification
- object:nil];
- [super dealloc];
-}
-
-- (void)applicationDidBecomeActive
-{
- [self handleApplicationStateChanged:UIApplicationStateActive];
-}
-
-- (void)applicationWillResignActive
-{
- // Note that UIApplication is still UIApplicationStateActive at this
- // point, but since there is no separate notification for the inactive
- // state, we report UIApplicationStateInactive now:
- [self handleApplicationStateChanged:UIApplicationStateInactive];
-}
-
-- (void)applicationDidEnterBackground
-{
- [self handleApplicationStateChanged:UIApplicationStateBackground];
-}
+#import <UIKit/UIKit.h>
-- (void)handleApplicationStateChanged:(UIApplicationState)uiApplicationState
+static Qt::ApplicationState qtApplicationState(UIApplicationState uiApplicationState)
{
- // We may receive application state changes after QCoreApplication has
- // gone down, as the block we schedule on the main queue keeps the
- // listener alive. In that case we just ignore the notification.
- if (!qApp)
- return;
-
- Qt::ApplicationState state;
switch (uiApplicationState) {
case UIApplicationStateActive:
- // The application is visible in front, and receiving events:
- state = Qt::ApplicationActive;
- break;
+ // The application is visible in front, and receiving events
+ return Qt::ApplicationActive;
case UIApplicationStateInactive:
// The app is running in the foreground but is not receiving events. This
// typically happens while transitioning to/from active/background, like
- // upon app launch or when receiving incoming calls:
- state = Qt::ApplicationInactive;
- break;
+ // upon app launch or when receiving incoming calls.
+ return Qt::ApplicationInactive;
case UIApplicationStateBackground:
// Normally the app would enter this state briefly before it gets
// suspeded (you have five seconds, according to Apple).
@@ -144,25 +65,54 @@
// API for doing that yet, we handle this state as "about to be suspended".
// Note: A screen-shot for the SpringBoard will also be taken after this
// call returns.
- state = Qt::ApplicationSuspended;
- break;
+ return Qt::ApplicationSuspended;
}
+}
+
+static void handleApplicationStateChanged(UIApplicationState uiApplicationState)
+{
+ Qt::ApplicationState state = qtApplicationState(uiApplicationState);
QWindowSystemInterface::handleApplicationStateChanged(state);
QWindowSystemInterface::flushWindowSystemEvents();
}
-@end
-
QT_BEGIN_NAMESPACE
QIOSApplicationState::QIOSApplicationState()
- : m_listener([[QIOSApplicationStateListener alloc] init])
{
+ NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+
+ m_observers.push_back([notificationCenter addObserverForName:UIApplicationDidBecomeActiveNotification
+ object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) {
+ handleApplicationStateChanged(UIApplicationStateActive);
+ }
+ ]);
+
+ m_observers.push_back([notificationCenter addObserverForName:UIApplicationWillResignActiveNotification
+ object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) {
+ // Note: UIApplication is still UIApplicationStateActive at this point,
+ // but since there is no separate notification for the inactive state,
+ // we report UIApplicationStateInactive now.
+ handleApplicationStateChanged(UIApplicationStateInactive);
+ }
+ ]);
+
+ m_observers.push_back([notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification
+ object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) {
+ handleApplicationStateChanged(UIApplicationStateBackground);
+ }
+ ]);
+
+ // Initialize correct startup state, which may not be the Qt default (inactive)
+ UIApplicationState startupState = [UIApplication sharedApplication].applicationState;
+ QGuiApplicationPrivate::applicationState = qtApplicationState(startupState);
}
QIOSApplicationState::~QIOSApplicationState()
{
- [m_listener release];
+ NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+ foreach (const NSObject* observer, m_observers)
+ [notificationCenter removeObserver:observer];
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h
index c8a4fae20c..5b7917f7b4 100644
--- a/src/plugins/platforms/ios/qioscontext.h
+++ b/src/plugins/platforms/ios/qioscontext.h
@@ -40,6 +40,7 @@
#ifndef QIOSCONTEXT_H
#define QIOSCONTEXT_H
+#include <QtCore/qloggingcategory.h>
#include <qpa/qplatformopenglcontext.h>
@class EAGLContext;
@@ -89,7 +90,9 @@ private:
static void deleteBuffers(const FramebufferObject &framebufferObject);
FramebufferObject &backingFramebufferObjectFor(QPlatformSurface *) const;
- mutable QHash<QIOSWindow *, FramebufferObject> m_framebufferObjects;
+ mutable QHash<QPlatformSurface *, FramebufferObject> m_framebufferObjects;
+
+ bool needsRenderbufferResize(QPlatformSurface *) const;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 546b003d14..d18e317bfb 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -48,6 +48,8 @@
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/CAEAGLLayer.h>
+Q_LOGGING_CATEGORY(lcQpaGLContext, "qt.qpa.glcontext");
+
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
, m_sharedContext(static_cast<QIOSContext *>(context->shareHandle()))
@@ -81,6 +83,8 @@ QIOSContext::QIOSContext(QOpenGLContext *context)
// could take advantage of the unchanged buffer, but this means clients (and Qt)
// will also assume that swapBufferes() is not needed, which is _not_ the case.
m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+
+ qCDebug(lcQpaGLContext) << "created context with format" << m_format << "shared with" << m_sharedContext;
}
QIOSContext::~QIOSContext()
@@ -123,10 +127,12 @@ static QString fboStatusString(GLenum status)
}
}
+#define Q_ASSERT_IS_GL_SURFACE(surface) \
+ Q_ASSERT(surface && (surface->surface()->surfaceType() & (QSurface::OpenGLSurface | QSurface::RasterGLSurface)))
+
bool QIOSContext::makeCurrent(QPlatformSurface *surface)
{
- Q_ASSERT(surface && (surface->surface()->surfaceType() == QSurface::OpenGLSurface
- || surface->surface()->surfaceType() == QSurface::RasterGLSurface));
+ Q_ASSERT_IS_GL_SURFACE(surface);
[EAGLContext setCurrentContext:m_eaglContext];
@@ -134,54 +140,11 @@ bool QIOSContext::makeCurrent(QPlatformSurface *surface)
if (surface->surface()->surfaceClass() == QSurface::Offscreen)
return true;
+ Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window);
FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
- // We bind the default FBO even if it's incomplete, so that clients who
- // call glCheckFramebufferStatus as a result of this function returning
- // false will get a matching error code.
- glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
-
- return framebufferObject.isComplete;
-}
-
-void QIOSContext::doneCurrent()
-{
- [EAGLContext setCurrentContext:nil];
-}
-
-void QIOSContext::swapBuffers(QPlatformSurface *surface)
-{
- Q_ASSERT(surface && (surface->surface()->surfaceType() == QSurface::OpenGLSurface
- || surface->surface()->surfaceType() == QSurface::RasterGLSurface));
-
- if (surface->surface()->surfaceClass() == QSurface::Offscreen)
- return; // Nothing to do
-
- FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
-
- [EAGLContext setCurrentContext:m_eaglContext];
- glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer);
- [m_eaglContext presentRenderbuffer:GL_RENDERBUFFER];
-}
-
-QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatformSurface *surface) const
-{
- // We keep track of default-FBOs in the root context of a share-group. This assumes
- // that the contexts form a tree, where leaf nodes are always destroyed before their
- // parents. If that assumption (based on the current implementation) doesn't hold we
- // should probably use QOpenGLMultiGroupSharedResource to track the shared default-FBOs.
- if (m_sharedContext)
- return m_sharedContext->backingFramebufferObjectFor(surface);
-
- Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window);
- QIOSWindow *window = static_cast<QIOSWindow *>(surface);
-
- FramebufferObject &framebufferObject = m_framebufferObjects[window];
-
- // Set up an FBO for the window if it hasn't been created yet
if (!framebufferObject.handle) {
- [EAGLContext setCurrentContext:m_eaglContext];
-
+ // Set up an FBO for the window if it hasn't been created yet
glGenFramebuffers(1, &framebufferObject.handle);
glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
@@ -201,17 +164,17 @@ QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatfo
framebufferObject.depthRenderbuffer);
}
- connect(window, SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
+ connect(static_cast<QIOSWindow *>(surface), SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
+ } else {
+ glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
}
- // Ensure that the FBO's buffers match the size of the layer
- UIView *view = reinterpret_cast<UIView *>(window->winId());
- CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer);
- if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) ||
- framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) {
-
- [EAGLContext setCurrentContext:m_eaglContext];
- glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
+ if (needsRenderbufferResize(surface)) {
+ // Ensure that the FBO's buffers match the size of the layer
+ CAEAGLLayer *layer = static_cast<QIOSWindow *>(surface)->eaglLayer();
+ qCDebug(lcQpaGLContext, "Reallocating renderbuffer storage - current: %dx%d, layer: %gx%g",
+ framebufferObject.renderbufferWidth, framebufferObject.renderbufferHeight,
+ layer.frame.size.width * layer.contentsScale, layer.frame.size.height * layer.contentsScale);
glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer);
[m_eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
@@ -234,12 +197,54 @@ QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatfo
framebufferObject.isComplete = glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
if (!framebufferObject.isComplete) {
- qWarning("QIOSContext failed to make complete framebuffer object (%s)",
+ qCWarning(lcQpaGLContext, "QIOSContext failed to make complete framebuffer object (%s)",
qPrintable(fboStatusString(glCheckFramebufferStatus(GL_FRAMEBUFFER))));
}
}
- return framebufferObject;
+ return framebufferObject.isComplete;
+}
+
+void QIOSContext::doneCurrent()
+{
+ [EAGLContext setCurrentContext:nil];
+}
+
+void QIOSContext::swapBuffers(QPlatformSurface *surface)
+{
+ Q_ASSERT_IS_GL_SURFACE(surface);
+
+ if (surface->surface()->surfaceClass() == QSurface::Offscreen)
+ return; // Nothing to do
+
+ if (!static_cast<QIOSWindow *>(surface)->isExposed()) {
+ qCWarning(lcQpaGLContext, "Detected swapBuffers on a non-exposed window, skipping flush");
+ return;
+ }
+
+ FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
+ Q_ASSERT_X(framebufferObject.isComplete, "QIOSContext", "swapBuffers on incomplete FBO");
+
+ if (needsRenderbufferResize(surface)) {
+ qCWarning(lcQpaGLContext, "CAEAGLLayer was resized between makeCurrent and swapBuffers, skipping flush");
+ return;
+ }
+
+ [EAGLContext setCurrentContext:m_eaglContext];
+ glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer);
+ [m_eaglContext presentRenderbuffer:GL_RENDERBUFFER];
+}
+
+QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatformSurface *surface) const
+{
+ // We keep track of default-FBOs in the root context of a share-group. This assumes
+ // that the contexts form a tree, where leaf nodes are always destroyed before their
+ // parents. If that assumption (based on the current implementation) doesn't hold we
+ // should probably use QOpenGLMultiGroupSharedResource to track the shared default-FBOs.
+ if (m_sharedContext)
+ return m_sharedContext->backingFramebufferObjectFor(surface);
+ else
+ return m_framebufferObjects[surface];
}
GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
@@ -251,19 +256,41 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
return 0;
}
- return backingFramebufferObjectFor(surface).handle;
+ FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
+ Q_ASSERT_X(framebufferObject.handle, "QIOSContext", "can't resolve default FBO before makeCurrent");
+
+ return framebufferObject.handle;
+}
+
+bool QIOSContext::needsRenderbufferResize(QPlatformSurface *surface) const
+{
+ Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window);
+
+ FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
+ CAEAGLLayer *layer = static_cast<QIOSWindow *>(surface)->eaglLayer();
+
+ if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale))
+ return true;
+
+ if (framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale))
+ return true;
+
+ return false;
}
void QIOSContext::windowDestroyed(QObject *object)
{
QIOSWindow *window = static_cast<QIOSWindow *>(object);
- if (m_framebufferObjects.contains(window)) {
- EAGLContext *originalContext = [EAGLContext currentContext];
- [EAGLContext setCurrentContext:m_eaglContext];
- deleteBuffers(m_framebufferObjects[window]);
- m_framebufferObjects.remove(window);
- [EAGLContext setCurrentContext:originalContext];
- }
+ if (!m_framebufferObjects.contains(window))
+ return;
+
+ qCDebug(lcQpaGLContext) << object << "destroyed, deleting corresponding FBO";
+
+ EAGLContext *originalContext = [EAGLContext currentContext];
+ [EAGLContext setCurrentContext:m_eaglContext];
+ deleteBuffers(m_framebufferObjects[window]);
+ m_framebufferObjects.remove(window);
+ [EAGLContext setCurrentContext:originalContext];
}
QFunctionPointer QIOSContext::getProcAddress(const char *functionName)
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index 56a0874bb4..cc83e7f3d2 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -71,9 +71,13 @@ public:
UIScreen *uiScreen() const;
UIWindow *uiWindow() const;
+ void setUpdatesPaused(bool);
+
void updateProperties();
private:
+ void deliverUpdateRequests() const;
+
UIScreen *m_uiScreen;
UIWindow *m_uiWindow;
QRect m_geometry;
@@ -82,6 +86,7 @@ private:
uint m_physicalDpi;
QSizeF m_physicalSize;
QIOSOrientationListener *m_orientationListener;
+ CADisplayLink *m_displayLink;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index bfd22abaa4..d53f0df846 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -46,10 +46,33 @@
#include "qiosviewcontroller.h"
#include "quiview.h"
+#include <QtGui/private/qwindow_p.h>
+
#include <sys/sysctl.h>
// -------------------------------------------------------------------------
+typedef void (^DisplayLinkBlock)(CADisplayLink *displayLink);
+
+@implementation UIScreen (DisplayLinkBlock)
+- (CADisplayLink*)displayLinkWithBlock:(DisplayLinkBlock)block
+{
+ return [self displayLinkWithTarget:[[block copy] autorelease]
+ selector:@selector(invokeDisplayLinkBlock:)];
+}
+@end
+
+@implementation NSObject (DisplayLinkBlock)
+- (void)invokeDisplayLinkBlock:(CADisplayLink *)sender
+{
+ DisplayLinkBlock block = static_cast<id>(self);
+ block(sender);
+}
+@end
+
+
+// -------------------------------------------------------------------------
+
static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
{
foreach (QScreen *screen, QGuiApplication::screens()) {
@@ -214,10 +237,16 @@ QIOSScreen::QIOSScreen(UIScreen *screen)
}
updateProperties();
+
+ m_displayLink = [m_uiScreen displayLinkWithBlock:^(CADisplayLink *) { deliverUpdateRequests(); }];
+ m_displayLink.paused = YES; // Enabled when clients call QWindow::requestUpdate()
+ [m_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
}
QIOSScreen::~QIOSScreen()
{
+ [m_displayLink invalidate];
+
[m_orientationListener release];
[m_uiWindow release];
}
@@ -297,6 +326,35 @@ void QIOSScreen::updateProperties()
QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry, m_availableGeometry);
}
+void QIOSScreen::setUpdatesPaused(bool paused)
+{
+ m_displayLink.paused = paused;
+}
+
+void QIOSScreen::deliverUpdateRequests() const
+{
+ bool pauseUpdates = true;
+
+ QList<QWindow*> windows = QGuiApplication::allWindows();
+ for (int i = 0; i < windows.size(); ++i) {
+ if (platformScreenForWindow(windows.at(i)) != this)
+ continue;
+
+ QWindowPrivate *wp = static_cast<QWindowPrivate *>(QObjectPrivate::get(windows.at(i)));
+ if (!wp->updateRequestPending)
+ continue;
+
+ wp->deliverUpdateRequest();
+
+ // Another update request was triggered, keep the display link running
+ if (wp->updateRequestPending)
+ pauseUpdates = false;
+ }
+
+ // Pause the display link if there are no pending update requests
+ m_displayLink.paused = pauseUpdates;
+}
+
QRect QIOSScreen::geometry() const
{
return m_geometry;
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index 6005d6dae3..afc2f0f89d 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -88,6 +88,10 @@ public:
QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ void requestUpdate() Q_DECL_OVERRIDE;
+
+ CAEAGLLayer *eaglLayer() const;
+
private:
void applicationStateChanged(Qt::ApplicationState state);
void applyGeometry(const QRect &rect);
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 481d4a06ab..fb2fd2b946 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -377,6 +377,17 @@ void QIOSWindow::clearAccessibleCache()
[m_view clearAccessibleCache];
}
+void QIOSWindow::requestUpdate()
+{
+ static_cast<QIOSScreen *>(screen())->setUpdatesPaused(false);
+}
+
+CAEAGLLayer *QIOSWindow::eaglLayer() const
+{
+ Q_ASSERT([m_view.layer isKindOfClass:[CAEAGLLayer class]]);
+ return static_cast<CAEAGLLayer *>(m_view.layer);
+}
+
#include "moc_qioswindow.cpp"
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index e859865687..c2d3849d8e 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -31,7 +31,7 @@ contains(QT_CONFIG, xcb-qt) {
DEFINES += XCB_USE_RENDER
XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb)
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static
+ LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
} else {
LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms
!contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index f4a4e5a78a..db9ea32cd8 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -88,7 +88,7 @@ contains(QT_CONFIG, xcb-qt) {
DEFINES += XCB_USE_RENDER
XCB_DIR = ../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static
+ LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
} else {
LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama
!contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 56caf52dcb..b13e10e3a5 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -428,6 +428,7 @@ bool QMYSQLResultPrivate::bindInValues()
bind->buffer_length = f.bufLength = fieldInfo->length + 1;
bind->is_null = &f.nullIndicator;
bind->length = &f.bufLength;
+ bind->is_unsigned = fieldInfo->flags & UNSIGNED_FLAG ? 1 : 0;
f.outField=field;
++i;
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index f0940b1611..5535295676 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -159,7 +159,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QGraphicsItem *itemAt(const QPointF &position) const {
QList<QGraphicsItem *> itemsAtPoint = items(position);
- return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
+ return itemsAtPoint.isEmpty() ? Q_NULLPTR : itemsAtPoint.first();
}
#endif
QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const;
@@ -173,7 +173,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const {
QList<QGraphicsItem *> itemsAtPoint = items(QPointF(x, y));
- return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
+ return itemsAtPoint.isEmpty() ? Q_NULLPTR : itemsAtPoint.first();
}
#endif
inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index d2e1a10566..b6fd9f8ba8 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2303,8 +2303,8 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
int visualColumn = d->header->visualIndex(current.column()) + 1;
while (visualColumn < d->model->columnCount(current.parent()) && isColumnHidden(d->header->logicalIndex(visualColumn)))
visualColumn++;
-
- QModelIndex next = current.sibling(current.row(), visualColumn);
+ const int newColumn = d->header->logicalIndex(visualColumn);
+ const QModelIndex next = current.sibling(current.row(), newColumn);
if (next.isValid())
return next;
}
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index f34714c016..7cbf979901 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -236,22 +236,9 @@ void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
qStringToLimitedWCharArray(tip, tnd.szTip, sizeof(tnd.szTip)/sizeof(wchar_t));
}
-static int iconFlag( QSystemTrayIcon::MessageIcon icon )
-{
- switch (icon) {
- case QSystemTrayIcon::Information:
- return NIIF_INFO;
- case QSystemTrayIcon::Warning:
- return NIIF_WARNING;
- case QSystemTrayIcon::Critical:
- return NIIF_ERROR;
- case QSystemTrayIcon::NoIcon:
- return NIIF_NONE;
- default:
- Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value");
- return NIIF_NONE;
- }
-}
+#ifndef NIIF_LARGE_ICON
+# define NIIF_LARGE_ICON 0x00000020
+#endif
bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
{
@@ -261,7 +248,22 @@ bool QSystemTrayIconSys::showMessage(const QString &title, const QString &messag
qStringToLimitedWCharArray(title, tnd.szInfoTitle, 64);
tnd.uID = q_uNOTIFYICONID;
- tnd.dwInfoFlags = iconFlag(type);
+ switch (type) {
+ case QSystemTrayIcon::Information:
+ tnd.dwInfoFlags = NIIF_INFO;
+ break;
+ case QSystemTrayIcon::Warning:
+ tnd.dwInfoFlags = NIIF_WARNING;
+ break;
+ case QSystemTrayIcon::Critical:
+ tnd.dwInfoFlags = NIIF_ERROR;
+ break;
+ case QSystemTrayIcon::NoIcon:
+ tnd.dwInfoFlags = hIcon ? NIIF_USER : NIIF_NONE;
+ break;
+ }
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
+ tnd.dwInfoFlags |= NIIF_LARGE_ICON;
tnd.cbSize = notifyIconSize;
tnd.hWnd = m_hwnd;
tnd.uTimeout = uSecs;
@@ -302,9 +304,10 @@ HICON QSystemTrayIconSys::createIcon()
const QIcon icon = q->icon();
if (icon.isNull())
return oldIcon;
- const int iconSizeX = GetSystemMetrics(SM_CXSMICON);
- const int iconSizeY = GetSystemMetrics(SM_CYSMICON);
- const QSize size = icon.actualSize(QSize(iconSizeX, iconSizeY));
+ const QSize requestedSize = QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA
+ ? QSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON))
+ : QSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
+ const QSize size = icon.actualSize(requestedSize);
const QPixmap pm = icon.pixmap(size);
if (pm.isNull())
return oldIcon;