summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure7
-rw-r--r--mkspecs/blackberry-armv7le-qcc/qmake.conf2
-rw-r--r--mkspecs/devices/linux-imx53qsb-g++/qmake.conf37
-rw-r--r--mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h42
-rw-r--r--mkspecs/features/cmake_functions.prf26
-rw-r--r--mkspecs/features/create_cmake.prf16
-rw-r--r--mkspecs/features/ctest_testcase.prf8
-rw-r--r--mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in2
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp7
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp4
-rw-r--r--src/corelib/io/qurlquery.cpp1
-rw-r--r--src/corelib/kernel/qcore_mac_p.h1
-rw-r--r--src/corelib/kernel/qpointer.cpp1
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp5
-rw-r--r--src/corelib/tools/qlocale_mac.mm22
-rw-r--r--src/corelib/tools/qstring.cpp15
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h1
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.cpp39
-rw-r--r--src/gui/kernel/qplatformwindow.h3
-rw-r--r--src/gui/kernel/qwindow.cpp17
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp4
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp40
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm39
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm46
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp27
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp213
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h15
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp29
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h10
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp49
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp9
-rw-r--r--src/tools/qdoc/node.cpp24
-rw-r--r--src/tools/qdoc/node.h4
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp15
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp7
-rw-r--r--src/widgets/itemviews/qheaderview.cpp14
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp28
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp4
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp6
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp14
-rw-r--r--tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp2
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp8
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp5
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp11
-rw-r--r--tests/manual/transientwindow/main.cpp51
-rw-r--r--tests/manual/transientwindow/mainwindow.cpp66
-rw-r--r--tests/manual/transientwindow/mainwindow.h64
-rw-r--r--tests/manual/transientwindow/transientwindow.pro6
-rw-r--r--tools/configure/configureapp.cpp2
67 files changed, 783 insertions, 355 deletions
diff --git a/configure b/configure
index 6d6b816c30..dee86c2704 100755
--- a/configure
+++ b/configure
@@ -2609,7 +2609,7 @@ if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
fi
if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG force_debug_info"
+ QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi
# pass on $CFG_SDK to the arch/configure tests.
@@ -3095,6 +3095,9 @@ Configure options:
-opensource ........ Compile and link the Open-Source Edition of Qt.
-commercial ........ Compile and link the Commercial Edition of Qt.
+ -confirm-license.... Automatically acknowledge the license (use with
+ either -opensource or -commercial)
+
-no-c++11 .......... Do not compile Qt with C++11 support enabled.
+ -c++11 ............. Compile Qt with C++11 support enabled.
@@ -3199,7 +3202,7 @@ Third Party Libraries:
Additional options:
-make <part> ....... Add part to the list of parts to be built at make time.
- ($QT_DEFAULT_BUILD_PARTS)
+ (defaults to: $QT_DEFAULT_BUILD_PARTS)
-nomake <part> ..... Exclude part from the list of parts to be built.
-skip <module> ..... Exclude an entire module from the build.
diff --git a/mkspecs/blackberry-armv7le-qcc/qmake.conf b/mkspecs/blackberry-armv7le-qcc/qmake.conf
index 45883b05ec..2e24e4e0d3 100644
--- a/mkspecs/blackberry-armv7le-qcc/qmake.conf
+++ b/mkspecs/blackberry-armv7le-qcc/qmake.conf
@@ -15,7 +15,7 @@ contains(QT_CONFIG, stack-protector-strong) {
QMAKE_CFLAGS += -fstack-protector -fstack-protector-all
}
-QMAKE_CFLAGS += -mcpu=cortex-a9
+QMAKE_CFLAGS += -mcpu=cortex-a9 -mtune=cortex-a9 -mthumb -D_FORTIFY_SOURCE=2
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
diff --git a/mkspecs/devices/linux-imx53qsb-g++/qmake.conf b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf
new file mode 100644
index 0000000000..0a5ed89feb
--- /dev/null
+++ b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf
@@ -0,0 +1,37 @@
+#
+# qmake configuration for the Freescale iMX53 board
+#
+# This mkspec is based and tested on the Yocto Project's Poky Distribution
+# with libEGL.so from Freescale without the X11 dependency.
+#
+# This mkspec is tested with a framebuffer (eglfs) configuration
+#
+# A typical configure line looks like:
+#
+# export PATH=/opt/imx53qsb/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi:$PATH
+#
+# ./configure -prefix /usr/local/qt5-imx53 -hostprefix /opt/imx53qsb/x86_64-linux/usr/local/qt5-imx53 -release -device linux-imx53qsb-g++
+# -opensource -confirm-license -no-gtkstyle -device-option CROSS_COMPILE=arm-poky-linux-gnueabi- -sysroot /opt/imx53qsb/sysroot
+# -eglfs -no-pch -opengl es2 -no-xcb -silent
+
+include(../common/linux_device_pre.conf)
+
+QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include
+QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
+
+QMAKE_LIBS_EGL += -lEGL
+QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
+QMAKE_LIBS_OPENVG += -lOpenVG -lEGL
+
+QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib
+
+IMX5_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -Wno-psabi
+IMX5_CFLAGS_RELEASE = -O2 $$IMX5_CFLAGS
+QMAKE_CFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
+QMAKE_CFLAGS_DEBUG += $$IMX5_CFLAGS
+QMAKE_CXXFLAGS_DEBUG += $$IMX5_CFLAGS
+
+include(../common/linux_device_post.conf)
+
+load(qt_config)
diff --git a/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h
new file mode 100644
index 0000000000..461f3d5589
--- /dev/null
+++ b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf
new file mode 100644
index 0000000000..62634d9b88
--- /dev/null
+++ b/mkspecs/features/cmake_functions.prf
@@ -0,0 +1,26 @@
+#
+# W A R N I N G
+# -------------
+#
+# This file is not part of the Qt API. It exists purely as an
+# implementation detail. It may change from version to version
+# without notice, or even be removed.
+#
+# We mean it.
+#
+
+defineReplace(cmakeModuleName) {
+ _module = $$1
+ _name = $$eval(QT.$${_module}.name)
+ cmake_module_name = $$replace(_name, ^Qt, )
+ return ($$cmake_module_name)
+}
+
+defineReplace(cmakeModuleList) {
+ variable = $$1
+ out =
+ for(v, variable) {
+ out += $$cmakeModuleName($$v)
+ }
+ return ($$join(out, ";"))
+}
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 43dca4cd70..428a3a4d43 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -9,21 +9,7 @@
# We mean it.
#
-defineReplace(cmakeModuleName) {
- _module = $$1
- _name = $$eval(QT.$${_module}.name)
- cmake_module_name = $$replace(_name, ^Qt, )
- return ($$cmake_module_name)
-}
-
-defineReplace(cmakeModuleList) {
- variable = $$1
- out =
- for(v, variable) {
- out += $$cmakeModuleName($$v)
- }
- return ($$join(out, ";"))
-}
+load(cmake_functions)
defineReplace(cmakeRelativePath) {
path = $$relative_path($$1, $$2)
diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf
index 7f86ca0052..7e841de790 100644
--- a/mkspecs/features/ctest_testcase.prf
+++ b/mkspecs/features/ctest_testcase.prf
@@ -31,6 +31,8 @@ isEmpty(CMAKE_VERSION) {
isEmpty(VERSION_OK) {
message("cmake $$CMAKE_VERSION is too old for this test.")
} else {
+ load(cmake_functions)
+
CMAKE_BUILD_TYPE = Debug
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\"
@@ -41,9 +43,13 @@ isEmpty(CMAKE_VERSION) {
CMAKE_PREFIX_PATH *= $$dirname(d)
}
+ dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
+ dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
+ dependentmodules = $$cmakeModuleList($$dependentmodules)
+
check.commands = \
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
- cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" && \
+ cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
$(TESTRUNNER) ctest --output-on-failure
}
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index d70dbedbf4..2940ad9dc1 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -103,7 +103,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
+ list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
endif()
set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\")
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index b1d7ca9dd1..3963416084 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -128,7 +128,7 @@ void QFSFileEnginePrivate::init()
#ifdef Q_OS_WIN
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 1cb3c03c30..24631f11c7 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -900,7 +900,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
return 0;
}
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
// get handle to the file
HANDLE handle = fileHandle;
@@ -933,7 +933,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
// first create the file mapping handle
DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY;
mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0);
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
q->setError(QFile::PermissionsError, qt_error_string());
#ifdef Q_USE_DEPRECATED_MAP_API
::CloseHandle(handle);
@@ -976,6 +976,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
}
::CloseHandle(mapHandle);
+ mapHandle = NULL;
return 0;
}
@@ -995,7 +996,7 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr)
maps.remove(ptr);
if (maps.isEmpty()) {
::CloseHandle(mapHandle);
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
}
return true;
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 478db6c299..d4e0779381 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -160,10 +160,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
// Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache
// location for everyone. Most applications seem to be using a
// cache directory located in their AppData directory
- return writableLocation(DataLocation) + QLatin1String("\\cache");
+ return writableLocation(DataLocation) + QLatin1String("/cache");
case GenericCacheLocation:
- return writableLocation(GenericDataLocation) + QLatin1String("\\cache");
+ return writableLocation(GenericDataLocation) + QLatin1String("/cache");
case RuntimeLocation:
case HomeLocation:
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 23c0b948e8..547084840f 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QUrlQuery
\inmodule QtCore
+ \since 5.0
\brief The QUrlQuery class provides a way to manipulate a key-value pairs in
a URL's query.
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index c3a3afaf6c..cbbbc18814 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -106,6 +106,7 @@ public:
return *this;
}
inline T *operator&() { return &type; }
+ template <typename X> X as() const { return reinterpret_cast<X>(type); }
static QCFType constructFromGet(const T &t)
{
CFRetain(t);
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index eea90be5eb..4fd6cd1779 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -158,6 +158,7 @@
/*!
\fn void QPointer::clear()
+ \since 5.0
Clears this QPointer object.
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 0eee425cf9..7a29247fc5 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -94,8 +94,7 @@ timeval QTimerInfoList::updateCurrentTime()
#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
-template <>
-timeval qAbs(const timeval &t)
+timeval qAbsTimeval(const timeval &t)
{
timeval tmp = t;
if (tmp.tv_sec < 0) {
@@ -144,7 +143,7 @@ bool QTimerInfoList::timeChanged(timeval *delta)
timeval tickGranularity;
tickGranularity.tv_sec = 0;
tickGranularity.tv_usec = msPerTick * 1000;
- return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
+ return elapsedTimeTicks < ((qAbsTimeval(*delta) - tickGranularity) * 10);
}
/*
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 0dc6f389b3..0c35860b56 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -434,18 +434,26 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case CurrencyToString:
return macFormatCurrency(in.value<QSystemLocale::CurrencyToStringArgument>());
case UILanguages: {
- QCFType<CFArrayRef> languages = (CFArrayRef)CFPreferencesCopyValue(
+ QCFType<CFPropertyListRef> languages = (CFArrayRef)CFPreferencesCopyValue(
CFSTR("AppleLanguages"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
- const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages);
QStringList result;
- result.reserve(cnt);
- for (int i = 0; i < cnt; ++i) {
- const QString lang = QCFString::toQString(
- static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages, i)));
- result.append(lang);
+ CFTypeID typeId = CFGetTypeID(languages);
+ if (typeId == CFArrayGetTypeID()) {
+ const int cnt = CFArrayGetCount(languages.as<CFArrayRef>());
+ result.reserve(cnt);
+ for (int i = 0; i < cnt; ++i) {
+ const QString lang = QCFString::toQString(
+ static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i)));
+ result.append(lang);
+ }
+ } else if (typeId == CFStringGetTypeID()) {
+ result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
+ } else {
+ qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org",
+ qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 61d5073a1f..404e3be289 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -9169,6 +9169,8 @@ QVector<uint> QStringRef::toUcs4() const
*/
/*!
+ \since 5.0
+
Converts a plain text string to an HTML string with
HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML
entities.
@@ -9237,6 +9239,19 @@ QString QString::toHtmlEscaped() const
\code
if (attribute.name() == QLatin1String("http-contents-length")) //...
\endcode
+
+ \note There some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets provided here
+ fail to compile with them.
+ \list
+ \li Concatenated string literals cannot be used with QStringLiteral.
+ \code
+ QString s = QStringLiteral("a" "b");
+ \endcode
+ \li QStringLiteral cannot be used to initialize lists or arrays of QString.
+ \code
+ QString a[] = { QStringLiteral("a"), QStringLiteral("b") };
+ \endcode
+ \endlist
*/
QT_END_NAMESPACE
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index d6161671b1..d5d742c9b3 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -2714,7 +2714,7 @@ bool QStandardItemModel::hasChildren(const QModelIndex &parent) const
*/
QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const
{
- return createIndex(row, column, idx.internalPointer());
+ return QAbstractItemModel::sibling(row, column, idx);
}
/*!
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index b4f03008fd..0d6649039c 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -332,6 +332,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
+ // Qt 6: Remove
QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c155ecfe0c..d0b37b7f1b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1559,6 +1559,8 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
QGuiApplicationPrivate::focus_window = newFocus;
+ if (!qApp)
+ return;
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index b710701e7f..79e4cbf674 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -41,11 +41,13 @@
#include "qplatformwindow.h"
#include "qplatformwindow_p.h"
+#include "qplatformscreen.h"
#include <private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/qwindow.h>
#include <QtGui/qscreen.h>
+#include <private/qwindow_p.h>
QT_BEGIN_NAMESPACE
@@ -449,6 +451,43 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &
}
/*!
+ Helper function to get initial geometry on windowing systems which do not
+ do smart positioning and also do not provide a means of centering a
+ transient window w.r.t. its parent. For example this is useful on Windows
+ and MacOS but not X11, because an X11 window manager typically tries to
+ layout new windows to optimize usage of the available desktop space.
+ However if the given window already has geometry which the application has
+ initialized, it takes priority.
+*/
+QRect QPlatformWindow::initialGeometry(const QWindow *w,
+ const QRect &initialGeometry, int defaultWidth, int defaultHeight)
+{
+ QRect rect(initialGeometry);
+ if (rect.isNull()) {
+ QSize minimumSize = w->minimumSize();
+ if (minimumSize.width() > 0 || minimumSize.height() > 0) {
+ rect.setSize(minimumSize);
+ } else {
+ rect.setWidth(defaultWidth);
+ rect.setHeight(defaultHeight);
+ }
+ }
+ if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic) {
+ const QWindow *tp = w->transientParent();
+ if (tp) {
+ // A transient window should be centered w.r.t. its transient parent.
+ rect.moveCenter(tp->geometry().center());
+ } else {
+ // Center the window on the screen. (Only applicable on platforms
+ // which do not provide a better way.)
+ QPlatformScreen *scr = QPlatformScreen::platformScreenForWindow(w);
+ rect.moveCenter(scr->availableGeometry().center());
+ }
+ }
+ return rect;
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index fe62d7b67b..410e7ea9bb 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -130,6 +130,9 @@ public:
virtual void setFrameStrutEventsEnabled(bool enabled);
virtual bool frameStrutEventsEnabled() const;
+ static QRect initialGeometry(const QWindow *w,
+ const QRect &initialGeometry, int defaultWidth, int defaultHeight);
+
protected:
static QString formatWindowTitle(const QString &title, const QString &separator);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 2fcad5706f..2a2e30634a 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -126,6 +126,18 @@ QT_BEGIN_NAMESPACE
and can keep rendering until it isExposed() returns false. To find out when
isExposed() changes, reimplement exposeEvent(). The window will always get
a resize event before the first expose event.
+
+ \section1 Initial geometry
+
+ If the window's width and height are left uninitialized, the window will
+ get a reasonable default geometry from the platform window. If the position
+ is left uninitialized, then the platform window will allow the windowing
+ system to position the window. For example on X11, the window manager
+ usually does some kind of smart positioning to try to avoid having new
+ windows completely obscure existing windows. However setGeometry()
+ initializes both the position and the size, so if you want a fixed size but
+ an automatic position, you should call resize() or setWidth() and
+ setHeight() instead.
*/
/*!
@@ -962,7 +974,7 @@ void QWindow::setY(int arg)
void QWindow::setWidth(int arg)
{
if (width() != arg)
- setGeometry(QRect(x(), y(), arg, height()));
+ resize(arg, height());
}
/*!
@@ -972,7 +984,7 @@ void QWindow::setWidth(int arg)
void QWindow::setHeight(int arg)
{
if (height() != arg)
- setGeometry(QRect(x(), y(), width(), arg));
+ resize(width(), arg);
}
/*!
@@ -1095,6 +1107,7 @@ void QWindow::setGeometry(int posx, int posy, int w, int h)
void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
+ d->positionAutomatic = false;
if (rect == geometry())
return;
QRect oldRect = geometry();
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 6933c892a0..26bf0700f2 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -88,6 +88,7 @@ public:
, resizeEventPending(true)
, receivedExpose(false)
, positionPolicy(WindowFrameExclusive)
+ , positionAutomatic(true)
, contentOrientation(Qt::PrimaryOrientation)
, opacity(qreal(1.0))
, minimumSize(0, 0)
@@ -137,6 +138,7 @@ public:
bool resizeEventPending;
bool receivedExpose;
PositionPolicy positionPolicy;
+ bool positionAutomatic;
Qt::ScreenOrientation contentOrientation;
qreal opacity;
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 2b28cdbf61..589b0e2c24 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -159,7 +159,7 @@ void QConnmanEngine::connectToId(const QString &id)
QOfonoDataConnectionManagerInterface dc(modemPath,0);
foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
primaryContext.setActive(true);
}
}
@@ -183,7 +183,7 @@ void QConnmanEngine::disconnectFromId(const QString &id)
QOfonoDataConnectionManagerInterface dc(modemPath,0);
foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
primaryContext.setActive(false);
}
}
diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp
index f6fb55522e..1983276d94 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux.cpp
+++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp
@@ -108,7 +108,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem()
foreach (const QDBusObjectPath &modem, modems) {
QOfonoModemInterface device(modem.path());
if (device.isPowered() && device.isOnline())
- return modem;;
+ return modem;
}
return QDBusObjectPath();
}
@@ -770,7 +770,7 @@ QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
return reply.value();
}
-QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent)
+QOfonoConnectionContextInterface::QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent)
: QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
dbusPathName,
OFONO_DATA_CONTEXT_INTERFACE,
@@ -778,68 +778,68 @@ QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QStri
{
}
-QOfonoPrimaryDataContextInterface::~QOfonoPrimaryDataContextInterface()
+QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface()
{
}
-bool QOfonoPrimaryDataContextInterface::isActive()
+bool QOfonoConnectionContextInterface::isActive()
{
QVariant var = getProperty("Active");
return qdbus_cast<bool>(var);
}
-QString QOfonoPrimaryDataContextInterface::getApName()
+QString QOfonoConnectionContextInterface::getApName()
{
QVariant var = getProperty("AccessPointName");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getType()
+QString QOfonoConnectionContextInterface::getType()
{
QVariant var = getProperty("Type");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getName()
+QString QOfonoConnectionContextInterface::getName()
{
QVariant var = getProperty("Name");
return qdbus_cast<QString>(var);
}
-QVariantMap QOfonoPrimaryDataContextInterface::getSettings()
+QVariantMap QOfonoConnectionContextInterface::getSettings()
{
QVariant var = getProperty("Settings");
return qdbus_cast<QVariantMap>(var);
}
-QString QOfonoPrimaryDataContextInterface::getInterface()
+QString QOfonoConnectionContextInterface::getInterface()
{
QVariant var = getProperty("Interface");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getAddress()
+QString QOfonoConnectionContextInterface::getAddress()
{
QVariant var = getProperty("Address");
return qdbus_cast<QString>(var);
}
-bool QOfonoPrimaryDataContextInterface::setActive(bool on)
+bool QOfonoConnectionContextInterface::setActive(bool on)
{
// this->setProperty("Active", QVariant(on));
return setProp("Active", QVariant::fromValue(on));
}
-bool QOfonoPrimaryDataContextInterface::setApn(const QString &name)
+bool QOfonoConnectionContextInterface::setApn(const QString &name)
{
return setProp("AccessPointName", QVariant::fromValue(name));
}
-void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
+void QOfonoConnectionContextInterface::connectNotify(const QMetaMethod &signal)
{
Q_UNUSED(signal);
-// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged);
// if (signal == propertyChangedSignal) {
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
// this->path(),
@@ -850,7 +850,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
// }
// }
-// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChangedContext);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChangedContext);
// if (signal == propertyChangedContextSignal) {
// QOfonoDBusHelper *helper;
// helper = new QOfonoDBusHelper(this);
@@ -867,16 +867,16 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
// }
}
-void QOfonoPrimaryDataContextInterface::disconnectNotify(const QMetaMethod &signal)
+void QOfonoConnectionContextInterface::disconnectNotify(const QMetaMethod &signal)
{
Q_UNUSED(signal);
-// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged);
// if (signal == propertyChangedSignal) {
// }
}
-QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
+QVariant QOfonoConnectionContextInterface::getProperty(const QString &property)
{
QVariant var;
QVariantMap map = getProperties();
@@ -888,13 +888,13 @@ QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
return var;
}
-QVariantMap QOfonoPrimaryDataContextInterface::getProperties()
+QVariantMap QOfonoConnectionContextInterface::getProperties()
{
QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
return reply.value();
}
-bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const QVariant &var)
+bool QOfonoConnectionContextInterface::setProp(const QString &property, const QVariant &var)
{
QList<QVariant> args;
args << QVariant::fromValue(property) << QVariant::fromValue(QDBusVariant(var));
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
index 00be9aa675..c73e8231a2 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux_p.h
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -76,7 +76,7 @@
#define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator"
#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.DataConnectionManager"
#define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager"
-#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.PrimaryDataContext"
+#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.ConnectionContext"
#define OFONO_SMS_MANAGER_INTERFACE "org.ofono.SmsManager"
#define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook"
@@ -281,14 +281,14 @@ protected:
};
-class QOfonoPrimaryDataContextInterface : public QDBusAbstractInterface
+class QOfonoConnectionContextInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
- explicit QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent = 0);
- ~QOfonoPrimaryDataContextInterface();
+ explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QOfonoConnectionContextInterface();
QVariantMap getProperties();
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 7f022da4c3..31726268f1 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -73,7 +73,9 @@ QPaintDevice *QCocoaBackingStore::paintDevice()
}
#endif
- m_qImage = QImage(m_requestedSize * scaleFactor, QImage::Format_ARGB32_Premultiplied);
+ QImage::Format format = window()->format().hasAlpha()
+ ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
+ m_qImage = QImage(m_requestedSize * scaleFactor, format);
m_qImage.setDevicePixelRatio(scaleFactor);
}
return &m_qImage;
@@ -91,7 +93,7 @@ void QCocoaBackingStore::flush(QWindow *win, const QRegion &region, const QPoint
CGImageRelease(m_cgImage);
m_cgImage = 0;
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle()))
- [cocoaWindow->m_contentView flushBackingStore:this region:region offset:offset];
+ [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
}
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 7fcdab4d97..93831158d0 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -170,13 +170,13 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
windowSize.setHeight(windowRect.height());
}
- QPixmap windowPixmap(windowSize);
+ QPixmap windowPixmap(windowSize * devicePixelRatio());
windowPixmap.fill(Qt::transparent);
for (uint i = 0; i < displayCount; ++i) {
const CGRect bounds = CGDisplayBounds(displays[i]);
- int w = (width < 0 ? bounds.size.width : width);
- int h = (height < 0 ? bounds.size.height : height);
+ int w = (width < 0 ? bounds.size.width : width) * devicePixelRatio();
+ int h = (height < 0 ? bounds.size.height : height) * devicePixelRatio();
QRect displayRect = QRect(x, y, w, h);
QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i],
CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height()));
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index bae52c91b8..c0c8caed05 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -77,8 +77,10 @@ QCocoaMenuBar::~QCocoaMenuBar()
[m_nativeMenu release];
static_menubars.removeOne(this);
- if (m_window)
+ if (m_window && m_window->menubar() == this) {
m_window->setMenubar(0);
+ updateMenuBarImmediately();
+ }
}
void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before)
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index d78ff73bb6..bdcad6f490 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -315,9 +315,12 @@ NSMenuItem *QCocoaMenuItem::sync()
return m_native;
}
+QT_BEGIN_NAMESPACE
+extern QString qt_mac_applicationmenu_string(int type);
+QT_END_NAMESPACE
+
QString QCocoaMenuItem::mergeText()
{
- extern QString qt_mac_applicationmenu_string(int type);
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
if (m_native == [loader aboutMenuItem]) {
return qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName());
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 9506f86238..2f79b49534 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -102,6 +102,9 @@ private:
// QImage <-> CGImage conversion functions
static CGImageRef qImageToCGImage(const QImage &image);
static QImage cgImageToQImage(CGImageRef image);
+
+ // Embedding NSViews as child QWindows
+ static void setWindowContentView(QPlatformWindow *window, void *nsViewContentView);
};
#endif // QCOCOANATIVEINTERFACE_H
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index bd3a909137..9990537c1f 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -113,6 +113,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage);
if (resource.toLower() == "cgimagetoqimage")
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage);
+ if (resource.toLower() == "setwindowcontentview")
+ return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setWindowContentView);
return 0;
}
@@ -198,5 +200,10 @@ QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image)
return qt_mac_toQImage(image);
}
+void QCocoaNativeInterface::setWindowContentView(QPlatformWindow *window, void *contentView)
+{
+ QCocoaWindow *cocoaPlatformWindow = static_cast<QCocoaWindow *>(window);
+ cocoaPlatformWindow->setContentView(reinterpret_cast<NSView *>(contentView));
+}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 324a43c8ae..2422788f7a 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -119,6 +119,7 @@ public:
void setParent(const QPlatformWindow *window);
NSView *contentView() const;
+ void setContentView(NSView *contentView);
void windowWillMove();
void windowDidMove();
@@ -160,8 +161,11 @@ public: // for QNSView
friend class QCocoaBackingStore;
friend class QCocoaNativeInterface;
- QNSView *m_contentView;
+ NSView *m_contentView;
+ QNSView *m_qtView;
NSWindow *m_nsWindow;
+ bool m_contentViewIsEmbedded; // true if the m_contentView is embedded in a "foregin" NSView hiearchy
+
QNSWindowDelegate *m_nsWindowDelegate;
Qt::WindowFlags m_windowFlags;
Qt::WindowState m_synchedWindowState;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 45100f9906..2adf0d24a1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -58,6 +58,11 @@
#include <QDebug>
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
+
static bool isMouseEvent(NSEvent *ev)
{
switch ([ev type]) {
@@ -186,6 +191,7 @@ static bool isMouseEvent(NSEvent *ev)
QCocoaWindow::QCocoaWindow(QWindow *tlw)
: QPlatformWindow(tlw)
, m_nsWindow(0)
+ , m_contentViewIsEmbedded(false)
, m_nsWindowDelegate(0)
, m_synchedWindowState(Qt::WindowActive)
, m_windowModality(Qt::NonModal)
@@ -200,7 +206,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
#endif
QCocoaAutoReleasePool pool;
- m_contentView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+ m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+ m_contentView = m_qtView;
setGeometry(tlw->geometry());
recreateWindow(parent());
@@ -237,6 +244,10 @@ void QCocoaWindow::setGeometry(const QRect &rect)
void QCocoaWindow::setCocoaGeometry(const QRect &rect)
{
QCocoaAutoReleasePool pool;
+
+ if (m_contentViewIsEmbedded)
+ return;
+
if (m_nsWindow) {
NSRect bounds = qt_mac_flipRect(rect, window());
[m_nsWindow setContentSize : bounds.size];
@@ -529,7 +540,7 @@ void QCocoaWindow::setMask(const QRegion &region)
[m_nsWindow setBackgroundColor:[NSColor clearColor]];
}
- [m_contentView setMaskRegion:&region];
+ [m_qtView setMaskRegion:&region];
}
bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
@@ -573,6 +584,19 @@ NSView *QCocoaWindow::contentView() const
return m_contentView;
}
+void QCocoaWindow::setContentView(NSView *contentView)
+{
+ // Remove and release the previous content view
+ [m_contentView removeFromSuperview];
+ [m_contentView release];
+
+ // Insert and retain the new content view
+ [contentView retain];
+ m_contentView = contentView;
+ m_qtView = 0; // The new content view is not a QNSView.
+ recreateWindow(parent()); // Adds the content view to parent NSView
+}
+
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
@@ -585,7 +609,7 @@ void QCocoaWindow::windowWillMove()
void QCocoaWindow::windowDidMove()
{
- [m_contentView updateGeometry];
+ [m_qtView updateGeometry];
}
void QCocoaWindow::windowDidResize()
@@ -593,7 +617,7 @@ void QCocoaWindow::windowDidResize()
if (!m_nsWindow)
return;
- [m_contentView updateGeometry];
+ [m_qtView updateGeometry];
}
void QCocoaWindow::windowWillClose()
@@ -634,7 +658,9 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
m_nsWindowDelegate = 0;
}
- if (!parentWindow) {
+ if (window()->type() == Qt::SubWindow) {
+ // Subwindows don't have a NSWindow.
+ } else if (!parentWindow) {
// Create a new NSWindow if this is a top-level window.
m_nsWindow = createNSWindow();
setNSWindow(m_nsWindow);
@@ -662,7 +688,8 @@ NSWindow * QCocoaWindow::createNSWindow()
{
QCocoaAutoReleasePool pool;
- NSRect frame = qt_mac_flipRect(window()->geometry(), window());
+ QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight);
+ NSRect frame = qt_mac_flipRect(rect, window());
Qt::WindowType type = window()->type();
Qt::WindowFlags flags = window()->flags();
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 1d59592e7d..02635ea4ec 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -173,6 +173,36 @@ static QTouchDevice *touchDevice = 0;
QWindowSystemInterface::handleExposeEvent(m_window, m_window->geometry());
}
+- (void)viewDidMoveToSuperview
+{
+ if (!(m_window->type() & Qt::SubWindow))
+ return;
+
+ if ([self superview]) {
+ m_platformWindow->m_contentViewIsEmbedded = true;
+ QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry());
+ QWindowSystemInterface::handleExposeEvent(m_window, m_platformWindow->geometry());
+ QWindowSystemInterface::flushWindowSystemEvents();
+ } else {
+ m_platformWindow->m_contentViewIsEmbedded = false;
+ }
+}
+
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+ // ### Merge "normal" window code path with this one for 5.1.
+ if (!(m_window->type() & Qt::SubWindow))
+ return;
+
+ if (newWindow) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(windowNotification:)
+ name:nil // Get all notifications
+ object:newWindow];
+ } else {
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:[self window]];
+ }
+}
- (void)updateGeometry
{
QRect geometry;
@@ -181,6 +211,9 @@ static QTouchDevice *touchDevice = 0;
NSRect rect = [self frame];
NSRect windowRect = [[self window] frame];
geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
+ } else if (m_window->type() & Qt::SubWindow) {
+ // embedded child window, use the frame rect ### merge with case below
+ geometry = qt_mac_toQRect([self bounds]);
} else {
// child window, use the frame rect
geometry = qt_mac_toQRect([self frame]);
@@ -198,6 +231,12 @@ static QTouchDevice *touchDevice = 0;
// an infinite loop when this notification is triggered again.)
m_platformWindow->QPlatformWindow::setGeometry(geometry);
+ // Don't send the geometry change if the QWindow is designated to be
+ // embedded in a foregin view hiearchy but has not actually been
+ // embedded yet - it's too early.
+ if ((m_window->type() & Qt::SubWindow) && !m_platformWindow->m_contentViewIsEmbedded)
+ return;
+
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
@@ -317,7 +356,12 @@ static QTouchDevice *touchDevice = 0;
);
CGImageRef bsCGImage = m_backingStore->getBackingStoreCGImage();
CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect);
- CGContextSetBlendMode(cgContext, kCGBlendModeCopy);
+
+ // Optimization: Copy frame buffer content instead of blending for
+ // top-level windows where Qt fills the entire window content area.
+ if (m_platformWindow->m_nsWindow)
+ CGContextSetBlendMode(cgContext, kCGBlendModeCopy);
+
CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg);
// Clean-up:
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index ab9c94772b..43e24034c9 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -272,9 +272,9 @@ void QQnxWindow::setVisible(bool visible)
window()->requestActivate();
if (window()->isTopLevel()) {
- if (visible) {
- QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
- } else {
+ QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
+
+ if (!visible) {
// Flush the context, otherwise it won't disappear immediately
screen_flush_context(m_screenContext, 0);
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 99ef3aacf3..1ea660d944 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -854,10 +854,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return true;
case QtWindows::ShowEvent:
platformWindow->handleShown();
- return true;
+ return false; // Indicate transient children should be shown by windows (SW_PARENTOPENING)
case QtWindows::HideEvent:
platformWindow->handleHidden();
- return true;
+ return false;// Indicate transient children should be hidden by windows (SW_PARENTCLOSING)
case QtWindows::CloseEvent:
QWindowSystemInterface::handleCloseEvent(platformWindow->window());
return true;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 24dc01f0bd..ca484415be 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -78,7 +78,7 @@ public:
# ifndef QT_NO_DRAGANDDROP
virtual QPlatformDrag *drag() const;
# endif
-#endif !QT_NO_CLIPBOARD
+#endif // !QT_NO_CLIPBOARD
virtual QPlatformInputContext *inputContext() const;
#ifndef QT_NO_ACCESSIBILITY
virtual QPlatformAccessibility *accessibility() const;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 07dc668b3f..7a68cdeb47 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -64,6 +64,11 @@
QT_BEGIN_NAMESPACE
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
+
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
static QByteArray debugWinStyle(DWORD style)
@@ -198,17 +203,16 @@ static inline QSize clientSize(HWND hwnd)
return qSizeOfRect(rect);
}
-// from qwidget_win.cpp/maximum layout size check removed.
-static bool shouldShowMaximizeButton(Qt::WindowFlags flags)
+// from qwidget_win.cpp
+static bool shouldShowMaximizeButton(const QWindow *w)
{
- if (flags & Qt::MSWindowsFixedSizeDialogHint)
+ const Qt::WindowFlags flags = w->flags();
+ if ((flags & Qt::MSWindowsFixedSizeDialogHint) || !(flags & Qt::WindowMaximizeButtonHint))
return false;
// if the user explicitly asked for the maximize button, we try to add
// it even if the window has fixed size.
- if (flags & Qt::CustomizeWindowHint &&
- flags & Qt::WindowMaximizeButtonHint)
- return true;
- return flags & Qt::WindowMaximizeButtonHint;
+ return (flags & Qt::CustomizeWindowHint) ||
+ w->maximumSize() == QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX);
}
// Set the WS_EX_LAYERED flag on a HWND if required. This is required for
@@ -427,7 +431,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
style |= WS_SYSMENU;
if (flags & Qt::WindowMinimizeButtonHint)
style |= WS_MINIMIZEBOX;
- if (shouldShowMaximizeButton(flags))
+ if (shouldShowMaximizeButton(w))
style |= WS_MAXIMIZEBOX;
if (tool)
exStyle |= WS_EX_TOOLWINDOW;
@@ -468,6 +472,8 @@ QWindowsWindow::WindowData
const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL);
+ QRect rect = QPlatformWindow::initialGeometry(w, geometry, defaultWindowWidth, defaultWindowHeight);
+
if (title.isEmpty() && (result.flags & Qt::WindowTitleHint))
title = topLevel ? qAppName() : w->objectName();
@@ -475,14 +481,14 @@ QWindowsWindow::WindowData
const wchar_t *classNameUtf16 = reinterpret_cast<const wchar_t *>(windowClassName.utf16());
// Capture events before CreateWindowEx() returns.
- const QWindowCreationContextPtr context(new QWindowCreationContext(w, geometry, style, exStyle));
+ const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, style, exStyle));
QWindowsContext::instance()->setWindowCreationContext(context);
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< "CreateWindowEx: " << w << *this
<< " class=" <<windowClassName << " title=" << title
- << "\nrequested: " << geometry << ": "
+ << "\nrequested: " << rect << ": "
<< context->frameWidth << 'x' << context->frameHeight
<< '+' << context->frameX << '+' << context->frameY;
@@ -775,6 +781,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
QWindowsWindow::~QWindowsWindow()
{
#ifndef Q_OS_WINCE
+ QWindowSystemInterface::flushWindowSystemEvents();
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
#endif // !Q_OS_WINCE
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 11c74edc45..2a6ef5a6ee 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -104,57 +104,6 @@ static Window createDummyWindow(QXcbScreen *screen, GLXFBConfig config)
return window;
}
-// Per-window data for active OpenGL contexts.
-struct QOpenGLContextData
-{
- QOpenGLContextData(Display *display, Window window, GLXContext context)
- : m_display(display),
- m_window(window),
- m_context(context)
- {}
-
- QOpenGLContextData()
- : m_display(0),
- m_window(0),
- m_context(0)
- {}
-
- Display *m_display;
- Window m_window;
- GLXContext m_context;
-};
-
-static inline QOpenGLContextData currentOpenGLContextData()
-{
- QOpenGLContextData result;
- result.m_display = glXGetCurrentDisplay();
- result.m_window = glXGetCurrentDrawable();
- result.m_context = glXGetCurrentContext();
- return result;
-}
-
-static inline QOpenGLContextData createDummyWindowOpenGLContextData(QXcbScreen *screen)
-{
- QOpenGLContextData result;
- result.m_display = DISPLAY_FROM_XCB(screen);
-
- QSurfaceFormat format;
- GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen), screen->screenNumber(), format);
- if (config) {
- result.m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, true);
- result.m_window = createDummyWindow(screen, config);
- } else {
- XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(screen), screen->screenNumber(), &format);
- if (!visualInfo)
- qFatal("Could not initialize GLX");
- result.m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, 0, true);
- result.m_window = createDummyWindow(screen, visualInfo);
- XFree(visualInfo);
- }
-
- return result;
-}
-
static inline QByteArray getGlString(GLenum param)
{
if (const GLubyte *s = glGetString(param))
@@ -202,70 +151,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
format.setProfile(QSurfaceFormat::CompatibilityProfile);
}
-/*!
- \class QOpenGLTemporaryContext
- \brief A temporary context that can be instantiated on the stack.
-
- Functions like glGetString() only work if there is a current GL context.
-
- \internal
- \ingroup qt-lighthouse-xcb
-*/
-class QOpenGLTemporaryContext
-{
- Q_DISABLE_COPY(QOpenGLTemporaryContext)
-public:
- QOpenGLTemporaryContext(QXcbScreen *screen);
- ~QOpenGLTemporaryContext();
-
-private:
- const QOpenGLContextData m_previous;
- const QOpenGLContextData m_current;
-};
-
-QOpenGLTemporaryContext::QOpenGLTemporaryContext(QXcbScreen *screen)
- : m_previous(currentOpenGLContextData()),
- m_current(createDummyWindowOpenGLContextData(screen))
-{
- // Make our temporary context current on our temporary window
- glXMakeCurrent(m_current.m_display, m_current.m_window, m_current.m_context);
-}
-
-QOpenGLTemporaryContext::~QOpenGLTemporaryContext()
-{
- // Restore the previous context if possible, otherwise just release our temporary context
- if (m_previous.m_display)
- glXMakeCurrent(m_previous.m_display, m_previous.m_window, m_previous.m_context);
- else
- glXMakeCurrent(m_current.m_display, 0, 0);
-
- // Destroy our temporary window
- XDestroyWindow(m_current.m_display, m_current.m_window);
-
- // Finally destroy our temporary context itself
- glXDestroyContext(m_current.m_display, m_current.m_context);
-}
-
-QOpenGLDefaultContextInfo::QOpenGLDefaultContextInfo()
- : vendor(getGlString(GL_VENDOR)),
- renderer(getGlString(GL_RENDERER))
-{
- updateFormatFromContext(format);
-}
-
-QOpenGLDefaultContextInfo *QOpenGLDefaultContextInfo::create(QXcbScreen *screen)
-{
- // We need a current context for getGLString() to work. To have
- // the QOpenGLDefaultContextInfo contain the latest supported
- // context version, we rely upon the QOpenGLTemporaryContext to
- // correctly obtain a context with the latest version
- QScopedPointer<QOpenGLTemporaryContext> temporaryContext(new QOpenGLTemporaryContext(screen));
- QOpenGLDefaultContextInfo *result = new QOpenGLDefaultContextInfo;
- return result;
-}
-
-
-QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo)
+QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: QPlatformOpenGLContext()
, m_screen(screen)
, m_context(0)
@@ -287,51 +173,60 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' ');
bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile");
- // Use glXCreateContextAttribsARB if is available
+ // Use glXCreateContextAttribsARB if available
if (glxExt.contains("GLX_ARB_create_context") && glXCreateContextAttribsARB != 0) {
- // We limit the requested version by the version of the static context as
- // glXCreateContextAttribsARB fails and returns NULL if the requested context
- // version is not supported. This means that we will get the closest supported
- // context format that that which was requested and is supported by the driver
- const int maxSupportedVersion = (defaultContextInfo->format.majorVersion() << 8)
- + defaultContextInfo->format.minorVersion();
- const int requestedVersion = qMin((format.majorVersion() << 8) + format.minorVersion(),
- maxSupportedVersion);
- const int majorVersion = requestedVersion >> 8;
- const int minorVersion = requestedVersion & 0xFF;
-
- QVector<int> contextAttributes;
- contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion
- << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion;
-
- // If asking for OpenGL 3.2 or newer we should also specify a profile
- if (supportsProfiles && (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1))) {
- if (m_format.profile() == QSurfaceFormat::CoreProfile)
- contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
- else
- contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
- }
-
- int flags = 0;
-
- if (m_format.testOption(QSurfaceFormat::DebugContext))
- flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
-
- // A forward-compatible context may be requested for 3.0 and later
- if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions))
- flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
-
- if (flags != 0)
- contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags;
-
- contextAttributes << None;
-
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());
- if (!m_context && m_shareContext) {
- // re-try without a shared glx context
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data());
- if (m_context)
- m_shareContext = 0;
+ // Try to create an OpenGL context for each known OpenGL version in descending
+ // order from the requested version.
+ const int requestedVersion = format.majorVersion() * 10 + qMin(format.minorVersion(), 9);
+
+ QVector<int> glVersions;
+ if (requestedVersion > 43)
+ glVersions << requestedVersion;
+
+ // Don't bother with versions below 2.0
+ glVersions << 43 << 42 << 41 << 40 << 33 << 32 << 31 << 30 << 21 << 20;
+
+ for (int i = 0; !m_context && i < glVersions.count(); i++) {
+ const int version = glVersions[i];
+ if (version > requestedVersion)
+ continue;
+
+ const int majorVersion = version / 10;
+ const int minorVersion = version % 10;
+
+ QVector<int> contextAttributes;
+ contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion
+ << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion;
+
+ // If asking for OpenGL 3.2 or newer we should also specify a profile
+ if (version >= 32 && supportsProfiles) {
+ if (m_format.profile() == QSurfaceFormat::CoreProfile)
+ contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ else
+ contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+
+ int flags = 0;
+
+ if (m_format.testOption(QSurfaceFormat::DebugContext))
+ flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
+
+ // A forward-compatible context may be requested for 3.0 and later
+ if (version >= 30 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions))
+ flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+
+ if (flags != 0)
+ contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags;
+
+ contextAttributes << None;
+
+ m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());
+ if (!m_context && m_shareContext) {
+ // re-try without a shared glx context
+ m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data());
+ if (m_context)
+ m_shareContext = 0;
+ }
}
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 78e9985334..98aee78b14 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -54,23 +54,10 @@
QT_BEGIN_NAMESPACE
-class QOpenGLDefaultContextInfo
-{
- Q_DISABLE_COPY(QOpenGLDefaultContextInfo)
- QOpenGLDefaultContextInfo();
-public:
- static QOpenGLDefaultContextInfo *create(QXcbScreen *screen);
-
- const QByteArray vendor;
- const QByteArray renderer;
- QSurfaceFormat format;
-};
-
-
class QGLXContext : public QPlatformOpenGLContext
{
public:
- QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo);
+ QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
~QGLXContext();
bool makeCurrent(QPlatformSurface *surface);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 32de54562a..4525cb8ccb 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -222,7 +222,6 @@ void QXcbConnection::updateScreens()
// Delete any existing screens which are not in activeScreens
for (int i = m_screens.count() - 1; i >= 0; --i) {
if (!activeScreens.contains(m_screens[i])) {
- ((QXcbIntegration*)QGuiApplicationPrivate::platformIntegration())->removeDefaultOpenGLContextInfo(m_screens[i]);
delete m_screens[i];
m_screens.removeAt(i);
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 1840dd1ce5..60acf1ff02 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -121,9 +121,6 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
QXcbIntegration::~QXcbIntegration()
{
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- qDeleteAll(m_defaultContextInfos);
-#endif
qDeleteAll(m_connections);
}
@@ -181,14 +178,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
{
QXcbScreen *screen = static_cast<QXcbScreen *>(context->screen()->handle());
#if defined(XCB_USE_GLX)
- QOpenGLDefaultContextInfo *defaultContextInfo;
- if (m_defaultContextInfos.contains(screen)) {
- defaultContextInfo = m_defaultContextInfos.value(screen);
- } else {
- defaultContextInfo = QOpenGLDefaultContextInfo::create(screen);
- m_defaultContextInfos.insert(screen, defaultContextInfo);
- }
- return new QGLXContext(screen, context->format(), context->shareHandle(), defaultContextInfo);
+ return new QGLXContext(screen, context->format(), context->shareHandle());
#elif defined(XCB_USE_EGL)
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(),
screen->connection()->egl_display(), screen->connection());
@@ -293,21 +283,4 @@ QPlatformTheme *QXcbIntegration::createPlatformTheme(const QString &name) const
return QGenericUnixTheme::createUnixTheme(name);
}
-/*!
- Called by QXcbConnection prior to a QQnxScreen being deleted.
-
- Destroys and cleans up any default OpenGL context info for this screen.
-*/
-void QXcbIntegration::removeDefaultOpenGLContextInfo(QXcbScreen *screen)
-{
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- if (!m_defaultContextInfos.contains(screen))
- return;
- QOpenGLDefaultContextInfo* info = m_defaultContextInfos.take(screen);
- delete info;
-#else
- Q_UNUSED(screen);
-#endif
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index cd6c2fd73c..1dd8d4576b 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -52,10 +52,6 @@ class QAbstractEventDispatcher;
class QXcbNativeInterface;
class QXcbScreen;
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
-class QOpenGLDefaultContextInfo;
-#endif
-
class QXcbIntegration : public QPlatformIntegration
{
public:
@@ -97,8 +93,6 @@ public:
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
- void removeDefaultOpenGLContextInfo(QXcbScreen *screen);
-
private:
QList<QXcbConnection *> m_connections;
@@ -108,10 +102,6 @@ private:
QScopedPointer<QPlatformInputContext> m_inputContext;
QAbstractEventDispatcher *m_eventDispatcher;
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- mutable QHash<QXcbScreen *, QOpenGLDefaultContextInfo *> m_defaultContextInfos;
-#endif
-
#ifndef QT_NO_ACCESSIBILITY
QScopedPointer<QPlatformAccessibility> m_accessibility;
#endif
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c0ddf5c0ae..abd2f7a147 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -113,6 +113,10 @@
#endif
#define XCOORD_MAX 16383
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
//#ifdef NET_WM_STATE_DEBUG
@@ -219,8 +223,16 @@ void QXcbWindow::create()
QRect rect = window()->geometry();
QPlatformWindow::setGeometry(rect);
- rect.setWidth(qBound(1, rect.width(), XCOORD_MAX));
- rect.setHeight(qBound(1, rect.height(), XCOORD_MAX));
+ QSize minimumSize = window()->minimumSize();
+ if (rect.width() > 0 || rect.height() > 0) {
+ rect.setWidth(qBound(1, rect.width(), XCOORD_MAX));
+ rect.setHeight(qBound(1, rect.height(), XCOORD_MAX));
+ } else if (minimumSize.width() > 0 || minimumSize.height() > 0) {
+ rect.setSize(minimumSize);
+ } else {
+ rect.setWidth(defaultWindowWidth);
+ rect.setHeight(defaultWindowHeight);
+ }
xcb_window_t xcb_parent_id = m_screen->root();
if (parent())
@@ -436,15 +448,23 @@ void QXcbWindow::setGeometry(const QRect &rect)
propagateSizeHints();
const QRect wmGeometry = windowToWmGeometry(rect);
- const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
- const qint32 values[] = {
- qBound<qint32>(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX),
- qBound<qint32>(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX),
- qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
- qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
- };
-
- Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ if (qt_window_private(window())->positionAutomatic) {
+ const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const qint32 values[] = {
+ qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
+ };
+ Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ } else {
+ const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const qint32 values[] = {
+ qBound<qint32>(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX),
+ qBound<qint32>(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
+ };
+ Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ }
xcb_flush(xcb_connection());
}
@@ -563,6 +583,7 @@ void QXcbWindow::show()
if (!transientXcbParent)
transientXcbParent = static_cast<QXcbScreen *>(screen())->clientLeader();
if (transientXcbParent) { // ICCCM 4.1.2.6
+ m_gravity = XCB_GRAVITY_CENTER;
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
1, &transientXcbParent));
@@ -1221,8 +1242,10 @@ void QXcbWindow::propagateSizeHints()
QWindow *win = window();
- xcb_size_hints_set_position(&hints, true, rect.x(), rect.y());
- xcb_size_hints_set_size(&hints, true, rect.width(), rect.height());
+ if (!qt_window_private(win)->positionAutomatic)
+ xcb_size_hints_set_position(&hints, true, rect.x(), rect.y());
+ if (rect.width() < QWINDOWSIZE_MAX || rect.height() < QWINDOWSIZE_MAX)
+ xcb_size_hints_set_size(&hints, true, rect.width(), rect.height());
xcb_size_hints_set_win_gravity(&hints, m_gravity);
QSize minimumSize = win->minimumSize();
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index ff7d9254fc..f0cfc18515 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -1259,7 +1259,6 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
}
else {
FastSection all(qmlClassNode,QString(),QString(),"member","members");
-
const QmlClassNode* current = qmlClassNode;
while (current != 0) {
NodeList::ConstIterator c = current->childNodes().constBegin();
@@ -1271,9 +1270,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
if ((*p)->type() == Node::QmlProperty) {
QString key = current->name() + "::" + (*p)->name();
key = sortName(*p, &key);
- if (!all.memberMap.contains(key))
+ if (!all.memberMap.contains(key)) {
all.memberMap.insert(key,*p);
- //insert(all,*p,style,Okay);
+ }
}
++p;
}
@@ -1281,9 +1280,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
else {
QString key = current->name() + "::" + (*c)->name();
key = sortName(*c, &key);
- if (!all.memberMap.contains(key))
+ if (!all.memberMap.contains(key)) {
all.memberMap.insert(key,*c);
- //insert(all,*c,style,Okay);
+ }
}
++c;
}
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index abb348eb51..c293d48673 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -662,6 +662,16 @@ bool InnerNode::hasMembers() const
}
/*!
+ Appends \a node to the members list, if and only if it
+ isn't already in the members list.
+ */
+void InnerNode::addMember(Node* node)
+{
+ if (!members_.contains(node))
+ members_.append(node);
+}
+
+/*!
Returns true if this node's members collection contains at
least one namespace node.
*/
@@ -2188,6 +2198,20 @@ bool Node::setQmlModuleInfo(const QString& arg)
}
/*!
+ If this QML type node has a base type node,
+ return the fully qualified name of that QML
+ type, i.e. <QML-module-name>::<QML-type-name>.
+ */
+QString QmlClassNode::qmlFullBaseName() const
+{
+ QString result;
+ if (baseNode_) {
+ result = baseNode_->qmlModuleIdentifier() + "::" + baseNode_->name();
+ }
+ return result;
+}
+
+/*!
The name of this QML class node might be the same as the
name of some other QML class node. If so, then this node's
parent will be a NameCollisionNode.This function sets the
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index f76b115416..4802b6de54 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -240,6 +240,7 @@ public:
QString guid() const;
QString extractClassName(const QString &string) const;
virtual QString qmlTypeName() const { return name_; }
+ virtual QString qmlFullBaseName() const { return QString(); }
virtual QString qmlModuleName() const { return qmlModuleName_; }
virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; }
virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; }
@@ -332,7 +333,7 @@ public:
const NodeList & childNodes() const { return children_; }
const NodeList & relatedNodes() const { return related_; }
- virtual void addMember(Node* node) { members_.append(node); }
+ virtual void addMember(Node* node);
const NodeList& members() const { return members_; }
virtual bool hasMembers() const;
virtual bool hasNamespaces() const;
@@ -563,6 +564,7 @@ public:
virtual bool isAbstract() const { return abstract_; }
virtual void setAbstract(bool b) { abstract_ = b; }
virtual bool isInternal() const { return (status() == Internal); }
+ virtual QString qmlFullBaseName() const;
const ImportList& importList() const { return importList_; }
void setImportList(const ImportList& il) { importList_ = il; }
const QString& qmlBaseName() const { return baseName_; }
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 256bc62dd2..58c674de7a 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -886,11 +886,16 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root)
QmlClassNode* qcn = static_cast<QmlClassNode*>(child);
if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) {
QmlClassNode* bqcn = 0;
- const ImportList& imports = qcn->importList();
- for (int i=0; i<imports.size(); ++i) {
- bqcn = findQmlType(imports[i], qcn->qmlBaseName());
- if (bqcn)
- break;
+ if (qcn->qmlBaseName().contains("::")) {
+ bqcn = qmlTypeMap_.value(qcn->qmlBaseName());
+ }
+ else {
+ const ImportList& imports = qcn->importList();
+ for (int i=0; i<imports.size(); ++i) {
+ bqcn = findQmlType(imports[i], qcn->qmlBaseName());
+ if (bqcn)
+ break;
+ }
}
if (bqcn == 0) {
bqcn = findQmlType(QString(), qcn->qmlBaseName());
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 63d8639d0f..466742ee3a 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -193,6 +193,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString qmlModuleName = element.attribute("qml-module-name");
QString qmlModuleVersion = element.attribute("qml-module-version");
qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn);
+ QString qmlFullBaseName = element.attribute("qml-base-type");
+ if (!qmlFullBaseName.isEmpty())
+ qcn->setQmlBaseName(qmlFullBaseName);
if (element.hasAttribute("location"))
name = element.attribute("location", QString());
if (!indexUrl.isEmpty())
@@ -597,6 +600,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
QString nodeName;
QString qmlModuleName;
QString qmlModuleVersion;
+ QString qmlFullBaseName;
switch (node->type()) {
case Node::Namespace:
nodeName = "namespace";
@@ -610,6 +614,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
nodeName = "qmlclass";
qmlModuleName = node->qmlModuleName();
qmlModuleVersion = node->qmlModuleVersion();
+ qmlFullBaseName = node->qmlFullBaseName();
}
else if (node->subType() == Node::QmlBasicType)
nodeName = "qmlbasictype";
@@ -728,6 +733,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!qmlModuleName.isEmpty()) {
writer.writeAttribute("qml-module-name", qmlModuleName);
writer.writeAttribute("qml-module-version", qmlModuleVersion);
+ if (!qmlFullBaseName.isEmpty())
+ writer.writeAttribute("qml-base-type", qmlFullBaseName);
}
QString fullName = node->fullDocumentName();
if (fullName != objName)
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index ec5620c14c..5599d251a1 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1082,6 +1082,8 @@ int QHeaderView::logicalIndex(int visualIndex) const
}
/*!
+ \since 5.0
+
If \a movable is true, the header may be moved by the user; otherwise it
is fixed in place.
@@ -1105,6 +1107,8 @@ void QHeaderView::setSectionsMovable(bool movable)
*/
/*!
+ \since 5.0
+
Returns true if the header can be moved by the user; otherwise returns
false.
@@ -1128,6 +1132,8 @@ bool QHeaderView::sectionsMovable() const
*/
/*!
+ \since 5.0
+
If \a clickable is true, the header will respond to single clicks.
\sa sectionsClickable(), sectionClicked(), sectionPressed(),
@@ -1151,6 +1157,8 @@ void QHeaderView::setSectionsClickable(bool clickable)
*/
/*!
+ \since 5.0
+
Returns true if the header is clickable; otherwise returns false. A
clickable header could be set up to allow the user to change the
representation of the data in the view related to the header.
@@ -1187,6 +1195,8 @@ bool QHeaderView::highlightSections() const
}
/*!
+ \since 5.0
+
Sets the constraints on how the header can be resized to those described
by the given \a mode.
@@ -1205,6 +1215,8 @@ void QHeaderView::setSectionResizeMode(ResizeMode mode)
}
/*!
+ \since 5.0
+
Sets the constraints on how the section specified by \a logicalIndex in
the header can be resized to those described by the given \a mode. The logical
index should exist at the time this function is called.
@@ -1259,6 +1271,8 @@ void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode)
*/
/*!
+ \since 5.0
+
Returns the resize mode that applies to the section specified by the given
\a logicalIndex.
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 84693d02a5..2ffe9c5de5 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -109,7 +109,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setFlags(data.window_flags);
fixPosIncludesFrame();
- win->setGeometry(q->geometry());
+ if (q->testAttribute(Qt::WA_Moved))
+ win->setGeometry(q->geometry());
+ else
+ win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
if (q->testAttribute(Qt::WA_TranslucentBackground)) {
@@ -466,19 +469,6 @@ void QWidget::activateWindow()
wnd->requestActivate();
}
-// Position top level windows at the center, avoid showing
-// Windows at the default 0,0 position excluding the frame.
-static inline QRect positionTopLevelWindow(QRect geometry, const QScreen *screen)
-{
- if (screen && geometry.x() == 0 && geometry.y() == 0) {
- const QRect availableGeometry = screen->availableGeometry();
- if (availableGeometry.width() > geometry.width()
- && availableGeometry.height() > geometry.height())
- geometry.moveCenter(availableGeometry.center());
- }
- return geometry;
-}
-
// move() was invoked with Qt::WA_WState_Created not set (frame geometry
// unknown), that is, crect has a position including the frame.
// If we can determine the frame strut, fix that and clear the flag.
@@ -529,16 +519,16 @@ void QWidgetPrivate::show_sys()
if (q->isWindow())
fixPosIncludesFrame();
QRect geomRect = q->geometry();
- if (q->isWindow()) {
- if (!q->testAttribute(Qt::WA_Moved))
- geomRect = positionTopLevelWindow(geomRect, window->screen());
- } else {
+ if (!q->isWindow()) {
QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint());
geomRect.moveTopLeft(topLeftOfWindow);
}
const QRect windowRect = window->geometry();
if (windowRect != geomRect) {
- window->setGeometry(geomRect);
+ if (q->testAttribute(Qt::WA_Moved))
+ window->setGeometry(geomRect);
+ else
+ window->resize(geomRect.size());
}
if (QBackingStore *store = q->backingStore()) {
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 5d83804d51..ea73ff6296 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5017,6 +5017,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bgColor.blue() < 128;
if (isDarkBg)
[scroller setKnobStyle:NSScrollerKnobStyleLight];
+ else
+ [scroller setKnobStyle:NSScrollerKnobStyleDefault];
[scroller setControlSize:(tdi.kind == kThemeSmallScrollBar ? NSMiniControlSize
: NSRegularControlSize)];
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 48d2027834..a621cab04d 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -520,7 +520,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
case PE_Frame: {
+#ifndef QT_NO_ACCESSIBILITY
if (QStyleHelper::isInstanceOf(option->styleObject, QAccessible::EditableText)) {
+#else
+ if (false) {
+#endif
painter->save();
int stateId = ETS_NORMAL;
if (!(state & State_Enabled))
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index df7b397481..6fa222dd72 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -82,6 +82,12 @@ QT_END_NAMESPACE
# include <qplatformdefs.h>
#endif
+#ifdef Q_OS_QNX
+#ifdef open
+#undef open
+#endif
+#endif
+
#include <stdio.h>
#include <errno.h>
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index c4453fd5f2..f94c8eac4f 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -45,6 +45,7 @@
#include <qstandardpaths.h>
#include <qfileinfo.h>
#include <qsysinfo.h>
+#include <qregexp.h>
#ifdef Q_OS_UNIX
#include <unistd.h>
@@ -72,6 +73,7 @@ private slots:
void testCustomRuntimeDirectory();
void testAllWritableLocations_data();
void testAllWritableLocations();
+ void testCleanPath();
private:
#ifdef Q_XDG_PLATFORM
@@ -430,6 +432,18 @@ void tst_qstandardpaths::testAllWritableLocations()
QCOMPARE(loc.endsWith(QLatin1Char('/')), false);
}
+void tst_qstandardpaths::testCleanPath()
+{
+ const QRegExp filter(QStringLiteral("\\\\"));
+ QVERIFY(filter.isValid());
+ for (int i = 0; i <= QStandardPaths::GenericCacheLocation; ++i) {
+ const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::StandardLocation(i));
+ QVERIFY2(paths.filter(filter).isEmpty(),
+ qPrintable(QString::fromLatin1("Backslash found in %1 %2")
+ .arg(i).arg(paths.join(QLatin1Char(',')))));
+ }
+}
+
QTEST_MAIN(tst_qstandardpaths)
#include "tst_qstandardpaths.moc"
diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
index 5fb8df3f59..085dfd0461 100644
--- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -718,6 +718,8 @@ void tst_QStandardItemModel::checkChildren()
QVERIFY(!model.hasChildren());
QCOMPARE(model.rowCount(), 0);
QCOMPARE(model.columnCount(), 1);
+
+ QVERIFY(!model.index(0,0).sibling(100,100).isValid());
}
void tst_QStandardItemModel::data()
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 6c5c90d737..3bae5d5103 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -78,7 +78,6 @@ private slots:
void shareRegister();
void textureCleanup();
#endif
- void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
void glWidgetWithAlpha();
@@ -98,6 +97,7 @@ private slots:
void destroyFBOAfterContext();
void threadImages();
void nullRectCrash();
+ void graphicsViewClipping();
};
tst_QGL::tst_QGL()
@@ -865,7 +865,11 @@ void tst_QGL::graphicsViewClipping()
scene.setSceneRect(view.viewport()->rect());
- QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ #ifdef Q_OS_MAC
+ // The black rectangle jumps from the center to the upper left for some reason.
+ QTest::qWait(100);
+ #endif
QImage image = viewport->grabFrameBuffer();
QImage expected = image;
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index c1927c9d1f..78fce7661e 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5430,7 +5430,7 @@ void tst_QWidget::setToolTip()
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass));
popup->setWindowTitle(popup->objectName());
- popup->resize(150, 50);
+ popup->setGeometry(50, 50, 150, 50);
QFrame *frame = new QFrame(popup.data());
frame->setGeometry(0, 0, 50, 50);
frame->setFrameStyle(QFrame::Box | QFrame::Plain);
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 210e52f0aa..3fa669c1fb 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3902,6 +3902,11 @@ void tst_QLineEdit::inputMethod()
// removing focus allows input method to commit preedit
testWidget->setText("");
testWidget->activateWindow();
+ // TODO setFocus should not be necessary here, because activateWindow
+ // should focus it, and the window is the QLineEdit. But the test can fail
+ // on Windows if we don't do this. If each test had a unique QLineEdit
+ // instance, maybe such problems would go away.
+ testWidget->setFocus();
QTRY_VERIFY(testWidget->hasFocus());
QTRY_COMPARE(qApp->focusObject(), testWidget);
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 5ad9aa7690..0696aa11d2 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -113,7 +113,9 @@ void tst_QProgressBar::minMaxSameValue()
QProgressBar bar;
bar.setRange(10, 10);
bar.setValue(10);
+ bar.move(300, 300);
bar.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&bar));
}
void tst_QProgressBar::destroyIndeterminate()
@@ -123,7 +125,9 @@ void tst_QProgressBar::destroyIndeterminate()
// it's deleted.
QPointer<QProgressBar> bar = new QProgressBar;
bar->setMaximum(0);
+ bar->move(300, 300);
bar->show();
+ QVERIFY(QTest::qWaitForWindowExposed(bar.data()));
QEventLoop loop;
QTimer::singleShot(500, bar, SLOT(deleteLater()));
@@ -166,8 +170,10 @@ void tst_QProgressBar::format()
ProgressBar bar;
bar.setRange(0, 10);
bar.setValue(1);
+ bar.move(300, 300);
bar.show();
QVERIFY(QTest::qWaitForWindowExposed(&bar));
+ QVERIFY(QTest::qWaitForWindowExposed(&bar));
QTest::qWait(20);
bar.repainted = false;
@@ -202,6 +208,7 @@ void tst_QProgressBar::setValueRepaint()
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
+ pbar.move(300, 300);
pbar.show();
QVERIFY(QTest::qWaitForWindowExposed(&pbar));
@@ -224,7 +231,9 @@ void tst_QProgressBar::setMinMaxRepaint()
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
+ pbar.move(300, 300);
pbar.show();
+ qApp->setActiveWindow(&pbar);
QVERIFY(QTest::qWaitForWindowActive(&pbar));
// No repaint when setting minimum to the current minimum
@@ -319,7 +328,9 @@ void tst_QProgressBar::task245201_testChangeStyleAndDelete()
QStyle *style = QStyleFactory::create(style1_str);
bar->setStyle(style);
+ bar->move(300, 300);
bar->show();
+ QVERIFY(QTest::qWaitForWindowExposed(bar));
QStyle *style2 = QStyleFactory::create(style2_str);
bar->setStyle(style2);
QTest::qWait(10);
diff --git a/tests/manual/transientwindow/main.cpp b/tests/manual/transientwindow/main.cpp
new file mode 100644
index 0000000000..aebb051688
--- /dev/null
+++ b/tests/manual/transientwindow/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/transientwindow/mainwindow.cpp b/tests/manual/transientwindow/mainwindow.cpp
new file mode 100644
index 0000000000..25123c4936
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QDebug>
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent), m_showButton("Toggle visible", this), m_window(0)
+{
+ connect(&m_showButton, SIGNAL(clicked()), this, SLOT(toggleVisible()));
+ setWindowTitle(QString::fromLatin1("Main Window"));
+ m_showButton.setVisible(true);
+ setMinimumSize(300, 200);
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::toggleVisible()
+{
+ if (!m_window) {
+ m_window = new QWindow();
+ m_window->setTransientParent(windowHandle());
+ m_window->setMinimumSize(QSize(200, 100));
+ m_window->setTitle("Transient Window");
+ }
+ m_window->setVisible(!m_window->isVisible());
+}
diff --git a/tests/manual/transientwindow/mainwindow.h b/tests/manual/transientwindow/mainwindow.h
new file mode 100644
index 0000000000..352fc961e1
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QPushButton>
+#include <QWindow>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+public slots:
+ void toggleVisible();
+
+private:
+ QPushButton m_showButton;
+ QWindow* m_window;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/transientwindow/transientwindow.pro b/tests/manual/transientwindow/transientwindow.pro
new file mode 100644
index 0000000000..a07ee09dbc
--- /dev/null
+++ b/tests/manual/transientwindow/transientwindow.pro
@@ -0,0 +1,6 @@
+QT += core gui widgets
+TARGET = transientwindow
+TEMPLATE = app
+SOURCES += main.cpp\
+ mainwindow.cpp
+HEADERS += mainwindow.h
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index af470939e9..5ff4a67315 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -2545,7 +2545,7 @@ void Configure::generateOutputVars()
qtConfig += "build_all";
}
if (dictionary[ "FORCEDEBUGINFO" ] == "yes")
- qtConfig += "force_debug_info";
+ qmakeConfig += "force_debug_info";
qmakeConfig += dictionary[ "BUILD" ];
dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];