diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-27 13:06:38 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-27 13:06:38 +0200 |
commit | 572200989b224ad68e7b8ae4c0aecceb6ca871a2 (patch) | |
tree | 5591e8e6c17df64674aa79227ad6b70374c169ff /src | |
parent | 7ed024226faa9c53c6bad96fb6c9f38a22d25751 (diff) | |
parent | 241eca33ed45f112feed18c6256c31e606f47796 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
configure
mkspecs/features/create_cmake.prf
Change-Id: I94aea83b83833395d5db399209e0e51b92ef23b5
Diffstat (limited to 'src')
50 files changed, 315 insertions, 211 deletions
diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 48fb23ab28..2a6f52b315 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="org.qtproject.example"> <application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> - <activity android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden" > + <activity android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden|navigation" > <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 737c12034b..36a54787b3 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -80,6 +80,8 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) + !!IF contains(QT_CONFIG, reduce_exports) set(QT_VISIBILITY_AVAILABLE \"True\") !!ENDIF diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h index 0fec1e80c7..00c067821e 100644 --- a/src/corelib/codecs/qtextcodec_p.h +++ b/src/corelib/codecs/qtextcodec_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTCODEC -#if defined(Q_OS_MAC) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) +#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) #define QT_LOCALE_IS_UTF8 #endif diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 4084d4f2ad..a0842a946d 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -30,9 +30,12 @@ SOURCES += \ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # configure creates these, not syncqt, so we need to manually inject them -targ_headers.files += \ +qconfig_h_files = \ $$OUT_PWD/global/qconfig.h \ $$QT_BUILD_TREE/include/QtCore/QtConfig +targ_headers.files += $$qconfig_h_files +contains(QMAKE_BUNDLE_DATA, FRAMEWORK_HEADERS): \ + FRAMEWORK_HEADERS.files += $$qconfig_h_files # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index e6da7bb32d..c085dbaa4d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1042,7 +1042,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \enum QSysInfo::MacVersion This enum provides symbolic names for the various versions of the - Macintosh operating system. On Mac, the + OS X operating system. On OS X, the QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run. @@ -1054,8 +1054,9 @@ bool qSharedBuild() Q_DECL_NOTHROW \value MV_10_4 Mac OS X 10.4 (unsupported) \value MV_10_5 Mac OS X 10.5 (unsupported) \value MV_10_6 Mac OS X 10.6 - \value MV_10_7 Mac OS X 10.7 - \value MV_10_8 Mac OS X 10.8 + \value MV_10_7 OS X 10.7 + \value MV_10_8 OS X 10.8 + \value MV_10_9 OS X 10.9 \value MV_Unknown An unknown and currently unsupported platform \value MV_CHEETAH Apple codename for MV_10_0 @@ -1067,6 +1068,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \value MV_SNOWLEOPARD Apple codename for MV_10_6 \value MV_LION Apple codename for MV_10_7 \value MV_MOUNTAINLION Apple codename for MV_10_8 + \value MV_MAVERICKS Apple codename for MV_10_9 \sa WinVersion */ @@ -1694,7 +1696,7 @@ Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { QSysInfo::MacVersion QSysInfo::macVersion() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX SInt32 gestalt_version; if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2); diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 85ff89ebdd..a37fc15b61 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -917,21 +917,19 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const QString &message) { #if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) - wchar_t contextFileL[256]; - // we probably should let the compiler do this for us, by - // declaring QMessageLogContext::file to be const wchar_t * in - // the first place, but the #ifdefery above is very complex - // and we wouldn't be able to change it later on... - convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, context.file); + wchar_t contextFileL[256]; + // we probably should let the compiler do this for us, by declaring QMessageLogContext::file to + // be const wchar_t * in the first place, but the #ifdefery above is very complex and we + // wouldn't be able to change it later on... + convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, + context.file); // get the current report mode int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); _CrtSetReportMode(_CRT_ERROR, reportMode); - int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, - context.line, _CRT_WIDE(QT_VERSION_STR), - reinterpret_cast<const wchar_t *> ( - message.utf16())); - if (ret == 0 && reportMode & _CRTDBG_MODE_WNDW) + int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, context.line, _CRT_WIDE(QT_VERSION_STR), + reinterpret_cast<const wchar_t *>(message.utf16())); + if ((ret == 0) && (reportMode & _CRTDBG_MODE_WNDW)) return; // ignore else if (ret == 1) _CrtDbgBreak(); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 74949b86f0..25c47d5d34 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -980,6 +980,8 @@ public: Key_TouchpadOn = 0x01000111, Key_TouchpadOff = 0x01000112, + Key_MicMute = 0x01000113, + Key_MediaLast = 0x0100ffff, // Keypad navigation keys diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9eb0c6b8f2..f9248eb68d 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1621,6 +1621,7 @@ \value Key_TouchpadToggle \value Key_TouchpadOn \value Key_TouchpadOff + \value Key_MicMute \value Key_MediaLast \value Key_unknown diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 58939cc013..a6accdfebc 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -132,6 +132,7 @@ public: MV_10_6 = 0x0008, MV_10_7 = 0x0009, MV_10_8 = 0x000A, + MV_10_9 = 0x000B, /* codenames */ MV_CHEETAH = MV_10_0, @@ -142,7 +143,8 @@ public: MV_LEOPARD = MV_10_5, MV_SNOWLEOPARD = MV_10_6, MV_LION = MV_10_7, - MV_MOUNTAINLION = MV_10_8 + MV_MOUNTAINLION = MV_10_8, + MV_MAVERICKS = MV_10_9 }; static const MacVersion MacintoshVersion; static MacVersion macVersion(); diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 690442d066..cb55fa808b 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -207,12 +207,18 @@ # if !defined(__MAC_10_8) # define __MAC_10_8 1080 # endif +# if !defined(__MAC_10_9) +# define __MAC_10_9 1090 +# endif # if !defined(MAC_OS_X_VERSION_10_7) # define MAC_OS_X_VERSION_10_7 1070 # endif # if !defined(MAC_OS_X_VERSION_10_8) # define MAC_OS_X_VERSION_10_8 1080 # endif +# if !defined(MAC_OS_X_VERSION_10_9) +# define MAC_OS_X_VERSION_10_9 1090 +# endif # # if !defined(__IPHONE_4_3) # define __IPHONE_4_3 40300 @@ -229,9 +235,12 @@ # if !defined(__IPHONE_6_1) # define __IPHONE_6_1 60100 # endif +# if !defined(__IPHONE_7_0) +# define __IPHONE_7_0 70000 +# endif # # if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_8) -# warning "This version of Mac OS X is unsupported" +# warning "This version of OS X is unsupported" # endif #endif diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index b18e32b29a..a7517b4c7f 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -510,11 +510,12 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea } if (slash) { const QByteArray chunk = QFile::encodeName(dirName.left(slash)); - QT_STATBUF st; - if (QT_STAT(chunk.constData(), &st) != -1) { - if ((st.st_mode & S_IFMT) != S_IFDIR) - return false; - } else if (QT_MKDIR(chunk.constData(), 0777) != 0) { + if (QT_MKDIR(chunk.constData(), 0777) != 0) { + if (errno == EEXIST) { + QT_STATBUF st; + if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR) + continue; + } return false; } } diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index bee7689535..2c9ed9da3d 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1034,6 +1034,10 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea } if (oldslash != -1) oldslash = dirName.indexOf(QDir::separator(), oldslash); + } else if (dirName.size() > 2 + && dirName.at(1) == QLatin1Char(':')) { + // Don't try to call mkdir with just a drive letter + oldslash = 2; } for (int slash=0; slash != -1; oldslash = slash) { slash = dirName.indexOf(QDir::separator(), oldslash+1); @@ -1044,14 +1048,13 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea } if (slash) { QString chunk = dirName.left(slash); - bool existed = false; - if (!isDirPath(chunk, &existed)) { - if (!existed) { - if (!mkDir(chunk)) - return false; - } else { - return false; + if (!mkDir(chunk)) { + if (GetLastError() == ERROR_ALREADY_EXISTS) { + bool existed = false; + if (isDirPath(chunk, &existed) && existed) + continue; } + return false; } } } diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index ad6be762c0..fa911fb967 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -65,7 +65,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #include <CoreServices/CoreServices.h> #endif diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 61c9b40e83..c617325e9e 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -72,7 +72,6 @@ public: QByteArray iid; QList<QLibraryPrivate*> libraryList; QMap<QString,QLibraryPrivate*> keyMap; - QStringList keyList; QString suffix; Qt::CaseSensitivity cs; QStringList loadedPaths; @@ -176,10 +175,8 @@ void QFactoryLoader::update() metaDataOk = true; QJsonArray k = object.value(QLatin1String("Keys")).toArray(); - for (int i = 0; i < k.size(); ++i) { - QString s = k.at(i).toString(); - keys += s; - } + for (int i = 0; i < k.size(); ++i) + keys += d->cs ? k.at(i).toString() : k.at(i).toString().toLower(); } if (qt_debug_component()) qDebug() << "Got keys from plugin meta data" << keys; @@ -190,15 +187,13 @@ void QFactoryLoader::update() continue; } - d->libraryList += library; + int keyUsageCount = 0; for (int k = 0; k < keys.count(); ++k) { // first come first serve, unless the first // library was built with a future Qt version, // whereas the new one has a Qt version that fits // better - QString key = keys.at(k); - if (!d->cs) - key = key.toLower(); + const QString &key = keys.at(k); QLibraryPrivate *previous = d->keyMap.value(key); int prev_qt_version = 0; if (previous) { @@ -207,9 +202,13 @@ void QFactoryLoader::update() int qt_version = (int)library->metaData.value(QLatin1String("version")).toDouble(); if (!previous || (prev_qt_version > QT_VERSION && qt_version <= QT_VERSION)) { d->keyMap[key] = library; - d->keyList += keys.at(k); + ++keyUsageCount; } } + if (keyUsageCount || keys.isEmpty()) + d->libraryList += library; + else + library->release(); } } #else diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index be9b946990..6a91193785 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -83,9 +83,9 @@ # define old_qDebug qDebug # undef qDebug # endif -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX # include <CoreServices/CoreServices.h> -#endif //Q_OS_IOS +#endif // Q_OS_MACX # ifdef old_qDebug # undef qDebug diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index 83e77280d5..6ad1d679e1 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -16,11 +16,12 @@ set(Qt5Gui_OPENGL_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS}) macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATION IMPLIB_LOCATION) set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\") +!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) + set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\") !!ELSE - set(imported_location \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\") + set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\") !!ENDIF + !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") !!ELSE diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 77c9978a9e..89664447c4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -94,9 +94,12 @@ #include <QtGui/QClipboard> #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#endif +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# include <QtCore/qt_windows.h> +# include <QtCore/QLibraryInfo> +#endif // Q_OS_WIN && !Q_OS_WINCE QT_BEGIN_NAMESPACE @@ -789,6 +792,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( keys.join(QStringLiteral(", "))); fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + // Windows: Display message box unless it is a console application + // or debug build showing an assert box. + if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) + MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); +#endif // Q_OS_WIN && !Q_OS_WINCE qFatal("%s", qPrintable(fatalMessage)); return; } diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 3a3e24b80b..00d5b81413 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -752,7 +752,8 @@ static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVaria static QNetworkRequest::KnownHeaders parseHeaderName(const QByteArray &headerName) { - // headerName is not empty here + if (headerName.isEmpty()) + return QNetworkRequest::KnownHeaders(-1); switch (tolower(headerName.at(0))) { case 'c': diff --git a/src/openglextensions/qopenglextensions.cpp b/src/openglextensions/qopenglextensions.cpp index 2119a86ccf..58bd31a339 100644 --- a/src/openglextensions/qopenglextensions.cpp +++ b/src/openglextensions/qopenglextensions.cpp @@ -5,35 +5,34 @@ ** ** This file is part of the QtGui module 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. ** -** 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. ** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** diff --git a/src/openglextensions/qopenglextensions.h b/src/openglextensions/qopenglextensions.h index 7d6c21e4e5..78bbf4b0cb 100644 --- a/src/openglextensions/qopenglextensions.h +++ b/src/openglextensions/qopenglextensions.h @@ -5,35 +5,34 @@ ** ** This file is part of the QtGui module 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. ** -** 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. ** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index fbd836f763..1e15a9e62c 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -41,7 +41,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #import <Cocoa/Cocoa.h> #import <IOKit/graphics/IOGraphicsLib.h> #endif @@ -107,7 +107,7 @@ static NSInteger languageMapSort(id obj1, id obj2, void *context) QCoreTextFontDatabase::QCoreTextFontDatabase() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QSettings appleSettings(QLatin1String("apple.com")); QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); if (appleValue.isValid()) @@ -408,7 +408,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo static bool didPopulateStyleFallbacks = false; if (!didPopulateStyleFallbacks) { -#if !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) // Ensure we have the psNameToFamily mapping set up const_cast<QCoreTextFontDatabase*>(this)->populateFontDatabase(); @@ -457,7 +457,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo return fallbackLists[styleLookupKey.arg(styleHint)]; } -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 5b9b8e2329..8536ad9123 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -55,7 +55,7 @@ public: QFontEngine *fontEngine(const QFontDef &fontDef, QChar::Script script, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); #endif void releaseHandle(void *handle); diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 59dc03666b..cbb3092b1d 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -430,8 +430,9 @@ QAccessible::State QAccessibleMdiSubWindow::state() const state.focused = true; if (!mdiSubWindow()->isVisible()) state.invisible = true; - if (!mdiSubWindow()->parentWidget()->contentsRect().contains(mdiSubWindow()->geometry())) - state.offscreen = true; + if (const QWidget *parent = mdiSubWindow()->parentWidget()) + if (!parent->contentsRect().contains(mdiSubWindow()->geometry())) + state.offscreen = true; if (!mdiSubWindow()->isEnabled()) state.disabled = true; return state; diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp index 29ccfe0125..75cb617ca8 100644 --- a/src/plugins/platforms/android/src/androidjniinput.cpp +++ b/src/plugins/platforms/android/src/androidjniinput.cpp @@ -333,7 +333,7 @@ namespace QtAndroidInput return Qt::Key_BracketLeft; case 0x0000005a: // KEYCODE_MEDIA_FAST_FORWARD - return Qt::Key_Forward; + return Qt::Key_AudioForward; case 0x00000057: return Qt::Key_MediaNext; @@ -344,7 +344,7 @@ namespace QtAndroidInput case 0x00000058: return Qt::Key_MediaPrevious; - case 0x00000059: + case 0x00000059: // KEYCODE_MEDIA_REWIND return Qt::Key_AudioRewind; case 0x00000056: @@ -356,8 +356,8 @@ namespace QtAndroidInput case 0x00000045: return Qt::Key_Minus; - case 0x0000005b: - return Qt::Key_VolumeMute; + case 0x0000005b: // KEYCODE_MUTE + return Qt::Key_MicMute; case 0x0000004e: return Qt::Key_NumLock; @@ -405,6 +405,9 @@ namespace QtAndroidInput case 0x00000019: return Qt::Key_VolumeDown; + case 0x000000a4: // KEYCODE_VOLUME_MUTE + return Qt::Key_VolumeMute; + case 0x00000018: return Qt::Key_VolumeUp; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h index 3f0367d36a..86bb5323a7 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h @@ -46,11 +46,11 @@ #include <QtGui> #include <qpa/qplatformaccessibility.h> -class QCococaAccessibility : public QPlatformAccessibility +class QCocoaAccessibility : public QPlatformAccessibility { public: - QCococaAccessibility(); - ~QCococaAccessibility(); + QCocoaAccessibility(); + ~QCocoaAccessibility(); void notifyAccessibilityUpdate(QAccessibleEvent *event); void setRootObject(QObject *o); void initialize(); @@ -79,6 +79,7 @@ namespace QCocoaAccessible { NSString *macRole(QAccessibleInterface *interface); bool shouldBeIgnored(QAccessibleInterface *interface); +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface); NSString *getTranslatedAction(const QString &qtAction); NSMutableArray *createTranslatedActionsList(const QStringList &qtActions); QString translateAction(NSString *nsAction); diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 9c38a874e5..5649f3ad73 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -44,17 +44,17 @@ #include <QtGui/private/qaccessible2_p.h> #include <private/qcore_mac_p.h> -QCococaAccessibility::QCococaAccessibility() +QCocoaAccessibility::QCocoaAccessibility() { } -QCococaAccessibility::~QCococaAccessibility() +QCocoaAccessibility::~QCocoaAccessibility() { } -void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) +void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { QObject *object = event->object(); if (!object) @@ -78,17 +78,17 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -void QCococaAccessibility::setRootObject(QObject *o) +void QCocoaAccessibility::setRootObject(QObject *o) { Q_UNUSED(o) } -void QCococaAccessibility::initialize() +void QCocoaAccessibility::initialize() { } -void QCococaAccessibility::cleanup() +void QCocoaAccessibility::cleanup() { } @@ -223,6 +223,26 @@ bool shouldBeIgnored(QAccessibleInterface *interface) return false; } +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface) +{ + int numKids = interface->childCount(); + // qDebug() << "Children for: " << axid << iface << " are: " << numKids; + + NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; + for (int i = 0; i < numKids; ++i) { + QAccessibleInterface *child = interface->child(i); + Q_ASSERT(child); + if (child->state().invalid || child->state().invisible) + continue; + + QAccessible::Id childId = QAccessible::uniqueId(child); + //qDebug() << " kid: " << childId << child; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:parentObject]; + [kids addObject: element]; + [element release]; + } + return NSAccessibilityUnignoredChildren(kids); +} /* Translates a predefined QAccessibleActionInterface action to a Mac action constant. Returns 0 if the Qt Action has no mac equivalent. Ownership of the NSString is diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 55a23fda76..7eae22f720 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -137,22 +137,7 @@ } else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) { return NSAccessibilityRoleDescription(role, nil); } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { - - int numKids = iface->childCount(); - // qDebug() << "Children for: " << axid << iface << " are: " << numKids; - - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = iface->child(i); - Q_ASSERT(child); - QAccessible::Id childId = QAccessible::uniqueId(child); - //qDebug() << " kid: " << childId << child; - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:self]; - [kids addObject: element]; - [element release]; - } - return NSAccessibilityUnignoredChildren(kids); - + return QCocoaAccessible::unignoredChildren(self, iface); } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute]; diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 4002d61318..75a33cbda3 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -100,6 +100,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mDialogIsExecuting = false; mResultSet = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) + [mColorPanel setRestorable:NO]; +#endif + if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) { mStolenContentView = 0; mOkButton = 0; @@ -276,6 +281,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); - (void)showModelessPanel { mDialogIsExecuting = false; + mResultSet = false; [mColorPanel makeKeyAndOrderFront:mColorPanel]; } @@ -369,10 +375,8 @@ void QCocoaColorDialogHelper::exec() bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowModality, QWindow *parent) { - if (windowModality == Qt::WindowModal) { - // Cocoa's shared color panel cannot be shown as a sheet - return false; - } + if (windowModality == Qt::WindowModal) + windowModality = Qt::ApplicationModal; return showCocoaColorPanel(windowModality, parent); } @@ -435,9 +439,9 @@ bool QCocoaColorDialogHelper::showCocoaColorPanel(Qt::WindowModality windowModal createNSColorPanelDelegate(); QNSColorPanelDelegate *delegate = static_cast<QNSColorPanelDelegate *>(mDelegate); [delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; - if (windowModality == Qt::NonModal) + if (windowModality != Qt::WindowModal) [delegate showModelessPanel]; - // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel() + // no need to show a Qt::WindowModal dialog here, because it's necessary to call exec() in that case return true; } diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 987520f307..6d1882f622 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -219,7 +219,7 @@ QCocoaIntegration::QCocoaIntegration() , mEventDispatcher(new QCocoaEventDispatcher()) , mInputContext(new QCocoaInputContext) #ifndef QT_NO_ACCESSIBILITY - , mAccessibility(new QCococaAccessibility) + , mAccessibility(new QCocoaAccessibility) #endif , mCocoaClipboard(new QCocoaClipboard) , mCocoaDrag(new QCocoaDrag) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 9c2a301bba..cc72f050d2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -238,6 +238,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) setGeometry(tlw->geometry()); recreateWindow(parent()); tlw->setGeometry(geometry()); + if (tlw->isTopLevel()) + setWindowIcon(tlw->icon()); m_inConstructor = false; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1df88e2f4c..70b08c7feb 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1288,7 +1288,7 @@ static QTouchDevice *touchDevice = 0; NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, - NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, + NSRTFDPboardType, NSHTMLPboardType, NSURLPboardType, NSPDFPboardType, NSVCardPboardType, NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 331a66417d..86e5066fbb 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -74,21 +74,7 @@ } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { if (!m_window->accessibleRoot()) return [super accessibilityAttributeValue:attribute]; - - // Create QCocoaAccessibleElements for each child if the - // root accessible interface. - int numKids = m_window->accessibleRoot()->childCount(); - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = m_window->accessibleRoot()->child(i); - Q_ASSERT(child); - QAccessible::Id childAxid = QAccessible::uniqueId(child); - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childAxid parent:self]; - [kids addObject: element]; - [element release]; - } - - return NSAccessibilityUnignoredChildren(kids); + return QCocoaAccessible::unignoredChildren(self, m_window->accessibleRoot()); } else { return [super accessibilityAttributeValue:attribute]; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index f7ccb00233..12dd00f104 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1720,7 +1720,9 @@ int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM { switch (uMsg) { case BFFM_INITIALIZED: { - const QString initialFile = m_data.selectedFile(); + if (!m_title.isEmpty()) + SetWindowText(hwnd, (wchar_t *)m_title.utf16()); + const QString initialFile = QDir::toNativeSeparators(m_data.directory()); if (!initialFile.isEmpty()) SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initialFile.utf16())); } @@ -1743,8 +1745,7 @@ QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner) initPath[0] = 0; bi.hwndOwner = owner; bi.pidlRoot = NULL; - //### This does not seem to be respected? - the dialog always displays "Browse for folder" - bi.lpszTitle = (wchar_t*)m_title.utf16(); + bi.lpszTitle = 0; bi.pszDisplayName = initPath; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; bi.lpfn = xpFileDialogGetExistingDirCallbackProc; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9d817c2043..08ff7123eb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -837,6 +837,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (aWindow->isTopLevel()) + setWindowIcon(aWindow->icon()); clearFlag(WithinCreate); } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index f7c473de88..6e5a9ccbb4 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -248,6 +248,7 @@ #define XF86XK_TouchpadToggle 0x1008FFA9 #define XF86XK_TouchpadOn 0x1008FFB0 #define XF86XK_TouchpadOff 0x1008FFB1 +#define XF86XK_AudioMicMute 0x1008FFB2 // end of XF86keysyms.h @@ -543,6 +544,7 @@ static const unsigned int KeyTbl[] = { XF86XK_TouchpadToggle, Qt::Key_TouchpadToggle, XF86XK_TouchpadOn, Qt::Key_TouchpadOn, XF86XK_TouchpadOff, Qt::Key_TouchpadOff, + XF86XK_AudioMicMute, Qt::Key_MicMute, XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 6: remap properly XF86XK_Launch1, Qt::Key_Launch3, XF86XK_Launch2, Qt::Key_Launch4, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6291396e6e..b9a2b0d37b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -458,6 +458,8 @@ void QXcbWindow::create() const qreal opacity = qt_window_private(window())->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (window()->isTopLevel()) + setWindowIcon(window()->icon()); } QXcbWindow::~QXcbWindow() @@ -1367,10 +1369,10 @@ void QXcbWindow::requestActivateWindow() event.data.data32[4] = 0; Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); - } else { - Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, connection()->time())); } + Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, connection()->time())); + connection()->sync(); } diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index a05099fa08..6fa901fc45 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -104,11 +104,6 @@ QT_BEGIN_NAMESPACE QPageSetupDialogPrivate::QPageSetupDialogPrivate(QPrinter *prntr) : printer(0), ownsPrinter(false) { setPrinter(prntr); - init(); -} - -void QPageSetupDialogPrivate::init() -{ } void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter) diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h index eb672cc752..ba2f0da06a 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_p.h @@ -73,7 +73,6 @@ class QPageSetupDialogPrivate : public QDialogPrivate public: QPageSetupDialogPrivate(QPrinter *printer); - virtual void init(); void setPrinter(QPrinter *newPrinter); QPrinter *printer; diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 1e0251c6d2..1add522cb8 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -574,14 +574,18 @@ void QPageSetupWidget::setRightMargin(double newValue) QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(printer)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } QPageSetupDialog::QPageSetupDialog(QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } int QPageSetupDialog::exec() diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 4e8103906e..8afc1c749a 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -4140,11 +4140,12 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) if (match) { tags += manifestMetaContent[idx].tags; foreach (const QString &attr, manifestMetaContent[idx].attributes) { - QStringList attrList = attr.split(QLatin1Char(':'), QString::SkipEmptyParts); + QLatin1Char div(':'); + QStringList attrList = attr.split(div); if (attrList.count() == 1) attrList.append(QStringLiteral("true")); - if (attrList.count() == 2) - writer.writeAttribute(attrList[0], attrList[1]); + QString attrName = attrList.takeFirst(); + writer.writeAttribute(attrName, attrList.join(div)); } } } diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index e2f5950e4b..bf1af239df 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1893,6 +1893,8 @@ void QColorDialog::setOptions(ColorDialogOptions options) d->options->setOptions(QColorDialogOptions::ColorDialogOptions(int(options))); d->buttons->setVisible(!(options & NoButtons)); d->showAlpha(options & ShowAlphaChannel); + if (options & DontUseNativeDialog) + d->nativeDialogInUse = false; } QColorDialog::ColorDialogOptions QColorDialog::options() const @@ -1911,8 +1913,8 @@ QColorDialog::ColorDialogOptions QColorDialog::options() const \value ShowAlphaChannel Allow the user to select the alpha component of a color. \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".) - \value DontUseNativeDialog Use Qt's standard color dialog on the Mac instead of Apple's - native color panel. + \value DontUseNativeDialog Use Qt's standard color dialog instead of the operating system + native color dialog. \sa options, setOption(), testOption(), windowModality() */ diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 4ec828ac83..995d279e13 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1392,7 +1392,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) #if !defined(QT_NO_TEXTEDIT) if (e == QKeySequence::Copy) { - if (d->detailsText->isVisible() && d->detailsText->copy()) { + if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) { e->setAccepted(true); return; } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3fabeb1445..adccee9426 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2842,6 +2842,37 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; } + switch (e->type()) { + case QEvent::KeyPress: + { + bool isWidget = receiver->isWidgetType(); + bool isWindow = receiver->isWindowType(); + bool isGraphicsWidget = false; +#ifndef QT_NO_GRAPHICSVIEW + isGraphicsWidget = !isWidget && !isWindow && qobject_cast<QGraphicsWidget *>(receiver); +#endif + if (!isWidget && !isGraphicsWidget && !isWindow) { + return d->notify_helper(receiver, e); + } + + QKeyEvent* key = static_cast<QKeyEvent*>(e); +#ifndef QT_NO_SHORTCUT + // Try looking for a Shortcut before sending key events + if (qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, key)) + return true; +#endif + qt_in_tab_key_event = (key->key() == Qt::Key_Backtab + || key->key() == Qt::Key_Tab + || key->key() == Qt::Key_Left + || key->key() == Qt::Key_Up + || key->key() == Qt::Key_Right + || key->key() == Qt::Key_Down); + + } + default: + break; + } + bool res = false; if (!receiver->isWidgetType()) { res = d->notify_helper(receiver, e); @@ -2855,25 +2886,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) #ifndef QT_NO_GRAPHICSVIEW isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver); #endif - if (!isWidget && !isGraphicsWidget) { - res = d->notify_helper(receiver, e); - break; - } - QKeyEvent* key = static_cast<QKeyEvent*>(e); - if (key->type()==QEvent::KeyPress) { -#ifndef QT_NO_SHORTCUT - // Try looking for a Shortcut before sending key events - if ((res = qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, key))) - return res; -#endif - qt_in_tab_key_event = (key->key() == Qt::Key_Backtab - || key->key() == Qt::Key_Tab - || key->key() == Qt::Key_Left - || key->key() == Qt::Key_Up - || key->key() == Qt::Key_Right - || key->key() == Qt::Key_Down); - } bool def = key->isAccepted(); QPointer<QObject> pr = receiver; while (receiver) { diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index c5cdce3d60..471b054a99 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -51,6 +51,7 @@ #include <private/qapplication_p.h> #include <private/qshortcutmap_p.h> #include <private/qaction_p.h> +#include <private/qwidgetwindow_qpa_p.h> QT_BEGIN_NAMESPACE @@ -86,6 +87,20 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) if (QApplication::activePopupWidget()) active_window = QApplication::activePopupWidget(); + if (!active_window) { + QWindow *qwindow = QGuiApplication::focusWindow(); + if (qwindow && qwindow->isActive()) { + while (qwindow) { + QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(qwindow); + if (widgetWindow) { + active_window = widgetWindow->widget(); + break; + } + qwindow = qwindow->parent(); + } + } + } + if (!active_window) return false; @@ -106,6 +121,18 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) w = s->parentWidget(); } + if (!w) { + QWindow *qwindow = qobject_cast<QWindow *>(object); + while (qwindow) { + QWidgetWindow *widget_window = qobject_cast<QWidgetWindow *>(qwindow); + if (widget_window) { + w = widget_window->widget(); + break; + } + qwindow = qwindow->parent(); + } + } + if (!w) return false; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 3eb949f814..a0c723fa0d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -104,6 +104,8 @@ #include "qtabwidget.h" // Needed in inTabWidget() #endif // QT_KEYPAD_NAVIGATION +#include "qwindowcontainer_p.h" + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG @@ -1549,10 +1551,11 @@ void QWidgetPrivate::createTLExtra() x->inTopLevelResize = false; x->inRepaint = false; x->embedded = 0; + x->window = 0; + x->screenIndex = 0; #ifdef Q_WS_MAC x->wasMaximized = false; #endif // Q_WS_MAC - createTLSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "tlextra" << ++count; @@ -6252,6 +6255,17 @@ bool QWidget::isActiveWindow() const } } + // Check for an active window container + if (QWindow *ww = QGuiApplication::focusWindow()) { + while (ww) { + QWidgetWindow *qww = qobject_cast<QWidgetWindow *>(ww); + QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0; + if (qwc && qwc->topLevelWidget() == tlw) + return true; + ww = ww->parent(); + } + } + // Check if platform adaptation thinks the window is active. This is necessary for // example in case of ActiveQt servers that are embedded into another application. // Those are separate processes that are not part of the parent application Qt window/widget @@ -10112,6 +10126,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; } case Qt::WA_NativeWindow: { d->createTLExtra(); + if (on) + d->createTLSysExtra(); #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); if (on && !internalWinId() && hasFocus() diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3b6c9ca448..dafe7dc42a 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -890,9 +890,7 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { Q_Q(QWidget); - extra->topextra->screenIndex = 0; - extra->topextra->window = 0; - if (q->testAttribute(Qt::WA_NativeWindow) || q->isWindow()) { + if (!extra->topextra->window && (q->testAttribute(Qt::WA_NativeWindow) || q->isWindow())) { extra->topextra->window = new QWidgetWindow(q); if (extra->minw || extra->minh) extra->topextra->window->setMinimumSize(QSize(extra->minw, extra->minh)); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index c19b617091..18dd3156c6 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -446,7 +446,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) if (!widget) widget = m_widget; - if (event->type() == QEvent::MouseButtonPress && !qt_button_down) + if (event->type() == QEvent::MouseButtonPress) qt_button_down = widget; QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(), diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index f8905b1b1a..dad4e57d13 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1630,6 +1630,19 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti } } +void QMacStylePrivate::setAutoDefaultButton(QObject *button) const +{ + if (autoDefaultButton != button) { + if (QStyleAnimation *anim = animation(autoDefaultButton)) { + anim->updateTarget(); + stopAnimation(autoDefaultButton); + } + autoDefaultButton = button; + } + if (autoDefaultButton && !animation(autoDefaultButton)) + startAnimation(new QStyleAnimation(autoDefaultButton)); +} + QMacStylePrivate::QMacStylePrivate() : mouseDown(false) { @@ -3497,15 +3510,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // takes precedence over a normal default button if (btn->features & QStyleOptionButton::AutoDefaultButton && opt->state & State_Active && opt->state & State_HasFocus) { - d->autoDefaultButton = opt->styleObject; - if (!d->animation(opt->styleObject)) - d->startAnimation(new QStyleAnimation(opt->styleObject)); + d->setAutoDefaultButton(opt->styleObject); } else if (d->autoDefaultButton == opt->styleObject) { - if (QStyleAnimation *animation = d->animation(opt->styleObject)) { - animation->updateTarget(); - d->stopAnimation(opt->styleObject); - } - d->autoDefaultButton = 0; + d->setAutoDefaultButton(0); } if (!d->autoDefaultButton) { diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index bf42087fcb..efeaa66e39 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -194,6 +194,8 @@ public: HIThemeButtonDrawInfo *bdi) const; QPixmap generateBackgroundPattern() const; + void setAutoDefaultButton(QObject *button) const; + public: mutable QPointer<QObject> pressedButton; mutable QPointer<QObject> defaultButton; diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index ae931deb16..7cd7172ef5 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -873,7 +873,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) QPoint pos = event->globalPos() - state->pressPos; q->move(pos); - if (!state->ctrlDrag) + if (state && !state->ctrlDrag) mwlayout->hover(state->widgetItem, event->globalPos()); ret = true; |