Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	src/gui/kernel/qplatformtheme.h
	tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
	tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp

Change-Id: Iecd3343d6a050b8764f78d809c4a1532aeba69e5
This commit is contained in:
Frederik Gladhorn 2013-12-16 16:59:33 +01:00
commit 3f3be55835
102 changed files with 1007 additions and 333 deletions

5
.gitignore vendored
View File

@ -63,7 +63,7 @@ Makefile*
*.gcov *.gcov
*.gcda *.gcda
*.gcno *.gcno
bin/Qt*.dll bin/*.dll
bin/assistant* bin/assistant*
bin/designer* bin/designer*
bin/dumpcpp* bin/dumpcpp*
@ -112,6 +112,7 @@ mkspecs/default
mkspecs/default-host mkspecs/default-host
mkspecs/qconfig.pri mkspecs/qconfig.pri
mkspecs/qdevice.pri mkspecs/qdevice.pri
mkspecs/qfeatures.pri
moc_*.cpp moc_*.cpp
qmake/qmake.exe qmake/qmake.exe
qmake/Makefile.bak qmake/Makefile.bak
@ -119,6 +120,7 @@ qmake/qmake_pch.pch
src/corelib/global/qconfig.cpp src/corelib/global/qconfig.cpp
src/corelib/global/qconfig.h src/corelib/global/qconfig.h
src/corelib/global/qconfig.h.qmake src/corelib/global/qconfig.h.qmake
src/corelib/global/qfeatures.h
src/platformsupport/*_interface.* src/platformsupport/*_interface.*
src/platformsupport/*_adaptor.* src/platformsupport/*_adaptor.*
ui_*.h ui_*.h
@ -183,6 +185,7 @@ src/3rdparty/webkit/includes2.txt
# generated files in configure.exe bootstrapping # generated files in configure.exe bootstrapping
tools/configure/configure.intermediate.manifest tools/configure/configure.intermediate.manifest
tools/configure/configure_pch.pch tools/configure/configure_pch.pch
/configure.exe
# Symlinks generated by configure # Symlinks generated by configure
tools/qvfb/qvfbhdr.h tools/qvfb/qvfbhdr.h

View File

@ -44,7 +44,6 @@
int main(int, char **) int main(int, char **)
{ {
//We require glxfbconfig, ie. glx 1.3
GLXFBConfig config; GLXFBConfig config;
config = 0; config = 0;

View File

@ -1,4 +1,4 @@
SOURCES = glx.cpp SOURCES = glxfbconfig.cpp
CONFIG += x11 CONFIG += x11
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL INCLUDEPATH += $$QMAKE_INCDIR_OPENGL

98
configure vendored
View File

@ -611,8 +611,6 @@ CFG_OPENVG_LC_INCLUDES=no
CFG_OPENVG_SHIVA=auto CFG_OPENVG_SHIVA=auto
CFG_OPENVG_ON_OPENGL=auto CFG_OPENVG_ON_OPENGL=auto
CFG_EGL=auto CFG_EGL=auto
CFG_GLX=auto
CFG_SSE=auto
CFG_FONTCONFIG=auto CFG_FONTCONFIG=auto
CFG_FREETYPE=auto CFG_FREETYPE=auto
CFG_HARFBUZZ=no CFG_HARFBUZZ=no
@ -1159,13 +1157,6 @@ while [ "$#" -gt 0 ]; do
libexecdir) libexecdir)
QT_INSTALL_LIBEXECS="$VAL" QT_INSTALL_LIBEXECS="$VAL"
;; ;;
sse)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_SSE="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
opengl) opengl)
if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] || if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
[ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
@ -1483,13 +1474,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes UNKNOWN_OPT=yes
fi fi
;; ;;
glx)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_GLX="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
pch) pch)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_PRECOMPILE="$VAL" CFG_PRECOMPILE="$VAL"
@ -4243,6 +4227,9 @@ if [ "${CFG_SSE2}" = "auto" ]; then
fi fi
# detect sse3 support # detect sse3 support
if [ "${CFG_SSE2}" = "no" ]; then
CFG_SSE3=no
fi
if [ "${CFG_SSE3}" = "auto" ]; then if [ "${CFG_SSE3}" = "auto" ]; then
if compileTest common/sse3 "sse3"; then if compileTest common/sse3 "sse3"; then
CFG_SSE3=yes CFG_SSE3=yes
@ -4252,6 +4239,9 @@ if [ "${CFG_SSE3}" = "auto" ]; then
fi fi
# detect ssse3 support # detect ssse3 support
if [ "${CFG_SSE3}" = "no" ]; then
CFG_SSSE3=no
fi
if [ "${CFG_SSSE3}" = "auto" ]; then if [ "${CFG_SSSE3}" = "auto" ]; then
if compileTest common/ssse3 "ssse3"; then if compileTest common/ssse3 "ssse3"; then
CFG_SSSE3=yes CFG_SSSE3=yes
@ -4261,6 +4251,9 @@ if [ "${CFG_SSSE3}" = "auto" ]; then
fi fi
# detect sse4.1 support # detect sse4.1 support
if [ "${CFG_SSSE3}" = "no" ]; then
CFG_SSE4_1=no
fi
if [ "${CFG_SSE4_1}" = "auto" ]; then if [ "${CFG_SSE4_1}" = "auto" ]; then
if compileTest common/sse4_1 "sse4_1"; then if compileTest common/sse4_1 "sse4_1"; then
CFG_SSE4_1=yes CFG_SSE4_1=yes
@ -4270,6 +4263,9 @@ if [ "${CFG_SSE4_1}" = "auto" ]; then
fi fi
# detect sse4.2 support # detect sse4.2 support
if [ "${CFG_SSE4_1}" = "no" ]; then
CFG_SSE4_2=no
fi
if [ "${CFG_SSE4_2}" = "auto" ]; then if [ "${CFG_SSE4_2}" = "auto" ]; then
if compileTest common/sse4_2 "sse4_2"; then if compileTest common/sse4_2 "sse4_2"; then
CFG_SSE4_2=yes CFG_SSE4_2=yes
@ -4279,6 +4275,9 @@ if [ "${CFG_SSE4_2}" = "auto" ]; then
fi fi
# detect avx support # detect avx support
if [ "${CFG_SSE4_2}" = "no" ]; then
CFG_AVX=no
fi
if [ "${CFG_AVX}" = "auto" ]; then if [ "${CFG_AVX}" = "auto" ]; then
if compileTest common/avx "avx"; then if compileTest common/avx "avx"; then
case "$XQMAKESPEC" in case "$XQMAKESPEC" in
@ -4929,6 +4928,19 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then
fi fi
CFG_OPENGL=no CFG_OPENGL=no
fi fi
case "$PLATFORM" in
hpux*)
# HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
if [ "$CFG_OPENGL" = "desktop" ]; then
compileTest x11/glxfbconfig "OpenGL"
if [ $? != "0" ]; then
QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
fi
fi
;;
*)
;;
esac
elif [ "$CFG_OPENGL" = "es2" ]; then elif [ "$CFG_OPENGL" = "es2" ]; then
#OpenGL ES 2.x #OpenGL ES 2.x
compileTest unix/opengles2 "OpenGL ES 2.x" compileTest unix/opengles2 "OpenGL ES 2.x"
@ -4949,6 +4961,17 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then
echo " ${XQMAKESPEC}." echo " ${XQMAKESPEC}."
exit 1 exit 1
fi fi
case "$PLATFORM" in
hpux*)
# HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
compileTest x11/glxfbconfig "OpenGL"
if [ $? != "0" ]; then
QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
fi
;;
*)
;;
esac
fi fi
fi # X11/MINGW OpenGL fi # X11/MINGW OpenGL
@ -5086,6 +5109,11 @@ if [ "$CFG_TSLIB" != "no" ]; then
fi fi
fi fi
# Check we actually have X11 :-)
if compileTest x11/xlib "XLib"; then
QT_CONFIG="$QT_CONFIG xlib"
fi
if [ "$CFG_XCB" != "no" ]; then if [ "$CFG_XCB" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`" QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
@ -5131,17 +5159,6 @@ if [ "$CFG_XCB" != "no" ]; then
fi fi
fi fi
# Check for X11. Eventually we should port everything to XCB,
# but for now the port is incomplete and Xlib is a requirement.
if compileTest x11/xlib "XLib"; then
QT_CONFIG="$QT_CONFIG xlib"
else
echo "The test for linking against Xlib failed!"
echo " You might need to install dependency packages."
echo " See src/plugins/platforms/xcb/README."
exit 1
fi
if [ "$CFG_XCB_XLIB" != "no" ]; then if [ "$CFG_XCB_XLIB" != "no" ]; then
if compileTest qpa/xcb-xlib "xcb-xlib" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then if compileTest qpa/xcb-xlib "xcb-xlib" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
QT_CONFIG="$QT_CONFIG xcb-xlib" QT_CONFIG="$QT_CONFIG xcb-xlib"
@ -5313,24 +5330,6 @@ if [ "$CFG_EGL" != "no" ]; then
fi fi
fi fi
# GLX Support
if [ "$CFG_GLX" != "no" ]; then
if [ "$CFG_GLX" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
echo "GLX support was requested but OpenGL support is disabled."
echo "Either disable GLX support or enable OpenGL support."
exit 101
fi
if compileTest qpa/glx "GLX"; then
CFG_GLX=yes
elif [ "$CFG_GLX" = "yes" ]; then
echo " The GLX functionality test failed; GLX is required by the xcb plugin to manage contexts & surfaces."
exit 1
else
CFG_GLX=no
fi
fi
if [ "$CFG_EGLFS" != "no" ]; then if [ "$CFG_EGLFS" != "no" ]; then
if [ "$XPLATFORM_QNX" = "no" ]; then if [ "$XPLATFORM_QNX" = "no" ]; then
CFG_EGLFS="$CFG_EGL" CFG_EGLFS="$CFG_EGL"
@ -5701,13 +5700,6 @@ else
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL" QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
fi fi
# enable glx
if [ "$CFG_GLX" = "yes" ]; then
QT_CONFIG="$QT_CONFIG glx"
else
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLX"
fi
# enable eglfs # enable eglfs
if [ "$CFG_EGLFS" = "yes" ]; then if [ "$CFG_EGLFS" = "yes" ]; then
QT_CONFIG="$QT_CONFIG eglfs" QT_CONFIG="$QT_CONFIG eglfs"
@ -6743,8 +6735,6 @@ else
report_support " pkg-config ............. no" report_support " pkg-config ............. no"
fi fi
report_support " PulseAudio ............." "$CFG_PULSEAUDIO" report_support " PulseAudio ............." "$CFG_PULSEAUDIO"
report_support " EGL ...................." "$CFG_EGL"
report_support " GLX ...................." "$CFG_GLX"
report_support " QPA backends:" report_support " QPA backends:"
report_support " DirectFB ............." "$CFG_DIRECTFB" report_support " DirectFB ............." "$CFG_DIRECTFB"
report_support " EGLFS ................" "$CFG_EGLFS" report_support " EGLFS ................" "$CFG_EGLFS"

64
dist/changes-5.2.0 vendored
View File

@ -52,6 +52,29 @@ information about a particular change.
zero delta() in order to indicate beginning and end of transient zero delta() in order to indicate beginning and end of transient
scrolling. scrolling.
- Mac OS X framework builds of Qt no longer contain a Unix-like include/
directory; all headers are located in the frameworks. This may affect
3rd party build systems not based on qmake or cmake.
****************************************************************************
* Platform deprecation notice *
****************************************************************************
- The support for the old implementation of QAtomicInt and
QAtomicPointer is deprecated in Qt 5.2 and will be removed in Qt
5.3. Building with the following compilers or environments will not
be possible in Qt 5.3 or the build will suffer greatly in
performance, unless support is revived by writing new atomics code.
* Green Hills compiler for INTEGRITY
* Sun Studio compiler suite for Solaris
* IBM Visual Age compiler suite for AIX
* Kernel-mode VxWorks
Developers interested in picking up support should contact the
development mailing list at development@qt-project.org for more
information. Note that those platforms are currently not tested. Most
likely, they have further problems than just the atomics code.
**************************************************************************** ****************************************************************************
* Library * * Library *
**************************************************************************** ****************************************************************************
@ -700,3 +723,44 @@ X11
- [QTBUG-31762] Fix position of system tray icon (except Unity) - [QTBUG-31762] Fix position of system tray icon (except Unity)
- [QTBUG-27349] Reintroduced command line argument for positioning - [QTBUG-27349] Reintroduced command line argument for positioning
windows (-geometry) windows (-geometry)
****************************************************************************
* Tools *
****************************************************************************
- configure
* Added option to disable the QtMultimedia WMF backend
* [Unix] Added option to build with gcov support
* Added -extprefix option to support Qt installing into a different
location than the on-device -prefix within the -sysroot.
* [QTBUG-33584][Unix] Fixed parsing of -device-option with equal signs.
- cmake config files
* [QTBUG-33145] Fixed usage of non-QtBase modules with Qt compiled from
source tarballs.
* [QTBUG-33223] Fixed header file location on multi-arch systems.
* Added support for automatic packaging of Qt plugins with cpack.
- qmake
* [QTBUG-491] Added saner approach to debug/release path rewriting.
* Added the parseJson() function.
* Added "osx" scope as an alias for "macx". Note that matching on the
makespec is generally deprecated - use "linux", "gcc", etc.
* Added support for .qmake.stash files which are really *just* caches.
* [Xcode] Added support for QMAKE_PRE_LINK and QMAKE_POST_LINK.
* [QTBUG-31129] Added installation of PDB files for dlltarget.
* [QTBUG-28102] Added support for querying disabled Qt features.
* Removed macx-clang-libc++* makespecs. libc++ is now handled automatically.
* [QTBUG-32912][MSVS] Fixed moc not being run in case of DBUS_ADAPTORS or
DBUS_INTERFACES being present.
* [QTBUG-30644] Fixed unsatisfied requires() breaking recursive targets.
* [QTBUG-31204] Fixed extra compilers not finding their inputs.
* [QTBUG-32885][MSVS] Made it possible to disable debug information.
* [QTBUG-33446][MSVS] Fixed generation of VS2010+ solution files.
* [QTBUG-32375][MSVS] Fixed output directory of nested projects.
* [QTBUG-34392][MSVS] Fixed /SAFESEH:NO with VS2010+.
* [QTBUG-34357][MSVS] Fixed breakage with multiple VS versions in PATH.
* [MSVS] Fixed sub-project dependency generation.

View File

@ -131,30 +131,33 @@ android: CONFIG += qt_android_deps
#install directives #install directives
load(qt_installs) load(qt_installs)
!isEmpty(_QMAKE_SUPER_CACHE_): \
rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
else: \
rplbase = $$MODULE_BASE_OUTDIR
include_replace.match = $$rplbase/include
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
include_replace.CONFIG = path
lib_replace.match = $$rplbase/lib
host_build: \
lib_replace.replace = $$[QT_HOST_LIBS]
else: \
lib_replace.replace = $$[QT_INSTALL_LIBS/raw]
lib_replace.CONFIG = path
QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
unix|win32-g++* { unix|win32-g++* {
CONFIG += create_pc CONFIG += create_pc
host_build: \ QMAKE_PKGCONFIG_LIBDIR = $$lib_replace.replace
QMAKE_PKGCONFIG_LIBDIR = $$[QT_HOST_LIBS] QMAKE_PKGCONFIG_INCDIR = $$include_replace.replace
else: \
QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw]
QMAKE_PKGCONFIG_CFLAGS = -I${includedir}/$$MODULE_INCNAME QMAKE_PKGCONFIG_CFLAGS = -I${includedir}/$$MODULE_INCNAME
QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_DESTDIR = pkgconfig
!isEmpty(_QMAKE_SUPER_CACHE_): \
rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
else: \
rplbase = $$MODULE_BASE_OUTDIR
include_replace.match = $$rplbase/include
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
lib_replace.match = $$rplbase/lib
lib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace
QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
} }
unix { unix {
CONFIG += create_libtool explicitlib CONFIG += create_libtool explicitlib
QMAKE_LIBTOOL_LIBDIR = $$QMAKE_PKGCONFIG_LIBDIR QMAKE_LIBTOOL_LIBDIR = $$lib_replace.replace
QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
} }

View File

@ -0,0 +1,10 @@
#
# qmake configuration for linux-clang and libc++
#
include(../linux-clang/qmake.conf)
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_LFLAGS += -stdlib=libc++
load(qt_config)

View File

@ -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-clang/qplatformdefs.h"

View File

@ -192,6 +192,22 @@ macx-xcode {
QMAKE_CXXFLAGS += -stdlib=libstdc++ QMAKE_CXXFLAGS += -stdlib=libstdc++
QMAKE_LFLAGS += -stdlib=libstdc++ QMAKE_LFLAGS += -stdlib=libstdc++
} }
# Make the default debug information format for debug builds
# DWARF instead of DWARF with dSYM. This cuts down build times
# for application debug builds significantly, as Xcode doesn't
# have to pull out all the DWARF info from our static libraries
# and put it into a dSYM file. We don't need that dSYM file in
# the first place, since the information is available in the
# object files inside the archives (static libraries). The only
# unfortunate side effect of this is that the user won't be
# able to break on specific lines of main(). This is due to
# using ld to rename the main-function, and will go away once
# we implement a separate tool to do the symbol renaming.
debug_information_format.name = DEBUG_INFORMATION_FORMAT
debug_information_format.value = dwarf
debug_information_format.build = debug
QMAKE_MAC_XCODE_SETTINGS += debug_information_format
} }
macx-xcode { macx-xcode {

View File

@ -1140,7 +1140,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//### //###
} }
project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
t << "\t\t" << phase_key << " = {\n" t << "\t\t" << phase_key << " = {\n"
<< "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n" << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n"
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"

View File

@ -3334,6 +3334,13 @@ MakefileGenerator::writePkgConfigFile()
t << endl; t << endl;
} }
static QString windowsifyPath(const QString &str)
{
// The paths are escaped in prl files, so every slash needs to turn into two backslashes.
// Then each backslash needs to be escaped for sed. And another level for C quoting here.
return QString(str).replace('/', "\\\\\\\\");
}
QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst) QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst)
{ {
QString ret; QString ret;
@ -3346,8 +3353,12 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
for (int r = 0; r < replace_rules.size(); ++r) { for (int r = 0; r < replace_rules.size(); ++r) {
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")), const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
replace = project->first(ProKey(replace_rules.at(r) + ".replace")); replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
if (!match.isEmpty() /*&& match != replace*/) if (!match.isEmpty() /*&& match != replace*/) {
ret += " -e " + shellQuote("s," + match + "," + replace + ",g"); ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path"))
ret += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ "," + windowsifyPath(replace.toQString()) + ",gi");
}
} }
ret += " \"" + src + "\" >\"" + dst + "\""; ret += " \"" + src + "\" >\"" + dst + "\"";
} }

View File

@ -85,6 +85,7 @@ static int doSed(int argc, char **argv)
return 3; return 3;
} }
QChar sep = ++j < cmd.length() ? cmd.at(j) : QChar(); QChar sep = ++j < cmd.length() ? cmd.at(j) : QChar();
Qt::CaseSensitivity matchcase = Qt::CaseSensitive;
bool escaped = false; bool escaped = false;
int phase = 1; int phase = 1;
QStringList phases; QStringList phases;
@ -126,12 +127,16 @@ static int doSed(int argc, char **argv)
fprintf(stderr, "Error: sed s command requires three arguments (%d, %c, %s)\n", phase, sep.toLatin1(), qPrintable(curr)); fprintf(stderr, "Error: sed s command requires three arguments (%d, %c, %s)\n", phase, sep.toLatin1(), qPrintable(curr));
return 3; return 3;
} }
if (curr.contains(QLatin1Char('i'))) {
curr.remove(QLatin1Char('i'));
matchcase = Qt::CaseInsensitive;
}
if (curr != QLatin1String("g")) { if (curr != QLatin1String("g")) {
fprintf(stderr, "Error: sed s command must be used with the g option (only)\n"); fprintf(stderr, "Error: sed s command supports only g & i options; g is required\n");
return 3; return 3;
} }
SedSubst subst; SedSubst subst;
subst.from = QRegExp(phases.at(0)); subst.from = QRegExp(phases.at(0), matchcase);
subst.to = phases.at(1); subst.to = phases.at(1);
subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\. subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\.
substs << subst; substs << subst;

View File

@ -181,7 +181,7 @@ mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \ mkspecs.files = \
$$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qfeatures.pri \ $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qfeatures.pri \
$$files($$PWD/mkspecs/*) $$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules mkspecs.files -= $$PWD/mkspecs/modules $$PWD/mkspecs/modules-inst
INSTALLS += mkspecs INSTALLS += mkspecs
global_docs.files = $$PWD/doc/global global_docs.files = $$PWD/doc/global

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<resources> <resources>
<array name="qt_sources"> <array name="qt_sources">
<item>https://download.qt-project.org/ministro/android/qt5/latest</item> <item>https://download.qt-project.org/ministro/android/qt5/qt-5.2</item>
</array> </array>
<!-- The following is handled automatically by the deployment tool. It should <!-- The following is handled automatically by the deployment tool. It should

View File

@ -150,7 +150,7 @@ public class QtActivity extends Activity
private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings
private DexClassLoader m_classLoader = null; // loader object private DexClassLoader m_classLoader = null; // loader object
private String[] m_sources = {"https://download.qt-project.org/ministro/android/qt5/latest"}; // Make sure you are using ONLY secure locations private String[] m_sources = {"https://download.qt-project.org/ministro/android/qt5/qt-5.2"}; // Make sure you are using ONLY secure locations
private String m_repository = "default"; // Overwrites the default Ministro repository private String m_repository = "default"; // Overwrites the default Ministro repository
// Possible values: // Possible values:
// * default - Ministro default repository set with "Ministro configuration tool". // * default - Ministro default repository set with "Ministro configuration tool".

6
src/angle/src/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/libGLESv2/renderer/
/compiler/glslang_lex.cpp
/compiler/glslang_tab.cpp
/compiler/glslang_tab.h
/compiler/preprocessor/ExpressionParser.cpp
/compiler/preprocessor/Tokenizer.cpp

View File

@ -102,10 +102,19 @@ public:
{ {
if (dirty) { if (dirty) {
dirty = false; dirty = false;
// This is a workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800
// Avoid using std::nth_element for stdlibc++ <= 4.7.3 || (>= 4.8.0 && <= 4.8.2)
#if defined(__GLIBCXX__) && (__GLIBCXX__ <= 20130411 || (__GLIBCXX__ >= 20130322 && __GLIBCXX__ <= 20131016))
QVector<T> sorted = values;
std::sort(sorted.begin(), sorted.end());
currentMedian = sorted.at(bufferSize / 2);
#else
QVector<T> copy = values; QVector<T> copy = values;
typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end(); typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end();
std::nth_element(begin, mid, end); std::nth_element(begin, mid, end);
currentMedian = *mid; currentMedian = *mid;
#endif
} }
return currentMedian; return currentMedian;
} }

View File

@ -556,10 +556,8 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
\typedef qreal \typedef qreal
\relates <QtGlobal> \relates <QtGlobal>
Typedef for \c double on all platforms except for those using CPUs with Typedef for \c double unless Qt is configured with the
ARM architectures. \c{-qreal float} option.
On ARM-based platforms, \c qreal is a typedef for \c float for performance
reasons.
*/ */
/*! \typedef uchar /*! \typedef uchar

View File

@ -73,10 +73,11 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
// Anomymous pipes do not support asynchronous I/O. Thus we // Anomymous pipes do not support asynchronous I/O. Thus we
// create named pipes for redirecting stdout, stderr and stdin. // create named pipes for redirecting stdout, stderr and stdin.
// The write handle must be non-inheritable for input pipes.
// The read handle must be non-inheritable for output pipes.
SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), 0, false }; SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), 0, false };
secAtt.bInheritHandle = isInputPipe; // The read handle must be non-inheritable for output pipes.
HANDLE hRead; HANDLE hServer;
wchar_t pipeName[256]; wchar_t pipeName[256];
unsigned int attempts = 1000; unsigned int attempts = 1000;
forever { forever {
@ -85,19 +86,29 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
_snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]), _snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
L"\\\\.\\pipe\\qt-%X", qrand()); L"\\\\.\\pipe\\qt-%X", qrand());
DWORD dwOpenMode = FILE_FLAG_OVERLAPPED;
DWORD dwOutputBufferSize = 0;
DWORD dwInputBufferSize = 0;
const DWORD dwPipeBufferSize = 1024 * 1024;
if (isInputPipe) {
dwOpenMode |= PIPE_ACCESS_OUTBOUND;
dwOutputBufferSize = dwPipeBufferSize;
} else {
dwOpenMode |= PIPE_ACCESS_INBOUND;
dwInputBufferSize = dwPipeBufferSize;
}
DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT; DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT;
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS; dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS;
const DWORD dwPipeBufferSize = 1024 * 1024; hServer = CreateNamedPipe(pipeName,
hRead = CreateNamedPipe(pipeName, dwOpenMode,
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
dwPipeFlags, dwPipeFlags,
1, // only one pipe instance 1, // only one pipe instance
0, // output buffer size dwOutputBufferSize,
dwPipeBufferSize, // input buffer size dwInputBufferSize,
0, 0,
&secAtt); &secAtt);
if (hRead != INVALID_HANDLE_VALUE) if (hServer != INVALID_HANDLE_VALUE)
break; break;
DWORD dwError = GetLastError(); DWORD dwError = GetLastError();
if (dwError != ERROR_PIPE_BUSY || !--attempts) { if (dwError != ERROR_PIPE_BUSY || !--attempts) {
@ -106,28 +117,31 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
} }
} }
// The write handle must be non-inheritable for input pipes. secAtt.bInheritHandle = TRUE;
secAtt.bInheritHandle = !isInputPipe; const HANDLE hClient = CreateFile(pipeName,
(isInputPipe ? (GENERIC_READ | FILE_WRITE_ATTRIBUTES)
HANDLE hWrite = INVALID_HANDLE_VALUE; : GENERIC_WRITE),
hWrite = CreateFile(pipeName,
GENERIC_WRITE,
0, 0,
&secAtt, &secAtt,
OPEN_EXISTING, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, FILE_FLAG_OVERLAPPED,
NULL); NULL);
if (hWrite == INVALID_HANDLE_VALUE) { if (hClient == INVALID_HANDLE_VALUE) {
qErrnoWarning("QProcess: CreateFile failed."); qErrnoWarning("QProcess: CreateFile failed.");
CloseHandle(hRead); CloseHandle(hServer);
return; return;
} }
// Wait until connection is in place. // Wait until connection is in place.
ConnectNamedPipe(hRead, NULL); ConnectNamedPipe(hServer, NULL);
pipe[0] = hRead; if (isInputPipe) {
pipe[1] = hWrite; pipe[0] = hClient;
pipe[1] = hServer;
} else {
pipe[0] = hServer;
pipe[1] = hClient;
}
} }
static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle) static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle)

View File

@ -94,9 +94,19 @@ static QString defaultTemplateName()
return QDir::tempPath() + QLatin1Char('/') + baseName + QLatin1String("-XXXXXX"); return QDir::tempPath() + QLatin1Char('/') + baseName + QLatin1String("-XXXXXX");
} }
#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
static int nextRand(int &v)
{
int r = v % 62;
v /= 62;
if (v < 62)
v = qrand();
return r;
}
static char *q_mkdtemp(char *templateName) static char *q_mkdtemp(char *templateName)
{ {
#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const size_t length = strlen(templateName); const size_t length = strlen(templateName);
@ -110,16 +120,11 @@ static char *q_mkdtemp(char *templateName)
int v = qrand(); int v = qrand();
/* Fill in the random bits. */ /* Fill in the random bits. */
XXXXXX[0] = letters[v % 62]; XXXXXX[0] = letters[nextRand(v)];
v /= 62; XXXXXX[1] = letters[nextRand(v)];
XXXXXX[1] = letters[v % 62]; XXXXXX[2] = letters[nextRand(v)];
v /= 62; XXXXXX[3] = letters[nextRand(v)];
XXXXXX[2] = letters[v % 62]; XXXXXX[4] = letters[nextRand(v)];
v /= 62;
XXXXXX[3] = letters[v % 62];
v /= 62;
XXXXXX[4] = letters[v % 62];
v /= 62;
XXXXXX[5] = letters[v % 62]; XXXXXX[5] = letters[v % 62];
QString templateNameStr = QFile::decodeName(templateName); QString templateNameStr = QFile::decodeName(templateName);
@ -137,11 +142,17 @@ static char *q_mkdtemp(char *templateName)
} }
} }
return 0; return 0;
#else
return mkdtemp(templateName);
#endif
} }
#else // defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
static char *q_mkdtemp(char *templateName)
{
return mkdtemp(templateName);
}
#endif
void QTemporaryDirPrivate::create(const QString &templateName) void QTemporaryDirPrivate::create(const QString &templateName)
{ {
QByteArray buffer = QFile::encodeName(templateName); QByteArray buffer = QFile::encodeName(templateName);

View File

@ -74,7 +74,8 @@ static jclass getCachedClass(JNIEnv *env, const char *className)
if (!classLoader.isValid()) if (!classLoader.isValid())
return 0; return 0;
QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QLatin1String(className)); QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QString::fromLatin1(className).replace(QLatin1Char('/'),
QLatin1Char('.')));
QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass", QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;", "(Ljava/lang/String;)Ljava/lang/Class;",
stringName.object()); stringName.object());

View File

@ -1075,8 +1075,14 @@ int QMetaObjectBuilder::indexOfClassInfo(const QByteArray& name)
\brief The QMetaStringTable class can generate a meta-object string table at runtime. \brief The QMetaStringTable class can generate a meta-object string table at runtime.
*/ */
QMetaStringTable::QMetaStringTable() QMetaStringTable::QMetaStringTable(const QByteArray &className)
: m_index(0) {} : m_index(0)
, m_className(className)
{
const int index = enter(m_className);
Q_ASSERT(index == 0);
Q_UNUSED(index);
}
// Enters the given value into the string table (if it hasn't already been // Enters the given value into the string table (if it hasn't already been
// entered). Returns the index of the string. // entered). Returns the index of the string.
@ -1106,18 +1112,9 @@ int QMetaStringTable::blobSize() const
return size; return size;
} }
// Writes strings to string data struct. static void writeString(char *out, int i, const QByteArray &str,
// The struct consists of an array of QByteArrayData, followed by a char array const int offsetOfStringdataMember, int &stringdataOffset)
// containing the actual strings. This format must match the one produced by
// moc (see generator.cpp).
void QMetaStringTable::writeBlob(char *out)
{ {
Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment()-1)));
int offsetOfStringdataMember = m_entries.size() * sizeof(QByteArrayData);
int stringdataOffset = 0;
for (int i = 0; i < m_entries.size(); ++i) {
const QByteArray &str = m_entries.key(i);
int size = str.size(); int size = str.size();
qptrdiff offset = offsetOfStringdataMember + stringdataOffset qptrdiff offset = offsetOfStringdataMember + stringdataOffset
- i * sizeof(QByteArrayData); - i * sizeof(QByteArrayData);
@ -1130,6 +1127,30 @@ void QMetaStringTable::writeBlob(char *out)
out[offsetOfStringdataMember + stringdataOffset + size] = '\0'; out[offsetOfStringdataMember + stringdataOffset + size] = '\0';
stringdataOffset += size + 1; stringdataOffset += size + 1;
}
// Writes strings to string data struct.
// The struct consists of an array of QByteArrayData, followed by a char array
// containing the actual strings. This format must match the one produced by
// moc (see generator.cpp).
void QMetaStringTable::writeBlob(char *out) const
{
Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment()-1)));
int offsetOfStringdataMember = m_entries.size() * sizeof(QByteArrayData);
int stringdataOffset = 0;
// qt_metacast expects the first string in the string table to be the class name.
writeString(out, /*index*/0, m_className, offsetOfStringdataMember, stringdataOffset);
for (Entries::ConstIterator it = m_entries.constBegin(), end = m_entries.constEnd();
it != end; ++it) {
const int i = it.value();
if (i == 0)
continue;
const QByteArray &str = it.key();
writeString(out, i, str, offsetOfStringdataMember, stringdataOffset);
} }
} }
@ -1270,8 +1291,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
// Reset the current data position to just past the QMetaObjectPrivate. // Reset the current data position to just past the QMetaObjectPrivate.
dataIndex = MetaObjectPrivateFieldCount; dataIndex = MetaObjectPrivateFieldCount;
QMetaStringTable strings; QMetaStringTable strings(d->className);
strings.enter(d->className);
// Output the class infos, // Output the class infos,
Q_ASSERT(!buf || dataIndex == pmeta->classInfoData); Q_ASSERT(!buf || dataIndex == pmeta->classInfoData);

View File

@ -323,18 +323,19 @@ private:
class Q_CORE_EXPORT QMetaStringTable class Q_CORE_EXPORT QMetaStringTable
{ {
public: public:
QMetaStringTable(); explicit QMetaStringTable(const QByteArray &className);
int enter(const QByteArray &value); int enter(const QByteArray &value);
static int preferredAlignment(); static int preferredAlignment();
int blobSize() const; int blobSize() const;
void writeBlob(char *out); void writeBlob(char *out) const;
private: private:
typedef QHash<QByteArray, int> Entries; // string --> index mapping typedef QHash<QByteArray, int> Entries; // string --> index mapping
Entries m_entries; Entries m_entries;
int m_index; int m_index;
QByteArray m_className;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaObjectBuilder::AddMembers) Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaObjectBuilder::AddMembers)

View File

@ -783,6 +783,10 @@ struct IteratorOwner
{ {
*ptr = new const_iterator(iterator); *ptr = new const_iterator(iterator);
} }
static void assign(void **ptr, void * const * src)
{
*ptr = new const_iterator(*static_cast<const_iterator*>(*src));
}
static void advance(void **iterator, int step) static void advance(void **iterator, int step)
{ {
@ -804,18 +808,27 @@ struct IteratorOwner
{ {
return &*it; return &*it;
} }
};
template<typename const_iterator> static bool equal(void * const *it, void * const *other)
struct IteratorOwner<const const_iterator*>
{
static void assign(void **ptr, const const_iterator *iterator )
{ {
*ptr = const_cast<const_iterator*>(iterator); return *static_cast<const_iterator*>(*it) == *static_cast<const_iterator*>(*other);
}
};
template<typename value_type>
struct IteratorOwner<const value_type*>
{
static void assign(void **ptr, const value_type *iterator )
{
*ptr = const_cast<value_type*>(iterator);
}
static void assign(void **ptr, void * const * src)
{
*ptr = static_cast<value_type*>(*src);
} }
static void advance(void **iterator, int step) static void advance(void **iterator, int step)
{ {
const_iterator *it = static_cast<const_iterator*>(*iterator); value_type *it = static_cast<value_type*>(*iterator);
std::advance(it, step); std::advance(it, step);
*iterator = it; *iterator = it;
} }
@ -829,10 +842,15 @@ struct IteratorOwner<const const_iterator*>
return *iterator; return *iterator;
} }
static const void *getData(const const_iterator *it) static const void *getData(const value_type *it)
{ {
return it; return it;
} }
static bool equal(void * const *it, void * const *other)
{
return static_cast<value_type*>(*it) == static_cast<value_type*>(*other);
}
}; };
enum IteratorCapability enum IteratorCapability
@ -934,7 +952,7 @@ public:
template<class T> template<class T>
static bool equalIterImpl(void * const *iterator, void * const *other) static bool equalIterImpl(void * const *iterator, void * const *other)
{ return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); } { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
template<class T> template<class T>
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags) static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
@ -942,7 +960,7 @@ public:
template<class T> template<class T>
static void copyIterImpl(void **dest, void * const * src) static void copyIterImpl(void **dest, void * const * src)
{ IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); } { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
public: public:
template<class T> QSequentialIterableImpl(const T*p) template<class T> QSequentialIterableImpl(const T*p)
@ -1118,11 +1136,11 @@ public:
template<class T> template<class T>
static bool equalIterImpl(void * const *iterator, void * const *other) static bool equalIterImpl(void * const *iterator, void * const *other)
{ return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); } { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
template<class T> template<class T>
static void copyIterImpl(void **dest, void * const * src) static void copyIterImpl(void **dest, void * const * src)
{ IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); } { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
public: public:
template<class T> QAssociativeIterableImpl(const T*p) template<class T> QAssociativeIterableImpl(const T*p)
@ -1741,7 +1759,7 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
return id; \ return id; \
const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \ const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \
Q_ASSERT(tName); \ Q_ASSERT(tName); \
const int tNameLen = qstrlen(tName); \ const int tNameLen = int(qstrlen(tName)); \
QByteArray typeName; \ QByteArray typeName; \
typeName.reserve(int(sizeof(#SINGLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + 1); \ typeName.reserve(int(sizeof(#SINGLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + 1); \
typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \ typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \
@ -1782,8 +1800,8 @@ struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \
const char *uName = QMetaType::typeName(qMetaTypeId<U>()); \ const char *uName = QMetaType::typeName(qMetaTypeId<U>()); \
Q_ASSERT(tName); \ Q_ASSERT(tName); \
Q_ASSERT(uName); \ Q_ASSERT(uName); \
const int tNameLen = qstrlen(tName); \ const int tNameLen = int(qstrlen(tName)); \
const int uNameLen = qstrlen(uName); \ const int uNameLen = int(qstrlen(uName)); \
QByteArray typeName; \ QByteArray typeName; \
typeName.reserve(int(sizeof(#DOUBLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \ typeName.reserve(int(sizeof(#DOUBLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \
typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \ typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \

View File

@ -194,9 +194,15 @@ QMetaObject *QObjectData::dynamicMetaObject() const
QObjectPrivate::QObjectPrivate(int version) QObjectPrivate::QObjectPrivate(int version)
: threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0) : threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0)
{ {
#ifdef QT_BUILD_INTERNAL
// Don't check the version parameter in internal builds.
// This allows incompatible versions to be loaded, possibly for testing.
Q_UNUSED(version);
#else
if (version != QObjectPrivateVersion) if (version != QObjectPrivateVersion)
qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)", qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)",
version, QObjectPrivateVersion); version, QObjectPrivateVersion);
#endif
// QObjectData initialization // QObjectData initialization
q_ptr = 0; q_ptr = 0;
@ -3090,6 +3096,10 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
expensive initialization only if something is connected to a expensive initialization only if something is connected to a
signal. signal.
\warning This function is called from the thread which performs the
connection, which may be a different thread from the thread in
which this object lives.
\sa connect(), disconnectNotify() \sa connect(), disconnectNotify()
*/ */
@ -3116,6 +3126,15 @@ void QObject::connectNotify(const QMetaMethod &signal)
modularity. However, it might be useful for optimizing access to modularity. However, it might be useful for optimizing access to
expensive resources. expensive resources.
\warning This function is called from the thread which performs the
disconnection, which may be a different thread from the thread in
which this object lives. This function may also be called with a QObject
internal mutex locked. It is therefore not allowed to re-enter any
of any QObject functions from your reimplementation and if you lock
a mutex in your reimplementation, make sure that you don't call QObject
functions with that mutex held in other places or it will result in
a deadlock.
\sa disconnect(), connectNotify() \sa disconnect(), connectNotify()
*/ */

View File

@ -199,7 +199,8 @@ QStringList QCommandLineOption::names() const
void QCommandLineOptionPrivate::setNames(const QStringList &nameList) void QCommandLineOptionPrivate::setNames(const QStringList &nameList)
{ {
names.clear(); QStringList newNames;
newNames.reserve(nameList.size());
if (nameList.isEmpty()) if (nameList.isEmpty())
qWarning("QCommandLineOption: Options must have at least one name"); qWarning("QCommandLineOption: Options must have at least one name");
foreach (const QString &name, nameList) { foreach (const QString &name, nameList) {
@ -214,9 +215,11 @@ void QCommandLineOptionPrivate::setNames(const QStringList &nameList)
else if (name.contains(QLatin1Char('='))) else if (name.contains(QLatin1Char('=')))
qWarning("QCommandLineOption: Option names cannot contain a '='"); qWarning("QCommandLineOption: Option names cannot contain a '='");
else else
names.append(name); newNames.append(name);
} }
} }
// commit
names.swap(newNames);
} }
/*! /*!
@ -288,9 +291,13 @@ QString QCommandLineOption::description() const
*/ */
void QCommandLineOption::setDefaultValue(const QString &defaultValue) void QCommandLineOption::setDefaultValue(const QString &defaultValue)
{ {
d->defaultValues.clear(); QStringList newDefaultValues;
if (!defaultValue.isEmpty()) if (!defaultValue.isEmpty()) {
d->defaultValues << defaultValue; newDefaultValues.reserve(1);
newDefaultValues << defaultValue;
}
// commit:
d->defaultValues.swap(newDefaultValues);
} }
/*! /*!

View File

@ -280,9 +280,9 @@ bool QCommandLineParser::addOption(const QCommandLineOption &option)
*/ */
QCommandLineOption QCommandLineParser::addVersionOption() QCommandLineOption QCommandLineParser::addVersionOption()
{ {
d->builtinVersionOption = true;
QCommandLineOption opt(QStringList() << QStringLiteral("v") << QStringLiteral("version"), tr("Displays version information.")); QCommandLineOption opt(QStringList() << QStringLiteral("v") << QStringLiteral("version"), tr("Displays version information."));
addOption(opt); addOption(opt);
d->builtinVersionOption = true;
return opt; return opt;
} }
@ -300,7 +300,6 @@ QCommandLineOption QCommandLineParser::addVersionOption()
*/ */
QCommandLineOption QCommandLineParser::addHelpOption() QCommandLineOption QCommandLineParser::addHelpOption()
{ {
d->builtinHelpOption = true;
QCommandLineOption opt(QStringList() QCommandLineOption opt(QStringList()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
<< QStringLiteral("?") << QStringLiteral("?")
@ -308,6 +307,7 @@ QCommandLineOption QCommandLineParser::addHelpOption()
<< QStringLiteral("h") << QStringLiteral("h")
<< QStringLiteral("help"), tr("Displays this help.")); << QStringLiteral("help"), tr("Displays this help."));
addOption(opt); addOption(opt);
d->builtinHelpOption = true;
return opt; return opt;
} }

View File

@ -239,11 +239,7 @@ static inline uint qCpuFeatures()
return uint(features); return uint(features);
} }
static inline uint qCpuHasFeature(CPUFeatures feature) #define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (feature)) || (qCpuFeatures() & (feature)))
{
return qCompilerCpuFeatures & feature || qCpuFeatures() & feature;
}
#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i)

View File

@ -453,9 +453,9 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId)
// Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits // Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits
if (olsenId.contains(' ')) if (olsenId.contains(' '))
return false; return false;
QList<QByteArray> parts = olsenId.split('\\'); QList<QByteArray> parts = olsenId.split('/');
foreach (const QByteArray &part, parts) { foreach (const QByteArray &part, parts) {
if (part.size() > 14) if (part.size() > 14 || part.size() < 1)
return false; return false;
if (part.at(0) == '-') if (part.at(0) == '-')
return false; return false;
@ -466,6 +466,8 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId)
&& !(ch == '_') && !(ch == '_')
&& !(ch >= '0' && ch <= '9') && !(ch >= '0' && ch <= '9')
&& !(ch == '-') && !(ch == '-')
&& !(ch == '+')
&& !(ch == ':')
&& !(ch == '.')) && !(ch == '.'))
return false; return false;
} }

View File

@ -445,8 +445,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count(); data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
idata.resize(data_size + 1); idata.resize(data_size + 1);
QMetaStringTable strings; QMetaStringTable strings(className.toLatin1());
strings.enter(className.toLatin1());
int offset = header->methodData; int offset = header->methodData;
int parametersOffset = offset + header->methodCount * 5; int parametersOffset = offset + header->methodCount * 5;

View File

@ -245,6 +245,8 @@ class QImageWriterPrivate
public: public:
QImageWriterPrivate(QImageWriter *qq); QImageWriterPrivate(QImageWriter *qq);
bool canWriteHelper();
// device // device
QByteArray format; QByteArray format;
QIODevice *device; QIODevice *device;
@ -282,6 +284,31 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
q = qq; q = qq;
} }
bool QImageWriterPrivate::canWriteHelper()
{
if (!device) {
imageWriterError = QImageWriter::DeviceError;
errorString = QT_TRANSLATE_NOOP(QImageWriter,
QLatin1String("Device is not set"));
return false;
}
if (!device->isOpen())
device->open(QIODevice::WriteOnly);
if (!device->isWritable()) {
imageWriterError = QImageWriter::DeviceError;
errorString = QT_TRANSLATE_NOOP(QImageWriter,
QLatin1String("Device not writable"));
return false;
}
if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) {
imageWriterError = QImageWriter::UnsupportedFormatError;
errorString = QT_TRANSLATE_NOOP(QImageWriter,
QLatin1String("Unsupported image format"));
return false;
}
return true;
}
/*! /*!
Constructs an empty QImageWriter object. Before writing, you must Constructs an empty QImageWriter object. Before writing, you must
call setFormat() to set an image format, then setDevice() or call setFormat() to set an image format, then setDevice() or
@ -561,21 +588,15 @@ void QImageWriter::setText(const QString &key, const QString &text)
*/ */
bool QImageWriter::canWrite() const bool QImageWriter::canWrite() const
{ {
if (d->device && !d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) { if (QFile *file = qobject_cast<QFile *>(d->device)) {
d->imageWriterError = QImageWriter::UnsupportedFormatError; const bool remove = !file->isOpen() && !file->exists();
d->errorString = QT_TRANSLATE_NOOP(QImageWriter, const bool result = d->canWriteHelper();
QLatin1String("Unsupported image format")); if (!result && remove)
return false; file->remove();
return result;
} }
if (d->device && !d->device->isOpen())
d->device->open(QIODevice::WriteOnly); return d->canWriteHelper();
if (!d->device || !d->device->isWritable()) {
d->imageWriterError = QImageWriter::DeviceError;
d->errorString = QT_TRANSLATE_NOOP(QImageWriter,
QLatin1String("Device not writable"));
return false;
}
return true;
} }
/*! /*!

View File

@ -3,8 +3,10 @@ INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qjpeghandler_p.h HEADERS += $$PWD/qjpeghandler_p.h
SOURCES += $$PWD/qjpeghandler.cpp SOURCES += $$PWD/qjpeghandler.cpp
contains(QT_CONFIG, system-jpeg) { contains(QT_CONFIG, system-jpeg) {
if(unix|win32-g++*): LIBS += -ljpeg msvc: \
else:win32: LIBS += libjpeg.lib LIBS += libjpeg.lib
else: \
LIBS += -ljpeg
} else { } else {
include($$PWD/../../3rdparty/libjpeg.pri) include($$PWD/../../3rdparty/libjpeg.pri)
} }

View File

@ -2555,6 +2555,11 @@ void QGuiApplication::setFont(const QFont &font)
void QGuiApplicationPrivate::notifyLayoutDirectionChange() void QGuiApplicationPrivate::notifyLayoutDirectionChange()
{ {
const QWindowList list = QGuiApplication::topLevelWindows();
for (int i = 0; i < list.size(); ++i) {
QEvent ev(QEvent::ApplicationLayoutDirectionChange);
QCoreApplication::sendEvent(list.at(i), &ev);
}
} }
void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *) void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *)

View File

@ -145,6 +145,8 @@ QT_BEGIN_NAMESPACE
\value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog \value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog
becomes visible. becomes visible.
\value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release.
\sa themeHint(), QStyle::pixelMetric() \sa themeHint(), QStyle::pixelMetric()
*/ */
@ -492,6 +494,7 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
case IconPixmapSizes: case IconPixmapSizes:
return QVariant::fromValue(QList<int>()); return QVariant::fromValue(QList<int>());
case DialogSnapToDefaultButton: case DialogSnapToDefaultButton:
case ContextMenuOnMouseRelease:
return QVariant(false); return QVariant(false);
case MousePressAndHoldInterval: case MousePressAndHoldInterval:
return QVariant(800); return QVariant(800);

View File

@ -107,6 +107,7 @@ public:
IconPixmapSizes, IconPixmapSizes,
PasswordMaskCharacter, PasswordMaskCharacter,
DialogSnapToDefaultButton, DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
MousePressAndHoldInterval MousePressAndHoldInterval
}; };

View File

@ -119,37 +119,6 @@ QBezier QBezier::getSubRange(qreal t0, qreal t1) const
return result; return result;
} }
static inline int quadraticRoots(qreal a, qreal b, qreal c,
qreal *x1, qreal *x2)
{
if (qFuzzyIsNull(a)) {
if (qFuzzyIsNull(b))
return 0;
*x1 = *x2 = (-c / b);
return 1;
} else {
const qreal det = b * b - 4 * a * c;
if (qFuzzyIsNull(det)) {
*x1 = *x2 = -b / (2 * a);
return 1;
}
if (det > 0) {
if (qFuzzyIsNull(b)) {
*x2 = qSqrt(-c / a);
*x1 = -(*x2);
return 2;
}
const qreal stableA = b / (2 * a);
const qreal stableB = c / (a * stableA * stableA);
const qreal stableC = -1 - qSqrt(1 - stableB);
*x2 = stableA * stableC;
*x1 = (stableA * stableB) / stableC;
return 2;
} else
return 0;
}
}
void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const
{ {
QBezier beziers[10]; QBezier beziers[10];

View File

@ -71,6 +71,7 @@ class QTextCursor;
template<typename T> class QVector; template<typename T> class QVector;
#ifndef Q_QDOC // Workaround for QTBUG-35230
namespace Qt namespace Qt
{ {
Q_GUI_EXPORT bool mightBeRichText(const QString&); Q_GUI_EXPORT bool mightBeRichText(const QString&);
@ -80,6 +81,7 @@ namespace Qt
Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
#endif #endif
} }
#endif // Q_QDOC
class Q_GUI_EXPORT QAbstractUndoItem class Q_GUI_EXPORT QAbstractUndoItem
{ {

View File

@ -1214,6 +1214,8 @@ static const char *certificate_blacklist[] = {
"08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate "08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate
"08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate "08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate
"03:1d:a7", "AC DG Tr\xC3\xA9sor SSL", // intermediate certificate linking back to ANSSI French National Security Agency
0 0
}; };

View File

@ -192,8 +192,6 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
QWindow *window = static_cast<QCocoaWindow *>(surface)->window(); QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
setActiveWindow(window); setActiveWindow(window);
if (![m_context view])
return false;
[m_context makeCurrentContext]; [m_context makeCurrentContext];
update(); update();
return true; return true;

View File

@ -159,8 +159,10 @@ public:
void registerTouch(bool enable); void registerTouch(bool enable);
qreal devicePixelRatio() const; qreal devicePixelRatio() const;
bool isWindowExposable();
void exposeWindow(); void exposeWindow();
void obscureWindow(); void obscureWindow();
void updateExposedGeometry();
QWindow *childWindowAt(QPoint windowPoint); QWindow *childWindowAt(QPoint windowPoint);
protected: protected:
// NSWindow handling. The QCocoaWindow/QNSView can either be displayed // NSWindow handling. The QCocoaWindow/QNSView can either be displayed
@ -202,7 +204,9 @@ public: // for QNSView
bool m_hasModalSession; bool m_hasModalSession;
bool m_frameStrutEventsEnabled; bool m_frameStrutEventsEnabled;
bool m_geometryUpdateExposeAllowed;
bool m_isExposed; bool m_isExposed;
QRect m_exposedGeometry;
int m_registerTouchCount; int m_registerTouchCount;
bool m_resizableTransientParent; bool m_resizableTransientParent;
bool m_overrideBecomeKey; bool m_overrideBecomeKey;

View File

@ -213,6 +213,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_windowCursor(0) , m_windowCursor(0)
, m_hasModalSession(false) , m_hasModalSession(false)
, m_frameStrutEventsEnabled(false) , m_frameStrutEventsEnabled(false)
, m_geometryUpdateExposeAllowed(false)
, m_isExposed(false) , m_isExposed(false)
, m_registerTouchCount(0) , m_registerTouchCount(0)
, m_resizableTransientParent(false) , m_resizableTransientParent(false)
@ -1084,22 +1085,61 @@ qreal QCocoaWindow::devicePixelRatio() const
} }
} }
// Returns whether the window can be expose, which it can
// if it is on screen and has a valid geometry.
bool QCocoaWindow::isWindowExposable()
{
QSize size = geometry().size();
bool validGeometry = (size.width() > 0 && size.height() > 0);
bool validScreen = ([[m_contentView window] screen] != 0);
bool nonHiddenSuperView = ![[m_contentView superview] isHidden];
return (validGeometry && validScreen && nonHiddenSuperView);
}
// Exposes the window by posting an expose event to QWindowSystemInterface
void QCocoaWindow::exposeWindow() void QCocoaWindow::exposeWindow()
{ {
if (!m_isExposed && ![[m_contentView superview] isHidden]) { m_geometryUpdateExposeAllowed = true;
if (!isWindowExposable())
return;
if (!m_isExposed) {
m_isExposed = true; m_isExposed = true;
m_exposedGeometry = geometry();
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
} }
} }
// Obscures the window by posting an empty expose event to QWindowSystemInterface
void QCocoaWindow::obscureWindow() void QCocoaWindow::obscureWindow()
{ {
if (m_isExposed) { if (m_isExposed) {
m_geometryUpdateExposeAllowed = false;
m_isExposed = false; m_isExposed = false;
QWindowSystemInterface::handleExposeEvent(window(), QRegion()); QWindowSystemInterface::handleExposeEvent(window(), QRegion());
} }
} }
// Updates window geometry by posting an expose event to QWindowSystemInterface
void QCocoaWindow::updateExposedGeometry()
{
// updateExposedGeometry is not allowed to send the initial expose. If you want
// that call exposeWindow();
if (!m_geometryUpdateExposeAllowed)
return;
if (!isWindowExposable())
return;
if (m_exposedGeometry == geometry())
return;
m_isExposed = true;
m_exposedGeometry = geometry();
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}
QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint) QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
{ {
QWindow *targetWindow = window(); QWindow *targetWindow = window();

View File

@ -93,6 +93,8 @@ QT_END_NAMESPACE
- (BOOL)hasMask; - (BOOL)hasMask;
- (BOOL)isOpaque; - (BOOL)isOpaque;
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
- (void)resetMouseButtons; - (void)resetMouseButtons;
- (void)handleMouseEvent:(NSEvent *)theEvent; - (void)handleMouseEvent:(NSEvent *)theEvent;

View File

@ -175,7 +175,7 @@ static QTouchDevice *touchDevice = 0;
- (void) globalFrameChanged:(NSNotification*)notification - (void) globalFrameChanged:(NSNotification*)notification
{ {
Q_UNUSED(notification); Q_UNUSED(notification);
QWindowSystemInterface::handleExposeEvent(m_window, m_window->geometry()); m_platformWindow->updateExposedGeometry();
} }
- (void)viewDidMoveToSuperview - (void)viewDidMoveToSuperview
@ -186,7 +186,7 @@ static QTouchDevice *touchDevice = 0;
if ([self superview]) { if ([self superview]) {
m_platformWindow->m_contentViewIsEmbedded = true; m_platformWindow->m_contentViewIsEmbedded = true;
QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry()); QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry());
QWindowSystemInterface::handleExposeEvent(m_window, m_platformWindow->geometry()); m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents(); QWindowSystemInterface::flushWindowSystemEvents();
} else { } else {
m_platformWindow->m_contentViewIsEmbedded = false; m_platformWindow->m_contentViewIsEmbedded = false;
@ -261,7 +261,7 @@ static QTouchDevice *touchDevice = 0;
// Send a geometry change event to Qt, if it's ready to handle events // Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) { if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry); QWindowSystemInterface::handleGeometryChange(m_window, geometry);
QWindowSystemInterface::handleExposeEvent(m_window, geometry); m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents(); QWindowSystemInterface::flushWindowSystemEvents();
} }
} }

View File

@ -53,6 +53,7 @@
- (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow; - (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow;
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowDidResize:(NSNotification *)notification; - (void)windowDidResize:(NSNotification *)notification;
- (void)windowDidMove:(NSNotification *)notification; - (void)windowDidMove:(NSNotification *)notification;
- (void)windowWillMove:(NSNotification *)notification; - (void)windowWillMove:(NSNotification *)notification;

View File

@ -56,6 +56,17 @@
return self; return self;
} }
- (void)windowDidBecomeKey:(NSNotification *)notification
{
Q_UNUSED(notification);
if (m_cocoaWindow->m_windowUnderMouse) {
QPointF windowPoint;
QPointF screenPoint;
[m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
}
- (void)windowDidResize:(NSNotification *)notification - (void)windowDidResize:(NSNotification *)notification
{ {
Q_UNUSED(notification); Q_UNUSED(notification);

View File

@ -87,6 +87,8 @@ QEglFSIntegration::QEglFSIntegration()
, mScreen(0) , mScreen(0)
, mInputContext(0) , mInputContext(0)
{ {
mDisableInputHandlers = qgetenv("QT_QPA_EGLFS_DISABLE_INPUT").toInt();
initResources(); initResources();
} }
@ -176,6 +178,7 @@ void QEglFSIntegration::initialize()
mInputContext = QPlatformInputContextFactory::create(); mInputContext = QPlatformInputContextFactory::create();
if (!mDisableInputHandlers)
createInputHandlers(); createInputHandlers();
} }

View File

@ -97,6 +97,7 @@ private:
QScopedPointer<QPlatformServices> mServices; QScopedPointer<QPlatformServices> mServices;
QEglFSScreen *mScreen; QEglFSScreen *mScreen;
QPlatformInputContext *mInputContext; QPlatformInputContext *mInputContext;
bool mDisableInputHandlers;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -206,13 +206,6 @@ namespace
bool debugStackUsage = false; bool debugStackUsage = false;
} }
static int infoPlistValue(NSString* key, int defaultValue)
{
static NSBundle *bundle = [NSBundle mainBundle];
NSNumber* value = [bundle objectForInfoDictionaryKey:key];
return value ? [value intValue] : defaultValue;
}
extern "C" int __attribute__((weak)) main(int argc, char *argv[]) extern "C" int __attribute__((weak)) main(int argc, char *argv[])
{ {
@autoreleasepool { @autoreleasepool {

View File

@ -61,6 +61,7 @@ QPointF fromCGPoint(const CGPoint &point);
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation); Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation);
UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation); UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation);
QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen); QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen);
int infoPlistValue(NSString* key, int defaultValue);
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -134,5 +134,12 @@ QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen)
: QRect(rect.y(), geometry.height() - rect.width() - rect.x(), rect.height(), rect.width()); : QRect(rect.y(), geometry.height() - rect.width() - rect.x(), rect.height(), rect.width());
} }
int infoPlistValue(NSString* key, int defaultValue)
{
static NSBundle *bundle = [NSBundle mainBundle];
NSNumber* value = [bundle objectForInfoDictionaryKey:key];
return value ? [value intValue] : defaultValue;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -270,7 +270,7 @@ void QIOSInputContext::scrollRootView()
&& m_keyboardListener->m_keyboardVisibleAndDocked && m_keyboardListener->m_keyboardVisibleAndDocked
&& m_focusView.window == view.window) { && m_focusView.window == view.window) {
QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle(); QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle();
cursorRect.translate(qGuiApp->focusWindow()->geometry().topLeft()); cursorRect.translate(m_focusView.qwindow->geometry().topLeft());
qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y(); qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y();
int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y(); int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y();
const int margin = 20; const int margin = 20;

View File

@ -74,6 +74,8 @@ public:
QStringList themeNames() const; QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const; QPlatformTheme *createPlatformTheme(const QString &name) const;
QPlatformDrag *drag() const Q_DECL_OVERRIDE { return 0; }
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const; QPlatformNativeInterface *nativeInterface() const;

View File

@ -101,12 +101,15 @@
- (BOOL)prefersStatusBarHidden - (BOOL)prefersStatusBarHidden
{ {
static bool hiddenFromPlist = infoPlistValue(@"UIStatusBarHidden", false);
if (hiddenFromPlist)
return YES;
QWindow *focusWindow = QGuiApplication::focusWindow(); QWindow *focusWindow = QGuiApplication::focusWindow();
if (!focusWindow) if (!focusWindow || !focusWindow->handle())
return [UIApplication sharedApplication].statusBarHidden; return [UIApplication sharedApplication].statusBarHidden;
QIOSWindow *topLevel = static_cast<QIOSWindow *>(focusWindow->handle())->topLevelWindow(); QWindow *topLevel = static_cast<QIOSWindow *>(focusWindow->handle())->topLevelWindow();
return topLevel->window()->windowState() == Qt::WindowFullScreen; return topLevel->windowState() == Qt::WindowFullScreen;
} }
@end @end

View File

@ -87,7 +87,7 @@ public:
WId winId() const { return WId(m_view); }; WId winId() const { return WId(m_view); };
QIOSWindow *topLevelWindow() const; QWindow *topLevelWindow() const;
private: private:
void applyGeometry(const QRect &rect); void applyGeometry(const QRect &rect);

View File

@ -108,8 +108,6 @@
[NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
[self updateTextInputTraits];
if (isQtApplication()) if (isQtApplication())
self.hidden = YES; self.hidden = YES;
@ -206,11 +204,12 @@
- (void)displayLayer:(CALayer *)layer - (void)displayLayer:(CALayer *)layer
{ {
QRect geometry = fromCGRect(layer.frame).toRect(); QSize bounds = fromCGRect(layer.bounds).toRect().size();
Q_ASSERT(m_qioswindow->geometry() == geometry);
Q_ASSERT(m_qioswindow->geometry().size() == bounds);
Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible());
QRegion region = self.hidden ? QRegion() : QRect(QPoint(), geometry.size()); QRegion region = self.hidden ? QRegion() : QRect(QPoint(), bounds);
QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region); QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region);
QWindowSystemInterface::flushWindowSystemEvents(); QWindowSystemInterface::flushWindowSystemEvents();
} }
@ -330,13 +329,9 @@
- (BOOL)becomeFirstResponder - (BOOL)becomeFirstResponder
{ {
// On iOS, a QWindow should only have input focus when the input panel is // Note: QIOSInputContext controls our first responder status based on
// open. This is to stop cursors and focus rects from being drawn when the // whether or not the keyboard should be open or closed.
// user cannot type. And since the keyboard will open when a view becomes
// the first responder, it's now a good time to inform QPA that the QWindow
// this view backs became active:
[self updateTextInputTraits]; [self updateTextInputTraits];
QWindowSystemInterface::handleWindowActivated(m_qioswindow->window());
return [super becomeFirstResponder]; return [super becomeFirstResponder];
} }
@ -345,6 +340,7 @@
// Resigning first responed status means that the virtual keyboard was closed, or // Resigning first responed status means that the virtual keyboard was closed, or
// some other view became first responder. In either case we clear the focus object to // some other view became first responder. In either case we clear the focus object to
// avoid blinking cursors in line edits etc: // avoid blinking cursors in line edits etc:
if (m_qioswindow)
static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject(); static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject();
return [super resignFirstResponder]; return [super resignFirstResponder];
} }
@ -427,8 +423,10 @@
- (QWindow *)qwindow - (QWindow *)qwindow
{ {
if ([self isKindOfClass:[QUIView class]]) if ([self isKindOfClass:[QUIView class]]) {
return static_cast<QUIView *>(self)->m_qioswindow->window(); if (QIOSWindow *w = static_cast<QUIView *>(self)->m_qioswindow)
return w->window();
}
return nil; return nil;
} }
@ -473,6 +471,7 @@ QIOSWindow::~QIOSWindow()
// cancellation of all touch events. // cancellation of all touch events.
[m_view touchesCancelled:0 withEvent:0]; [m_view touchesCancelled:0 withEvent:0];
m_view->m_qioswindow = 0;
[m_view removeFromSuperview]; [m_view removeFromSuperview];
[m_view release]; [m_view release];
} }
@ -637,7 +636,7 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow)
} }
} }
QIOSWindow *QIOSWindow::topLevelWindow() const QWindow *QIOSWindow::topLevelWindow() const
{ {
QWindow *window = this->window(); QWindow *window = this->window();
while (window) { while (window) {
@ -651,7 +650,7 @@ QIOSWindow *QIOSWindow::topLevelWindow() const
window = parent; window = parent;
} }
return static_cast<QIOSWindow *>(window->handle()); return window;
} }
void QIOSWindow::requestActivateWindow() void QIOSWindow::requestActivateWindow()

View File

@ -586,15 +586,17 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB; attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB;
attributes[attribIndex++] = minorVersion; attributes[attribIndex++] = minorVersion;
} }
if (requestedVersion >= 0x0300) {
attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; int flags = 0;
attributes[attribIndex] = 0;
if (!format.testOption(QSurfaceFormat::DeprecatedFunctions))
attributes[attribIndex] |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (format.testOption(QSurfaceFormat::DebugContext)) if (format.testOption(QSurfaceFormat::DebugContext))
attributes[attribIndex] |= WGL_CONTEXT_DEBUG_BIT_ARB; flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
attribIndex++; if (requestedVersion >= 0x0300) {
if (!format.testOption(QSurfaceFormat::DeprecatedFunctions))
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
} }
attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB;
attributes[attribIndex++] = flags;
if (requestedVersion >= 0x0302) { if (requestedVersion >= 0x0302) {
switch (format.profile()) { switch (format.profile()) {
case QSurfaceFormat::NoProfile: case QSurfaceFormat::NoProfile:

View File

@ -383,6 +383,8 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
} }
case DialogSnapToDefaultButton: case DialogSnapToDefaultButton:
return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false)); return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false));
case ContextMenuOnMouseRelease:
return QVariant(true);
default: default:
break; break;
} }

View File

@ -1170,8 +1170,13 @@ void QWindowsWindow::show_sys() const
if (type == Qt::Popup || type == Qt::ToolTip || type == Qt::Tool) if (type == Qt::Popup || type == Qt::ToolTip || type == Qt::Tool)
sm = SW_SHOWNOACTIVATE; sm = SW_SHOWNOACTIVATE;
if (w->windowState() & Qt::WindowMaximized)
setFlag(WithinMaximize); // QTBUG-8361
ShowWindow(m_data.hwnd, sm); ShowWindow(m_data.hwnd, sm);
clearFlag(WithinMaximize);
if (fakedMaximize) { if (fakedMaximize) {
setStyle(style() & ~WS_MAXIMIZEBOX); setStyle(style() & ~WS_MAXIMIZEBOX);
SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0, SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0,
@ -1582,8 +1587,11 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
setFlag(FrameDirty); setFlag(FrameDirty);
if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
if (visible && !(newState == Qt::WindowMinimized)) if (visible && !(newState == Qt::WindowMinimized)) {
setFlag(WithinMaximize);
ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
clearFlag(WithinMaximize);
}
} }
if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) {
@ -1903,6 +1911,25 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
{ {
const QWindowsGeometryHint hint(window(), m_data.customMargins); const QWindowsGeometryHint hint(window(), m_data.customMargins);
hint.applyToMinMaxInfo(m_data.hwnd, mmi); hint.applyToMinMaxInfo(m_data.hwnd, mmi);
if ((testFlag(WithinMaximize) || (window()->windowState() == Qt::WindowMinimized))
&& (m_data.flags & Qt::FramelessWindowHint)) {
// This block fixes QTBUG-8361: Frameless windows shouldn't cover the
// taskbar when maximized
if (const QScreen *screen = effectiveScreen(window())) {
mmi->ptMaxSize.y = screen->availableGeometry().height();
// Width, because you can have the taskbar on the sides too.
mmi->ptMaxSize.x = screen->availableGeometry().width();
// If you have the taskbar on top, or on the left you don't want it at (0,0):
mmi->ptMaxPosition.x = screen->availableGeometry().x();
mmi->ptMaxPosition.y = screen->availableGeometry().y();
} else {
qWarning() << "Invalid screen";
}
}
if (QWindowsContext::verboseWindows) if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << window() << *mmi; qDebug() << __FUNCTION__ << window() << *mmi;
} }

View File

@ -136,7 +136,8 @@ public:
TouchRegistered = 0x4000, TouchRegistered = 0x4000,
AlertState = 0x8000, AlertState = 0x8000,
Exposed = 0x10000, Exposed = 0x10000,
WithinCreate = 0x20000 WithinCreate = 0x20000,
WithinMaximize = 0x40000
}; };
struct WindowData struct WindowData

View File

@ -81,7 +81,7 @@ contains(QT_CONFIG, xcb-sm) {
} }
contains(QT_CONFIG, opengl) { contains(QT_CONFIG, opengl) {
contains(QT_CONFIG, xcb-xlib):contains(QT_CONFIG, glx) { contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, opengles2) {
DEFINES += XCB_USE_GLX DEFINES += XCB_USE_GLX
HEADERS += qglxintegration.h HEADERS += qglxintegration.h
SOURCES += qglxintegration.cpp SOURCES += qglxintegration.cpp

View File

@ -457,9 +457,6 @@ void QPageSetupWidget::selectPrinter()
unitChanged(widget.unit->currentIndex()); unitChanged(widget.unit->currentIndex());
m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin);
// setup printer here the first time
setupPrinter();
} }
void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p) void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p)

View File

@ -106,7 +106,6 @@ Q_SIGNALS:
private: private:
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool))
Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool)) Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool))
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
# if !defined(QT_NO_MESSAGEBOX) # if !defined(QT_NO_MESSAGEBOX)

View File

@ -203,7 +203,6 @@ public:
void selectPrinter(const QPrinter::OutputFormat outputFormat); void selectPrinter(const QPrinter::OutputFormat outputFormat);
void _q_chbPrintLastFirstToggled(bool);
void _q_togglePageSetCombo(bool); void _q_togglePageSetCombo(bool);
#ifndef QT_NO_MESSAGEBOX #ifndef QT_NO_MESSAGEBOX
void _q_checkFields(); void _q_checkFields();
@ -363,9 +362,6 @@ void QPrintDialogPrivate::init()
#endif #endif
QObject::connect(buttons, SIGNAL(rejected()), q, SLOT(reject())); QObject::connect(buttons, SIGNAL(rejected()), q, SLOT(reject()));
QObject::connect(options.reverse, SIGNAL(toggled(bool)),
q, SLOT(_q_chbPrintLastFirstToggled(bool)));
QObject::connect(options.printSelection, SIGNAL(toggled(bool)), QObject::connect(options.printSelection, SIGNAL(toggled(bool)),
q, SLOT(_q_togglePageSetCombo(bool))); q, SLOT(_q_togglePageSetCombo(bool)));
@ -416,6 +412,10 @@ void QPrintDialogPrivate::applyPrinterProperties()
void QPrintDialogPrivate::setupPrinter() void QPrintDialogPrivate::setupPrinter()
{ {
// First setup the requested OutputFormat, Printer and Page Size first
top->d->setupPrinter();
// Then setup Print Job options
Q_Q(QPrintDialog); Q_Q(QPrintDialog);
QPrinter* p = q->printer(); QPrinter* p = q->printer();
@ -429,6 +429,7 @@ void QPrintDialogPrivate::setupPrinter()
} }
p->setColorMode(options.color->isChecked() ? QPrinter::Color : QPrinter::GrayScale); p->setColorMode(options.color->isChecked() ? QPrinter::Color : QPrinter::GrayScale);
p->setPageOrder(options.reverse->isChecked() ? QPrinter::LastPageFirst : QPrinter::FirstPageFirst);
// print range // print range
if (options.printAll->isChecked()) { if (options.printAll->isChecked()) {
@ -482,17 +483,6 @@ void QPrintDialogPrivate::setupPrinter()
// copies // copies
p->setCopyCount(options.copies->value()); p->setCopyCount(options.copies->value());
p->setCollateCopies(options.collate->isChecked()); p->setCollateCopies(options.collate->isChecked());
top->d->setupPrinter();
}
void QPrintDialogPrivate::_q_chbPrintLastFirstToggled(bool checked)
{
Q_Q(QPrintDialog);
if (checked)
q->printer()->setPageOrder(QPrinter::LastPageFirst);
else
q->printer()->setPageOrder(QPrinter::FirstPageFirst);
} }
void QPrintDialogPrivate::_q_togglePageSetCombo(bool checked) void QPrintDialogPrivate::_q_togglePageSetCombo(bool checked)

View File

@ -1448,6 +1448,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0); d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0);
d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0); d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0);
} }
d->doReinit();
break; break;
} }
@ -1941,8 +1942,9 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
void QWin32PrintEnginePrivate::updateCustomPaperSize() void QWin32PrintEnginePrivate::updateCustomPaperSize()
{ {
const uint paperSize = devMode->dmPaperSize; const uint paperSize = devMode->dmPaperSize;
has_custom_paper_size = true; has_custom_paper_size = false;
if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
has_custom_paper_size = true;
const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name); const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name);
for (int i=0; i<paperSizes.size(); i++) { for (int i=0; i<paperSizes.size(); i++) {
if ((uint)paperSizes.at(i).second == paperSize) { if ((uint)paperSizes.at(i).second == paperSize) {

View File

@ -334,6 +334,7 @@ QString Generator::fileBase(const Node *node) const
if (node->isQmlNode()) { if (node->isQmlNode()) {
if (!node->qmlModuleName().isEmpty()) { if (!node->qmlModuleName().isEmpty()) {
base.prepend(node->qmlModuleName() + QLatin1Char('-')); base.prepend(node->qmlModuleName() + QLatin1Char('-'));
}
/* /*
To avoid file name conflicts in the html directory, To avoid file name conflicts in the html directory,
we prepend a prefix (by default, "qml-") to the file name of QML we prepend a prefix (by default, "qml-") to the file name of QML
@ -343,7 +344,6 @@ QString Generator::fileBase(const Node *node) const
base.prepend(outputPrefix(QLatin1String("QML"))); base.prepend(outputPrefix(QLatin1String("QML")));
} }
} }
}
else if (node->subType() == Node::QmlModule) { else if (node->subType() == Node::QmlModule) {
base.append("-qmlmodule"); base.append("-qmlmodule");
} }

View File

@ -269,6 +269,9 @@ QString HtmlGenerator::format()
void HtmlGenerator::generateTree() void HtmlGenerator::generateTree()
{ {
qdb_->buildCollections(); qdb_->buildCollections();
Node* qflags = qdb_->findNodeByNameAndType(QStringList("QFlags"), Node::Class, Node::NoSubType);
if (qflags)
qflagsHref_ = linkForNode(qflags,0);
if (!runPrepareOnly()) { if (!runPrepareOnly()) {
Generator::generateTree(); Generator::generateTree();
generateCollisionPages(); generateCollisionPages();
@ -3660,7 +3663,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
if (enume->flagsType()) { if (enume->flagsType()) {
out() << "<p>The " << protectEnc(enume->flagsType()->name()) out() << "<p>The " << protectEnc(enume->flagsType()->name())
<< " type is a typedef for " << " type is a typedef for "
<< "<a href=\"qflags.html\">QFlags</a>&lt;" << "<a href=\"" << qflagsHref_ << "\">QFlags</a>&lt;"
<< protectEnc(enume->name()) << protectEnc(enume->name())
<< "&gt;. It stores an OR combination of " << "&gt;. It stores an OR combination of "
<< protectEnc(enume->name()) << protectEnc(enume->name())

View File

@ -262,6 +262,7 @@ private:
QString cppclassespage; QString cppclassespage;
QString qmltypespage; QString qmltypespage;
QString buildversion; QString buildversion;
QString qflagsHref_;
public: public:
static bool debugging_on; static bool debugging_on;

View File

@ -874,7 +874,7 @@ QGroupBox::title {
subcontrol-position: top center; /* position at the top center */ subcontrol-position: top center; /* position at the top center */
padding: 0 3px; padding: 0 3px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #FFOECE, stop: 1 #FFFFFF); stop: 0 #FF0ECE, stop: 1 #FFFFFF);
} }
//! [114] //! [114]

View File

@ -7634,7 +7634,10 @@ QGraphicsObject::~QGraphicsObject()
bool QGraphicsObject::event(QEvent *ev) bool QGraphicsObject::event(QEvent *ev)
{ {
if (ev->type() == QEvent::StyleAnimationUpdate) { if (ev->type() == QEvent::StyleAnimationUpdate) {
if (isVisible()) {
ev->accept();
update(); update();
}
return true; return true;
} }
return QObject::event(ev); return QObject::event(ev);

View File

@ -1409,9 +1409,14 @@ bool QGraphicsWidget::event(QEvent *event)
break; break;
case QEvent::WindowActivate: case QEvent::WindowActivate:
case QEvent::WindowDeactivate: case QEvent::WindowDeactivate:
case QEvent::StyleAnimationUpdate:
update(); update();
break; break;
case QEvent::StyleAnimationUpdate:
if (isVisible()) {
event->accept();
update();
}
break;
// Taken from QWidget::event // Taken from QWidget::event
case QEvent::ActivationChange: case QEvent::ActivationChange:
case QEvent::EnabledChange: case QEvent::EnabledChange:

View File

@ -1888,14 +1888,29 @@ bool QApplication::event(QEvent *e)
\obsolete \obsolete
*/ */
// ### FIXME: topLevelWindows does not contain QWidgets without a parent
// until create_sys is called. So we have to override the
// QGuiApplication::notifyLayoutDirectionChange
// to do the right thing.
void QApplicationPrivate::notifyLayoutDirectionChange() void QApplicationPrivate::notifyLayoutDirectionChange()
{ {
QWidgetList list = QApplication::topLevelWidgets(); const QWidgetList list = QApplication::topLevelWidgets();
QWindowList windowList = QGuiApplication::topLevelWindows();
// send to all top-level QWidgets
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i); QWidget *w = list.at(i);
windowList.removeAll(w->windowHandle());
QEvent ev(QEvent::ApplicationLayoutDirectionChange); QEvent ev(QEvent::ApplicationLayoutDirectionChange);
QCoreApplication::sendEvent(w, &ev); QCoreApplication::sendEvent(w, &ev);
} }
// in case there are any plain QWindows in this QApplication-using
// application, also send the notification to them
for (int i = 0; i < windowList.size(); ++i) {
QEvent ev(QEvent::ApplicationLayoutDirectionChange);
QCoreApplication::sendEvent(windowList.at(i), &ev);
}
} }
/*! /*!

View File

@ -8249,7 +8249,10 @@ bool QWidget::event(QEvent *event)
update(static_cast<QUpdateLaterEvent*>(event)->region()); update(static_cast<QUpdateLaterEvent*>(event)->region());
break; break;
case QEvent::StyleAnimationUpdate: case QEvent::StyleAnimationUpdate:
if (isVisible() && !window()->isMinimized()) {
event->accept();
update(); update();
}
break; break;
case QEvent::WindowBlocked: case QEvent::WindowBlocked:

View File

@ -148,11 +148,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QBackingStore *store = q->backingStore(); QBackingStore *store = q->backingStore();
if (!store) { if (!store) {
if (win && q->windowType() != Qt::Desktop) if (win && q->windowType() != Qt::Desktop) {
if (q->isTopLevel())
q->setBackingStore(new QBackingStore(win)); q->setBackingStore(new QBackingStore(win));
else } else {
q->setAttribute(Qt::WA_PaintOnScreen, true); q->setAttribute(Qt::WA_PaintOnScreen, true);
} }
}
setWindowModified_helper(); setWindowModified_helper();
WId id = win->winId(); WId id = win->winId();

View File

@ -49,6 +49,7 @@
#endif #endif
#include <private/qwidgetbackingstore_p.h> #include <private/qwidgetbackingstore_p.h>
#include <qpa/qwindowsysteminterface_p.h> #include <qpa/qwindowsysteminterface_p.h>
#include <qpa/qplatformtheme.h>
#include <private/qgesturemanager_p.h> #include <private/qgesturemanager_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -354,6 +355,9 @@ void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e)
void QWidgetWindow::handleMouseEvent(QMouseEvent *event) void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
{ {
static const QEvent::Type contextMenuTrigger =
QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
if (qApp->d_func()->inPopupMode()) { if (qApp->d_func()->inPopupMode()) {
QWidget *activePopupWidget = qApp->activePopupWidget(); QWidget *activePopupWidget = qApp->activePopupWidget();
QWidget *popup = activePopupWidget; QWidget *popup = activePopupWidget;
@ -438,7 +442,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
} }
qt_replay_popup_mouse_event = false; qt_replay_popup_mouse_event = false;
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
} else if (event->type() == QEvent::MouseButtonPress } else if (event->type() == contextMenuTrigger
&& event->button() == Qt::RightButton && event->button() == Qt::RightButton
&& (openPopupCount == oldOpenPopupCount)) { && (openPopupCount == oldOpenPopupCount)) {
QWidget *popupEvent = popup; QWidget *popupEvent = popup;
@ -487,7 +491,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
qt_last_mouse_receiver); qt_last_mouse_receiver);
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::RightButton) { if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton) {
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
QGuiApplication::sendSpontaneousEvent(receiver, &e); QGuiApplication::sendSpontaneousEvent(receiver, &e);
} }

View File

@ -619,7 +619,7 @@ void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, c
void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
const QPixmap &pixmap) const const QPixmap &pixmap) const
{ {
int scale = pixmap.devicePixelRatio(); qreal scale = pixmap.devicePixelRatio();
QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect); QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect);
QRect inter = aligned.intersected(rect); QRect inter = aligned.intersected(rect);

View File

@ -93,7 +93,10 @@ void QStyleAnimation::setStartTime(const QTime &time)
void QStyleAnimation::updateTarget() void QStyleAnimation::updateTarget()
{ {
QEvent event(QEvent::StyleAnimationUpdate); QEvent event(QEvent::StyleAnimationUpdate);
event.setAccepted(false);
QCoreApplication::sendEvent(target(), &event); QCoreApplication::sendEvent(target(), &event);
if (!event.isAccepted())
stop();
} }
bool QStyleAnimation::isUpdateNeeded() const bool QStyleAnimation::isUpdateNeeded() const
@ -103,16 +106,8 @@ bool QStyleAnimation::isUpdateNeeded() const
void QStyleAnimation::updateCurrentTime(int) void QStyleAnimation::updateCurrentTime(int)
{ {
if (QObject *tgt = target()) { if (target() && isUpdateNeeded())
if (tgt->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(tgt);
if (!widget->isVisible() || widget->window()->isMinimized())
stop();
}
if (isUpdateNeeded())
updateTarget(); updateTarget();
}
} }
QProgressStyleAnimation::QProgressStyleAnimation(int speed, QObject *target) : QProgressStyleAnimation::QProgressStyleAnimation(int speed, QObject *target) :

View File

@ -5271,7 +5271,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder(); bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder();
bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition(); bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition(); bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
if (ruleMatch || upRuleMatch || downRuleMatch) { if (ruleMatch || upRuleMatch || downRuleMatch) {
switch (sc) { switch (sc) {
case SC_SpinBoxFrame: case SC_SpinBoxFrame:

View File

@ -3073,7 +3073,7 @@ void QComboBox::wheelEvent(QWheelEvent *e)
newIndex--; newIndex--;
while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled))
newIndex--; newIndex--;
} else { } else if (e->delta() < 0) {
newIndex++; newIndex++;
while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled))
newIndex++; newIndex++;

View File

@ -1042,7 +1042,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
if (max != min && (copy.isEmpty() if (max != min && (copy.isEmpty()
|| (min < 0 && copy == QLatin1String("-")) || (min < 0 && copy == QLatin1String("-"))
|| (min >= 0 && copy == QLatin1String("+")))) { || (max >= 0 && copy == QLatin1String("+")))) {
state = QValidator::Intermediate; state = QValidator::Intermediate;
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
} else if (copy.startsWith(QLatin1Char('-')) && min >= 0) { } else if (copy.startsWith(QLatin1Char('-')) && min >= 0) {

View File

@ -2158,11 +2158,14 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
setActionIcon(a, QStringLiteral("edit-redo")); setActionIcon(a, QStringLiteral("edit-redo"));
menu->addSeparator(); menu->addSeparator();
#ifndef QT_NO_CLIPBOARD
a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut()));
a->setEnabled(d->cursor.hasSelection()); a->setEnabled(d->cursor.hasSelection());
setActionIcon(a, QStringLiteral("edit-cut")); setActionIcon(a, QStringLiteral("edit-cut"));
#endif
} }
#ifndef QT_NO_CLIPBOARD
if (showTextSelectionActions) { if (showTextSelectionActions) {
a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy()));
a->setEnabled(d->cursor.hasSelection()); a->setEnabled(d->cursor.hasSelection());
@ -2175,9 +2178,10 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink()));
a->setEnabled(!d->linkToCopy.isEmpty()); a->setEnabled(!d->linkToCopy.isEmpty());
} }
#endif // QT_NO_CLIPBOARD
if (d->interactionFlags & Qt::TextEditable) { if (d->interactionFlags & Qt::TextEditable) {
#if !defined(QT_NO_CLIPBOARD) #ifndef QT_NO_CLIPBOARD
a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste()));
a->setEnabled(canPaste()); a->setEnabled(canPaste());
setActionIcon(a, QStringLiteral("edit-paste")); setActionIcon(a, QStringLiteral("edit-paste"));

View File

@ -31,8 +31,7 @@ load(qt_targets)
wince*:QMAKE_POST_LINK = wince*:QMAKE_POST_LINK =
unix|win32-g++* { lib_replace.match = $$[QT_INSTALL_LIBS/get]
lib_replace.match = $$[QT_INSTALL_LIBS/get] lib_replace.replace = $$[QT_INSTALL_LIBS/raw]
lib_replace.replace = $$[QT_INSTALL_LIBS/raw] lib_replace.CONFIG = path
QMAKE_PRL_INSTALL_REPLACE += lib_replace QMAKE_PRL_INSTALL_REPLACE += lib_replace
}

View File

@ -3,6 +3,7 @@ SUBDIRS=\
qtconcurrentfilter \ qtconcurrentfilter \
qtconcurrentiteratekernel \ qtconcurrentiteratekernel \
qtconcurrentmap \ qtconcurrentmap \
qtconcurrentmedian \
qtconcurrentrun \ qtconcurrentrun \
qtconcurrentthreadengine qtconcurrentthreadengine

View File

@ -0,0 +1,5 @@
CONFIG += testcase parallel_test
TARGET = tst_qtconcurrentmedian
QT = core testlib concurrent
SOURCES = tst_qtconcurrentmedian.cpp
DEFINES += QT_STRICT_ITERATORS

View File

@ -0,0 +1,87 @@
/****************************************************************************
**
** Copyright (C) 2013 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 <qtconcurrentmedian.h>
#include <QtTest/QtTest>
class tst_QtConcurrentMedian: public QObject
{
Q_OBJECT
private slots:
void median_data();
void median();
};
void tst_QtConcurrentMedian::median_data()
{
QTest::addColumn<QList<int> >("values");
QTest::addColumn<int>("expectedMedian");
QTest::newRow("size=1")
<< (QList<int>() << 1)
<< 1;
QTest::newRow("size=2")
<< (QList<int>() << 3 << 2)
<< 3;
QTest::newRow("size=3")
<< (QList<int>() << 3 << 1 << 2)
<< 2;
QTest::newRow("gcc bug 58800 (nth_element)")
<< (QList<int>() << 207089 << 202585 << 180067 << 157549 << 211592 << 216096 << 207089)
<< 207089;
}
void tst_QtConcurrentMedian::median()
{
QFETCH(QList<int> , values);
QFETCH(int, expectedMedian);
QtConcurrent::Median<int> m(values.size());
foreach (int value, values)
m.addValue(value);
QCOMPARE(m.median(), expectedMedian);
}
QTEST_MAIN(tst_QtConcurrentMedian)
#include "tst_qtconcurrentmedian.moc"

View File

@ -8,7 +8,11 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \
testProcessSpacesArgs/twospaces.pro \ testProcessSpacesArgs/twospaces.pro \
testSpaceInName testSpaceInName
win32:!wince*:SUBDIRS+=testProcessEchoGui win32:!wince* {
SUBDIRS += \
testProcessEchoGui \
testSetNamedPipeHandleState
}
test.depends += $$SUBDIRS test.depends += $$SUBDIRS
SUBDIRS += test SUBDIRS += test

View File

@ -0,0 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2013 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 <windows.h>
int main()
{
DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
if (SetNamedPipeHandleState(GetStdHandle(STD_INPUT_HANDLE), &mode, NULL, NULL))
return 0;
return GetLastError();
}

View File

@ -0,0 +1,4 @@
SOURCES = main.cpp
CONFIG -= qt app_bundle
CONFIG += console
DESTDIR = ./

View File

@ -93,6 +93,7 @@ private slots:
void echoTest2(); void echoTest2();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void echoTestGui(); void echoTestGui();
void testSetNamedPipeHandleState();
void batFiles_data(); void batFiles_data();
void batFiles(); void batFiles();
#endif #endif
@ -538,7 +539,6 @@ void tst_QProcess::echoTest2()
#endif #endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
//Batch files are not supported on Winfows CE
// Reading and writing to a process is not supported on Qt/CE // Reading and writing to a process is not supported on Qt/CE
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void tst_QProcess::echoTestGui() void tst_QProcess::echoTestGui()
@ -556,11 +556,22 @@ void tst_QProcess::echoTestGui()
QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello")); QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello"));
QCOMPARE(process.readAllStandardError(), QByteArray("Hello")); QCOMPARE(process.readAllStandardError(), QByteArray("Hello"));
} }
void tst_QProcess::testSetNamedPipeHandleState()
{
QProcess process;
process.setProcessChannelMode(QProcess::SeparateChannels);
process.start("testSetNamedPipeHandleState/testSetNamedPipeHandleState");
QVERIFY2(process.waitForStarted(5000), qPrintable(process.errorString()));
QVERIFY(process.waitForFinished(5000));
QCOMPARE(process.exitCode(), 0);
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
}
#endif // !Q_OS_WINCE && Q_OS_WIN #endif // !Q_OS_WINCE && Q_OS_WIN
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
//Batch files are not supported on Winfows CE // Batch files are not supported on Windows CE
void tst_QProcess::batFiles_data() void tst_QProcess::batFiles_data()
{ {
QTest::addColumn<QString>("batFile"); QTest::addColumn<QString>("batFile");

View File

@ -75,6 +75,8 @@ private slots:
void usage_connect(); void usage_connect();
void usage_templateConnect(); void usage_templateConnect();
void classNameFirstInStringData();
private: private:
static bool checkForSideEffects static bool checkForSideEffects
(const QMetaObjectBuilder& builder, (const QMetaObjectBuilder& builder,
@ -1694,6 +1696,20 @@ void tst_QMetaObjectBuilder::usage_templateConnect()
QVERIFY(!con); QVERIFY(!con);
} }
void tst_QMetaObjectBuilder::classNameFirstInStringData()
{
QMetaObjectBuilder builder;
builder.addMetaObject(&SomethingOfEverything::staticMetaObject);
builder.setClassName(QByteArrayLiteral("TestClass"));
QMetaObject *mo = builder.toMetaObject();
QByteArrayDataPtr header;
header.ptr = const_cast<QByteArrayData*>(mo->d.stringdata);
QCOMPARE(QByteArray(header), QByteArrayLiteral("TestClass"));
free(mo);
}
QTEST_MAIN(tst_QMetaObjectBuilder) QTEST_MAIN(tst_QMetaObjectBuilder)
#include "tst_qmetaobjectbuilder.moc" #include "tst_qmetaobjectbuilder.moc"

View File

@ -69,6 +69,7 @@ private slots:
void testUnknownOptionErrorHandling(); void testUnknownOptionErrorHandling();
void testDoubleDash_data(); void testDoubleDash_data();
void testDoubleDash(); void testDoubleDash();
void testDefaultValue();
void testProcessNotCalled(); void testProcessNotCalled();
void testEmptyArgsList(); void testEmptyArgsList();
void testMissingOptionValue(); void testMissingOptionValue();
@ -322,6 +323,17 @@ void tst_QCommandLineParser::testDoubleDash()
QCOMPARE(parser.unknownOptionNames(), QStringList()); QCOMPARE(parser.unknownOptionNames(), QStringList());
} }
void tst_QCommandLineParser::testDefaultValue()
{
QCommandLineOption opt(QStringLiteral("name"), QStringLiteral("desc"),
QStringLiteral("valueName"), QStringLiteral("default"));
QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default")));
opt.setDefaultValue(QStringLiteral(""));
QCOMPARE(opt.defaultValues(), QStringList());
opt.setDefaultValue(QStringLiteral("default"));
QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default")));
}
void tst_QCommandLineParser::testProcessNotCalled() void tst_QCommandLineParser::testProcessNotCalled()
{ {
QCoreApplication app(empty_argc, empty_argv); QCoreApplication app(empty_argc, empty_argv);

View File

@ -56,6 +56,7 @@ private slots:
void createTest(); void createTest();
void nullTest(); void nullTest();
void dataStreamTest(); void dataStreamTest();
void isTimeZoneIdAvailable();
void availableTimeZoneIds(); void availableTimeZoneIds();
void stressTest(); void stressTest();
void windowsId(); void windowsId();
@ -347,6 +348,36 @@ void tst_QTimeZone::dataStreamTest()
QCOMPARE(tz2.id(), tz1.id()); QCOMPARE(tz2.id(), tz1.id());
} }
void tst_QTimeZone::isTimeZoneIdAvailable()
{
QList<QByteArray> available = QTimeZone::availableTimeZoneIds();
foreach (const QByteArray &id, available)
QVERIFY(QTimeZone::isTimeZoneIdAvailable(id));
// a-z, A-Z, 0-9, '.', '-', '_' are valid chars
// Can't start with '-'
// Parts separated by '/', each part min 1 and max of 14 chars
QCOMPARE(QTimeZonePrivate::isValidId("az"), true);
QCOMPARE(QTimeZonePrivate::isValidId("AZ"), true);
QCOMPARE(QTimeZonePrivate::isValidId("09"), true);
QCOMPARE(QTimeZonePrivate::isValidId("a/z"), true);
QCOMPARE(QTimeZonePrivate::isValidId("a.z"), true);
QCOMPARE(QTimeZonePrivate::isValidId("a-z"), true);
QCOMPARE(QTimeZonePrivate::isValidId("a_z"), true);
QCOMPARE(QTimeZonePrivate::isValidId(".z"), true);
QCOMPARE(QTimeZonePrivate::isValidId("_z"), true);
QCOMPARE(QTimeZonePrivate::isValidId("12345678901234"), true);
QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/12345678901234"), true);
QCOMPARE(QTimeZonePrivate::isValidId("a z"), false);
QCOMPARE(QTimeZonePrivate::isValidId("a\\z"), false);
QCOMPARE(QTimeZonePrivate::isValidId("a,z"), false);
QCOMPARE(QTimeZonePrivate::isValidId("/z"), false);
QCOMPARE(QTimeZonePrivate::isValidId("-z"), false);
QCOMPARE(QTimeZonePrivate::isValidId("123456789012345"), false);
QCOMPARE(QTimeZonePrivate::isValidId("123456789012345/12345678901234"), false);
QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/123456789012345"), false);
}
void tst_QTimeZone::availableTimeZoneIds() void tst_QTimeZone::availableTimeZoneIds()
{ {
if (debug) { if (debug) {

View File

@ -50,6 +50,7 @@
#include <QImageWriter> #include <QImageWriter>
#include <QPainter> #include <QPainter>
#include <QSet> #include <QSet>
#include <QTemporaryDir>
#ifdef Q_OS_UNIX // for geteuid() #ifdef Q_OS_UNIX // for geteuid()
# include <sys/types.h> # include <sys/types.h>
@ -84,6 +85,7 @@ private slots:
void supportedMimeTypes(); void supportedMimeTypes();
void writeToInvalidDevice(); void writeToInvalidDevice();
void testCanWrite();
void supportsOption_data(); void supportsOption_data();
void supportsOption(); void supportsOption();
@ -402,6 +404,28 @@ void tst_QImageWriter::writeToInvalidDevice()
} }
} }
void tst_QImageWriter::testCanWrite()
{
{
// device is not set
QImageWriter writer;
QVERIFY(!writer.canWrite());
QCOMPARE(writer.error(), QImageWriter::DeviceError);
}
{
// check if canWrite won't leave an empty file
QTemporaryDir dir;
QVERIFY(dir.isValid());
QString fileName(dir.path() + QLatin1String("/001.garble"));
QVERIFY(!QFileInfo(fileName).exists());
QImageWriter writer(fileName);
QVERIFY(!writer.canWrite());
QCOMPARE(writer.error(), QImageWriter::UnsupportedFormatError);
QVERIFY(!QFileInfo(fileName).exists());
}
}
void tst_QImageWriter::supportsOption_data() void tst_QImageWriter::supportsOption_data()
{ {
QTest::addColumn<QString>("fileName"); QTest::addColumn<QString>("fileName");

View File

@ -48,6 +48,7 @@
#include <qudpsocket.h> #include <qudpsocket.h>
#include <qhostaddress.h> #include <qhostaddress.h>
#include <qhostinfo.h> #include <qhostinfo.h>
#include <qtcpsocket.h>
#include <qmap.h> #include <qmap.h>
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QNetworkInterface> #include <QNetworkInterface>
@ -144,11 +145,25 @@ tst_QUdpSocket::~tst_QUdpSocket()
void tst_QUdpSocket::initTestCase_data() void tst_QUdpSocket::initTestCase_data()
{ {
// hack: we only enable the Socks5 over UDP tests on the old
// test server, because they fail on the new one. See QTBUG-35490
bool newTestServer = true;
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 22);
if (socket.waitForConnected(10000)) {
socket.waitForReadyRead(5000);
QByteArray ba = socket.readAll();
if (ba.startsWith("SSH-2.0-OpenSSH_5.8p1"))
newTestServer = false;
socket.disconnectFromHost();
}
QTest::addColumn<bool>("setProxy"); QTest::addColumn<bool>("setProxy");
QTest::addColumn<int>("proxyType"); QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0; QTest::newRow("WithoutProxy") << false << 0;
#ifndef QT_NO_SOCKS5 #ifndef QT_NO_SOCKS5
if (!newTestServer)
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
#endif #endif

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDbDCCAlSgAwIBAgIDAx2nMA0GCSqGSIb3DQEBBQUAMEsxCzAJBgNVBAYTAkZS
MQ4wDAYDVQQKEwVER1RQRTEsMCoGA1UEAxMjQUMgREdUUEUgU2lnbmF0dXJlIEF1
dGhlbnRpZmljYXRpb24wHhcNMTMwNzE4MTAwNTI4WhcNMTQwNzE4MTAwNTI4WjA+
MQswCQYDVQQGEwJGUjETMBEGA1UECgwKREcgVHLDqXNvcjEaMBgGA1UEAwwRQUMg
REcgVHLDqXNvciBTU0wwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDI
0WFSUyY+MmtFkqFjTefoFyDgh9b1C/2YvSIvT8oCH62JWT5rpeTCZwaXbqWcjaNf
zggqaFsokqfhBif43HNHNtNJmvKE32VcuLB0SpsLR/1VeTd9F99C1JeHVa+nelum
OHEfouX8rRFrxNXNIYTVeiENT8Y2YqRb/XAril9g7i674uFzLiNR/t/N/F8Exujv
9U8m8rmgud/+tG9WDRaDJwoj3ZFCOnL5qLnSUEcS6TzWpozLmC2JVO5GZKGGd7qC
9FjdBkVilkbVIEGSrYvz2Uz2v5IGqMBIQaFL/kSYWxGTaedTOk2drFEApp9AEPTf
v1NwCWBfegsGQrHUROM3AgMBAAGjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQQwHQYD
VR0OBBYEFAAMW8lJqJW0DtAv5p3Mjogxvh9lMB8GA1UdIwQYMBaAFOnbkI/9W5nk
FTvwYlyn5A1Y6IeZMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEA
tDfGHkHOLW2d9fiMtwtkEwDauISJLJyCjoRmawzmQbIZXq7HaLliVfE0sdfKUm0i
Q0im1/CpnJLPoTeKyBHvNu1ubLc2m+9dabAYhF3pVdKC+gNaAzBXZ9Gt0p1CLk1l
f8Hg+R10HN2IPCv7V/crz2Ga+c234P3pfwYW8+Nd7alGCuvqot6UYXOlheF7zWUk
Hn6z6tvY+9oMDHKSUAthhA/FB50JgJU89zyTv1egY3ldKwvYBW3W3yNZdTHbPyNs
PJdhqA55mDNsteE5YTp1PyySDb1MSVrbxDEruoH6ZE99Hob4Ih8Amn7MHZatGClE
CgjXWFZ2Gxa7OUCaQpcH8g==
-----END CERTIFICATE-----

View File

@ -4221,6 +4221,7 @@ void tst_QGraphicsItem::cursor()
QCursor cursor = view.viewport()->cursor(); QCursor cursor = view.viewport()->cursor();
{ {
QTest::mouseMove(view.viewport(), QPoint(100, 50));
QMouseEvent event(QEvent::MouseMove, QPoint(100, 50), Qt::NoButton, 0, 0); QMouseEvent event(QEvent::MouseMove, QPoint(100, 50), Qt::NoButton, 0, 0);
QApplication::sendEvent(view.viewport(), &event); QApplication::sendEvent(view.viewport(), &event);
} }

View File

@ -1289,7 +1289,7 @@ void tst_QAbstractItemView::task200665_itemEntered()
QSignalSpy spy(&view, SIGNAL(entered(QModelIndex))); QSignalSpy spy(&view, SIGNAL(entered(QModelIndex)));
view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
QCOMPARE(spy.count(), 1); QTRY_COMPARE(spy.count(), 1);
} }
void tst_QAbstractItemView::task257481_emptyEditor() void tst_QAbstractItemView::task257481_emptyEditor()

View File

@ -1043,13 +1043,14 @@ void tst_QColumnView::dynamicModelChanges()
ColumnView view; ColumnView view;
view.setModel(&model); view.setModel(&model);
view.setItemDelegate(&delegate); view.setItemDelegate(&delegate);
centerOnScreen(&view);
view.show(); view.show();
QStandardItem *item = new QStandardItem(QLatin1String("item")); QStandardItem *item = new QStandardItem(QLatin1String("item"));
model.appendRow(item); model.appendRow(item);
QTest::qWait(200); //let the time for painting to occur QVERIFY(QTest::qWaitForWindowExposed(&view)); //let the time for painting to occur
QCOMPARE(delegate.paintedIndexes.count(), 1); QTRY_COMPARE(delegate.paintedIndexes.count(), 1);
QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0)); QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0));

View File

@ -4573,7 +4573,6 @@ void tst_QWidget::setGeometry_win()
RECT rt; RECT rt;
::GetWindowRect(winHandleOf(&widget), &rt); ::GetWindowRect(winHandleOf(&widget), &rt);
QVERIFY(rt.left <= 0); QVERIFY(rt.left <= 0);
QEXPECT_FAIL("", "QTBUG-26424", Continue);
QVERIFY(rt.top <= 0); QVERIFY(rt.top <= 0);
} }
#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)

View File

@ -598,6 +598,7 @@ void tst_QMenu::layoutDirection()
centerOnScreen(&win); centerOnScreen(&win);
QMenu menu(&win); QMenu menu(&win);
menu.addAction("foo");
menu.move(win.geometry().topRight() + QPoint(50, 0)); menu.move(win.geometry().topRight() + QPoint(50, 0));
menu.show(); menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(QTest::qWaitForWindowExposed(&menu));

View File

@ -143,6 +143,8 @@ private slots:
void taskQTBUG_5008_textFromValueAndValidate(); void taskQTBUG_5008_textFromValueAndValidate();
void lineEditReturnPressed(); void lineEditReturnPressed();
void positiveSign();
void setGroupSeparatorShown_data(); void setGroupSeparatorShown_data();
void setGroupSeparatorShown(); void setGroupSeparatorShown();
@ -1118,6 +1120,21 @@ void tst_QSpinBox::lineEditReturnPressed()
QCOMPARE(spyCurrentChanged.count(), 1); QCOMPARE(spyCurrentChanged.count(), 1);
} }
void tst_QSpinBox::positiveSign()
{
QSpinBox spinBox;
spinBox.setRange(-20, 20);
spinBox.setValue(-20);
spinBox.show();
QVERIFY(QTest::qWaitForWindowActive(&spinBox));
QTest::keyClick(&spinBox, Qt::Key_End, Qt::ShiftModifier);
QTest::keyClick(&spinBox, Qt::Key_Plus, Qt::ShiftModifier);
QTest::keyClick(&spinBox, Qt::Key_2);
QTest::keyClick(&spinBox, Qt::Key_0);
QCOMPARE(spinBox.text(), QLatin1String("+20"));
}
void tst_QSpinBox::setGroupSeparatorShown_data() void tst_QSpinBox::setGroupSeparatorShown_data()
{ {
QTest::addColumn<QLocale::Language>("lang"); QTest::addColumn<QLocale::Language>("lang");

Some files were not shown because too many files have changed in this diff Show More