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

Conflicts:
	mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/corelib/global/qnamespace.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qfsfileengine_win.cpp
	src/corelib/tools/tools.pri
	src/network/ssl/qsslconfiguration_p.h
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/plugins/platforms/windows/windows.pri
	src/src.pro
	src/tools/bootstrap/bootstrap.pro
	src/tools/uic/cpp/cppwriteinitialization.cpp
	src/widgets/dialogs/qfilesystemmodel.cpp
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt

Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
This commit is contained in:
Liang Qi 2016-05-20 13:46:21 +02:00 committed by Oswald Buddenhagen
commit 56d6e000f7
224 changed files with 2056 additions and 997 deletions

View File

@ -1,5 +1,4 @@
load(qt_build_config) load(qt_build_config)
CONFIG += qt_example_installs
CONFIG += warning_clean CONFIG += warning_clean
QT_SOURCE_TREE = $$PWD QT_SOURCE_TREE = $$PWD

View File

@ -43,6 +43,8 @@
int main(int, char **) int main(int, char **)
{ {
fbGetDisplay(); // Do not rely on fbGetDisplay() since the signature has changed over time.
// Stick to fbGetDisplayByIndex().
fbGetDisplayByIndex(0);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
SOURCES = kms.cpp SOURCES = kms.cpp
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG += libdrm libudev PKGCONFIG += libdrm
CONFIG -= qt CONFIG -= qt

View File

@ -66,9 +66,6 @@ while [ "$#" -gt 0 ]; do
shift shift
done done
# debuggery
[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION auto-detection... ($*)"
test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST"
cd "$OUTDIR/$TEST" cd "$OUTDIR/$TEST"
@ -96,6 +93,7 @@ set -- \
"$SRCDIR/$TEST/$EXE.pro" \ "$SRCDIR/$TEST/$EXE.pro" \
-o "$OUTDIR/$TEST/Makefile" -o "$OUTDIR/$TEST/Makefile"
if [ "$VERBOSE" = "yes" ]; then if [ "$VERBOSE" = "yes" ]; then
echo
OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes
else else
OUTDIR=$OUTDIR "$@" >/dev/null 2>&1 && $MAKE >/dev/null 2>&1 && SUCCESS=yes OUTDIR=$OUTDIR "$@" >/dev/null 2>&1 && $MAKE >/dev/null 2>&1 && SUCCESS=yes
@ -103,9 +101,9 @@ fi
# done # done
if [ "$SUCCESS" != "yes" ]; then if [ "$SUCCESS" != "yes" ]; then
[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled." [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled." || echo " no."
exit 1 exit 1
else else
[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled." [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled." || echo " yes."
exit 0 exit 0
fi fi

49
configure vendored
View File

@ -91,6 +91,7 @@ for i in "$@"; do
done done
# initialize global variables # initialize global variables
CONFIG_SEPARATORS=`printf ' \t'`
QMAKE_SWITCHES= QMAKE_SWITCHES=
QMAKE_VARS= QMAKE_VARS=
QMAKE_CONFIG= QMAKE_CONFIG=
@ -354,6 +355,21 @@ getXQMakeConf()
getSingleQMakeVariable "$1" "$xspecvals" getSingleQMakeVariable "$1" "$xspecvals"
} }
testXConfig()
{
# Put a space on each end of the CONFIG value so that searching for the
# target with whitespace on either side will work even when it's the
# first/last/only item in the CONFIG value.
case \ `getXQMakeConf CONFIG`\ in
*[${CONFIG_SEPARATORS}]$1[${CONFIG_SEPARATORS}]*)
return 0
;;
*)
return 1
;;
esac
}
compilerSupportsFlag() compilerSupportsFlag()
{ {
cat >conftest.cpp <<EOF cat >conftest.cpp <<EOF
@ -3248,7 +3264,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_LFLAGS setBootstrapVariable QMAKE_LFLAGS
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then if [ "$CFG_DEBUG" = "no" ] || [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
setBootstrapVariable QMAKE_CFLAGS_RELEASE setBootstrapVariable QMAKE_CFLAGS_RELEASE
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)" EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
@ -3260,12 +3276,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)" EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
fi fi
if [ -n "$RPATH_FLAGS" ] && [ -n "`getQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" QMAKE_LFLAGS_RPATH
for rpath in $RPATH_FLAGS; do
EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
done
fi
case `basename "$PLATFORM"` in case `basename "$PLATFORM"` in
win32-g++*) win32-g++*)
EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE" EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE"
@ -3316,9 +3326,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \ \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\"" \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\""
fi fi
if [ '!' -z "$D_FLAGS" ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $D_FLAGS"
fi
echo >>"$mkfile" echo >>"$mkfile"
adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'` adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
@ -3547,6 +3554,7 @@ compileTest()
if [ "$CFG_SHARED" = "no" ]; then if [ "$CFG_SHARED" = "no" ]; then
test_config="$QMAKE_CONFIG static" test_config="$QMAKE_CONFIG static"
fi fi
echo $ECHO_N "checking for $name... $ECHO_C"
"$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" "$CFG_QMAKE_PATH" "$QTCONFFILE" $I_FLAGS $D_FLAGS $L_FLAGS "$@" "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" "$CFG_QMAKE_PATH" "$QTCONFFILE" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
} }
@ -4679,6 +4687,7 @@ if [ "$CFG_OPENGL" = "es2" ]; then
fi fi
# auto-detect FontConfig support # auto-detect FontConfig support
ORIG_CFG_FREETYPE="$CFG_FREETYPE"
if [ "$CFG_FONTCONFIG" != "no" ]; then if [ "$CFG_FONTCONFIG" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
QMAKE_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null` QMAKE_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
@ -4865,6 +4874,11 @@ if [ "$CFG_XCB" != "no" ]; then
if [ "$CFG_XCB" = "qt" ]; then if [ "$CFG_XCB" = "qt" ]; then
QT_CONFIG="$QT_CONFIG xcb-qt" QT_CONFIG="$QT_CONFIG xcb-qt"
if compileTest qpa/xcb-glx "xcb-glx" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
CFG_XCB_GLX=yes
QT_CONFIG="$QT_CONFIG xcb-glx"
fi
else else
CFG_XCB="system" CFG_XCB="system"
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
@ -5599,7 +5613,11 @@ fi
[ "$CFG_STACK_PROTECTOR_STRONG" = "yes" ] && QT_CONFIG="$QT_CONFIG stack-protector-strong" [ "$CFG_STACK_PROTECTOR_STRONG" = "yes" ] && QT_CONFIG="$QT_CONFIG stack-protector-strong"
[ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations" [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
[ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip" [ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip"
[ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header" if testXConfig precompile_header; then
[ "$CFG_PRECOMPILE" = "no" ] && QMakeVar del CONFIG precompile_header
else
[ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
fi
[ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker" [ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker"
[ "$CFG_ENABLE_NEW_DTAGS" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG enable_new_dtags" [ "$CFG_ENABLE_NEW_DTAGS" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG enable_new_dtags"
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
@ -6516,6 +6534,15 @@ if [ "$CFG_SHARED" = "no" ]; then
echo "loaded plugins. Make sure to import all needed static plugins," echo "loaded plugins. Make sure to import all needed static plugins,"
echo "or compile needed modules into the library." echo "or compile needed modules into the library."
fi fi
if [ "$CFG_FREETYPE" = "system" ]; then
if [ "$ORIG_CFG_FREETYPE" = "qt" ]; then
echo
echo "WARNING: Bundled FreeType can't be used. FontConfig use requires system FreeType."
elif [ "$ORIG_CFG_FREETYPE" = "no" ]; then
echo
echo "WARNING: FreeType can't be disabled. FontConfig use requires system FreeType."
fi
fi
if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
echo echo
echo "NOTE: When linking against OpenSSL, you can override the default" echo "NOTE: When linking against OpenSSL, you can override the default"

View File

@ -11,3 +11,6 @@ SOURCES += \
HEADERS += \ HEADERS += \
mimetypemodel.h \ mimetypemodel.h \
mainwindow.h mainwindow.h
target.path = $$[QT_INSTALL_EXAMPLES]/corelib/mimetypes/mimetypebrowser
INSTALLS += target

View File

@ -51,6 +51,7 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QFileSystemModel> #include <QFileSystemModel>
#include <QFileIconProvider>
#include <QTreeView> #include <QTreeView>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QCommandLineOption> #include <QCommandLineOption>
@ -64,6 +65,8 @@ int main(int argc, char *argv[])
parser.setApplicationDescription("Qt Dir View Example"); parser.setApplicationDescription("Qt Dir View Example");
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
QCommandLineOption dontUseCustomDirectoryIconsOption("c", "Set QFileIconProvider::DontUseCustomDirectoryIcons");
parser.addOption(dontUseCustomDirectoryIconsOption);
parser.addPositionalArgument("directory", "The directory to start in."); parser.addPositionalArgument("directory", "The directory to start in.");
parser.process(app); parser.process(app);
const QString rootPath = parser.positionalArguments().isEmpty() const QString rootPath = parser.positionalArguments().isEmpty()
@ -71,6 +74,8 @@ int main(int argc, char *argv[])
QFileSystemModel model; QFileSystemModel model;
model.setRootPath(""); model.setRootPath("");
if (parser.isSet(dontUseCustomDirectoryIconsOption))
model.iconProvider()->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
QTreeView tree; QTreeView tree;
tree.setModel(&model); tree.setModel(&model);
if (!rootPath.isEmpty()) { if (!rootPath.isEmpty()) {

View File

@ -1,6 +1,23 @@
# #
# qmake configuration for the Freescale iMX6 boards (single, dual and quad) # qmake configuration for the Freescale iMX6 boards (single, dual and quad)
# #
# The configuration below is set up for running with EGL on the framebuffer via
# the eglfs platform plugin and its eglfs_viv backend.
# Wayland is also fully functional out of the box. However, when writing Wayland
# *compositors* with Qt, the eglfs backend will have to be switched to
# eglfs_viv_wl by setting the QT_QPA_EGLFS_INTEGRATION environment variable.
#
# Below is an example configure line that assumes the SDK is in
# $HOME/imx6/toolchain. On device Qt is expected to be placed under
# /usr/local/qt5 whereas on the host 'make install' will copy the host tools and
# the target libraries to $HOME/imx6/qt5.
#
# ./configure -prefix /usr/local/qt5 -extprefix $HOME/imx6/qt5 -device linux-imx6-g++ \
# -device-option CROSS_COMPILE=$HOME/imx6/toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- \
# -sysroot $HOME/imx6/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi \
# -nomake examples -nomake tests -v
#
include(../common/linux_device_pre.conf) include(../common/linux_device_pre.conf)

View File

@ -1,9 +1,7 @@
QMAKE_MAKE = $$(MAKE) QMAKE_MAKE = $$(MAKE)
!isEmpty(QMAKE_MAKE) { !isEmpty(QMAKE_MAKE) {
# We were called recursively. Use the right make, as MAKEFLAGS may be set as well. # We were called recursively. Use the right make, as MAKEFLAGS may be set as well.
} else:equals(MAKEFILE_GENERATOR, UNIX) { } else:if(equals(MAKEFILE_GENERATOR, UNIX)|equals(MAKEFILE_GENERATOR, MINGW)) {
QMAKE_MAKE = make
} else:equals(MAKEFILE_GENERATOR, MINGW) {
!equals(QMAKE_HOST.os, Windows): \ !equals(QMAKE_HOST.os, Windows): \
QMAKE_MAKE = make QMAKE_MAKE = make
else: \ else: \

View File

@ -11,9 +11,13 @@
lex.variable_out = GENERATED_SOURCES lex.variable_out = GENERATED_SOURCES
} }
isEmpty(QMAKE_LEXFLAGS_MANGLE):QMAKE_LEXFLAGS_MANGLE = -P${QMAKE_FILE_BASE}
QMAKE_LEXEXTRAFLAGS = $$QMAKE_LEXFLAGS
!yacc_no_name_mangle:QMAKE_LEXEXTRAFLAGS += $$QMAKE_LEXFLAGS_MANGLE
contains(QMAKE_LEX, .*flex) { contains(QMAKE_LEX, .*flex) {
# GNU flex, we can use -o outfile # GNU flex, we can use -o outfile
lex.commands = $$QMAKE_LEX $$QMAKE_LEXFLAGS --nounistd -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} lex.commands = $$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS --nounistd -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
} else { } else {
# stupid POSIX lex, it only generates a file called lex.yy.c # stupid POSIX lex, it only generates a file called lex.yy.c
# or lex.prefix.c if the -P<prefix> option is active # or lex.prefix.c if the -P<prefix> option is active

View File

@ -15,8 +15,7 @@ TEMPLATE = lib
CONFIG += plugin CONFIG += plugin
if(win32|mac):!macx-xcode { if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, build_all):CONFIG += build_all
} }
CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable

View File

@ -28,7 +28,7 @@ host_build:force_bootstrap {
} }
target.path = $$[QT_HOST_BINS] target.path = $$[QT_HOST_BINS]
} else { } else {
!build_pass:contains(QT_CONFIG, debug_and_release):contains(QT_CONFIG, build_all): CONFIG += release !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
target.path = $$[QT_INSTALL_BINS] target.path = $$[QT_INSTALL_BINS]
CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable
} }

View File

@ -71,6 +71,7 @@ CONFIG += \
create_prl link_prl \ create_prl link_prl \
prepare_docs qt_docs_targets \ prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \ no_private_qt_headers_warning QTDIR_build \
qt_example_installs \
# Qt modules get compiled without exceptions enabled by default. # Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with exceptions. # However, testcases should be still built with exceptions.
exceptions_off testcase_exceptions exceptions_off testcase_exceptions

View File

@ -100,6 +100,20 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
!isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles") !isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles")
} }
equals(TEMPLATE, app)|equals(TEMPLATE, lib) {
!contains(INSTALLS, target) {
!install_ok: \
error("$$_PRO_FILE_ is lacking an install target.")
else: check_examples: \
warning("$$_PRO_FILE_ is lacking an install target.")
} else: !equals(target.path, $$sources.path) {
!install_ok: \
error("$$_PRO_FILE_ installs target to unexpected location.")
else: check_examples: \
warning("$$_PRO_FILE_ installs target to unexpected location.")
}
}
!equals(TEMPLATE, subdirs):!compile_examples { !equals(TEMPLATE, subdirs):!compile_examples {
TEMPLATE = aux TEMPLATE = aux
CONFIG -= have_target qt staticlib dll CONFIG -= have_target qt staticlib dll

View File

@ -13,12 +13,12 @@ load(qt_build_paths)
TEMPLATE = lib TEMPLATE = lib
CONFIG -= qt CONFIG -= qt
QT = # In case qt is re-added.
CONFIG -= warning_clean # Don't presume 3rd party code to be clean CONFIG -= warning_clean # Don't presume 3rd party code to be clean
load(qt_common) load(qt_common)
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, build_all): CONFIG += build_all
DESTDIR = $$MODULE_BASE_OUTDIR/lib DESTDIR = $$MODULE_BASE_OUTDIR/lib
DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin

View File

@ -38,7 +38,7 @@ host_build {
QT += bootstrap-private QT += bootstrap-private
} }
} else { } else {
!build_pass:contains(QT_CONFIG, build_all): CONFIG += release !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
} }
} }
@ -89,8 +89,7 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.inclu
# If Qt was configured with -debug-and-release then build the module the same way # If Qt was configured with -debug-and-release then build the module the same way
# - unless this is a host library # - unless this is a host library
!host_build:if(win32|mac):!macx-xcode { !host_build:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, build_all):CONFIG += build_all
} }
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -188,6 +188,16 @@ headersclean:!internal_module {
!contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \ !contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \
hcleanFLAGS += -Wcast-align hcleanFLAGS += -Wcast-align
!clang {
# options accepted only by GCC
c++11 {
# only enabled for actual c++11 builds due to
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52806
hcleanFLAGS += -Wzero-as-null-pointer-constant
}
}
} }
# Use strict mode C++11 or C++98, with no GNU extensions (see -pedantic-errors above). # Use strict mode C++11 or C++98, with no GNU extensions (see -pedantic-errors above).

View File

@ -24,10 +24,9 @@ win32:CONFIG(shared, static|shared) {
} }
tool_plugin { tool_plugin {
!build_pass:contains(QT_CONFIG, build_all): CONFIG += release !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
} else:if(win32|mac):!macx-xcode { } else:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, build_all):CONFIG += build_all
} }
CONFIG += relative_qt_rpath # Qt's plugins should be relocatable CONFIG += relative_qt_rpath # Qt's plugins should be relocatable

View File

@ -105,6 +105,7 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DQT_NO_FOREACH \
-DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS) CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS)

View File

@ -49,6 +49,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DQT_NO_FOREACH \
-DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
CFLAGS = $(CFLAGS_PCH) $(CFLAGS_BARE) $(CFLAGS) CFLAGS = $(CFLAGS_PCH) $(CFLAGS_BARE) $(CFLAGS)

View File

@ -1296,7 +1296,7 @@ void VcprojGenerator::initDeploymentTool()
if (foundGuid || dllName.contains(QLatin1String("Gui"))) { if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
QFileInfo info2; QFileInfo info2;
foreach (const ProString &dllPath, dllPaths) { for (const ProString &dllPath : dllPaths) {
QString absoluteDllFilePath = dllPath.toQString(); QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/'))) if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/'); absoluteDllFilePath += QLatin1Char('/');

View File

@ -130,8 +130,9 @@ public:
bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; } bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; }
bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; } bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; }
bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; } bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; }
int toInt(bool *ok = 0, int base = 10) const { return toQString().toInt(ok, base); } // XXX optimize int toLongLong(bool *ok = 0, int base = 10) const { return toQStringRef().toLongLong(ok, base); }
short toShort(bool *ok = 0, int base = 10) const { return toQString().toShort(ok, base); } // XXX optimize int toInt(bool *ok = 0, int base = 10) const { return toQStringRef().toInt(ok, base); }
short toShort(bool *ok = 0, int base = 10) const { return toQStringRef().toShort(ok, base); }
uint hash() const { return m_hash; } uint hash() const { return m_hash; }
static uint hash(const QChar *p, int n); static uint hash(const QChar *p, int n);

View File

@ -192,9 +192,8 @@ void QMakeEvaluator::initFunctionStatics()
statics.functions.insert(ProKey(testInits[i].name), testInits[i].func); statics.functions.insert(ProKey(testInits[i].name), testInits[i].func);
} }
static bool isTrue(const ProString &_str, QString &tmp) static bool isTrue(const ProString &str)
{ {
const QString &str = _str.toQString(tmp);
return !str.compare(statics.strtrue, Qt::CaseInsensitive) || str.toInt(); return !str.compare(statics.strtrue, Qt::CaseInsensitive) || str.toInt();
} }
@ -478,9 +477,9 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
} else { } else {
var = args[0]; var = args[0];
sep = args.at(1).toQString(); sep = args.at(1).toQString();
beg = args.at(2).toQString(m_tmp2).toInt(); beg = args.at(2).toInt();
if (args.count() == 4) if (args.count() == 4)
end = args.at(3).toQString(m_tmp2).toInt(); end = args.at(3).toInt();
} }
} else { } else {
if (args.count() != 1) { if (args.count() != 1) {
@ -562,7 +561,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break; break;
} }
bool ok; bool ok;
qlonglong num = m_tmp3.toLongLong(&ok, ibase); qlonglong num = args.at(0).toLongLong(&ok, ibase);
if (!ok) { if (!ok) {
evalError(fL1S("format_number(): malformed number %2 for base %1.") evalError(fL1S("format_number(): malformed number %2 for base %1.")
.arg(ibase).arg(m_tmp3)); .arg(ibase).arg(m_tmp3));
@ -639,7 +638,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
const ProStringList &var = values(map(args.at(0))); const ProStringList &var = values(map(args.at(0)));
int start = 0, end = 0; int start = 0, end = 0;
if (args.count() >= 2) { if (args.count() >= 2) {
const QString &start_str = args.at(1).toQString(m_tmp1); const ProString &start_str = args.at(1);
start = start_str.toInt(&ok); start = start_str.toInt(&ok);
if (!ok) { if (!ok) {
if (args.count() == 2) { if (args.count() == 2) {
@ -652,11 +651,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
} }
if (!ok) if (!ok)
evalError(fL1S("member() argument 2 (start) '%2' invalid.") evalError(fL1S("member() argument 2 (start) '%2' invalid.")
.arg(start_str)); .arg(start_str.toQString(m_tmp1)));
} else { } else {
end = start; end = start;
if (args.count() == 3) if (args.count() == 3)
end = args.at(2).toQString(m_tmp1).toInt(&ok); end = args.at(2).toInt(&ok);
if (!ok) if (!ok)
evalError(fL1S("member() argument 3 (end) '%2' invalid.") evalError(fL1S("member() argument 3 (end) '%2' invalid.")
.arg(args.at(2).toQString(m_tmp1))); .arg(args.at(2).toQString(m_tmp1)));
@ -904,7 +903,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
} else { } else {
bool recursive = false; bool recursive = false;
if (args.count() == 2) if (args.count() == 2)
recursive = isTrue(args.at(1), m_tmp2); recursive = isTrue(args.at(1));
QStringList dirs; QStringList dirs;
QString r = m_option->expandEnvVars(args.at(0).toQString(m_tmp1)) QString r = m_option->expandEnvVars(args.at(0).toQString(m_tmp1))
.replace(QLatin1Char('\\'), QLatin1Char('/')); .replace(QLatin1Char('\\'), QLatin1Char('/'));
@ -1292,7 +1291,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse; return ReturnFalse;
} }
int cnt = values(map(args.at(0))).count(); int cnt = values(map(args.at(0))).count();
int val = args.at(1).toQString(m_tmp1).toInt(); int val = args.at(1).toInt();
if (args.count() == 3) { if (args.count() == 3) {
const ProString &comp = args.at(2); const ProString &comp = args.at(2);
if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) { if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) {
@ -1403,7 +1402,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
flags = LoadSilent; flags = LoadSilent;
if (args.count() >= 2) { if (args.count() >= 2) {
parseInto = args.at(1).toQString(m_tmp2); parseInto = args.at(1).toQString(m_tmp2);
if (args.count() >= 3 && isTrue(args.at(2), m_tmp3)) if (args.count() >= 3 && isTrue(args.at(2)))
flags = LoadSilent; flags = LoadSilent;
} }
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1))); QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
@ -1441,7 +1440,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_LOAD: { case T_LOAD: {
bool ignore_error = false; bool ignore_error = false;
if (args.count() == 2) { if (args.count() == 2) {
ignore_error = isTrue(args.at(1), m_tmp2); ignore_error = isTrue(args.at(1));
} else if (args.count() != 1) { } else if (args.count() != 1) {
evalError(fL1S("load(feature) requires one or two arguments.")); evalError(fL1S("load(feature) requires one or two arguments."));
return ReturnFalse; return ReturnFalse;

View File

@ -7,6 +7,7 @@ CONFIG += console bootstrap
CONFIG -= qt CONFIG -= qt
DEFINES += \ DEFINES += \
QT_BUILD_QMAKE \ QT_BUILD_QMAKE \
QT_NO_FOREACH \
PROEVALUATOR_FULL PROEVALUATOR_FULL
VPATH += \ VPATH += \

View File

@ -2618,12 +2618,15 @@ bool Renderer11::getShareHandleSupport() const
return false; return false;
} }
// Qt: we don't care about the 9_3 limitation
#if 0
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains. // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3) if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{ {
mSupportsShareHandles = false; mSupportsShareHandles = false;
return false; return false;
} }
#endif
// Find out which type of D3D11 device the Renderer11 is using // Find out which type of D3D11 device the Renderer11 is using
d3d11::ANGLED3D11DeviceType deviceType = getDeviceType(); d3d11::ANGLED3D11DeviceType deviceType = getDeviceType();

View File

@ -642,11 +642,14 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
return Error(EGL_BAD_ATTRIBUTE); return Error(EGL_BAD_ATTRIBUTE);
} }
// On Windows Store, we know the originating texture came from D3D11, so bypass this check
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
const Caps &caps = display->getCaps(); const Caps &caps = display->getCaps();
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height))) if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
{ {
return Error(EGL_BAD_MATCH); return Error(EGL_BAD_MATCH);
} }
#endif
} }
return Error(EGL_SUCCESS); return Error(EGL_SUCCESS);

View File

@ -64,10 +64,10 @@ win32 {
INCLUDEPATH += $$PWD/include INCLUDEPATH += $$PWD/include
DEFINES += FT2_BUILD_LIBRARY DEFINES += FT2_BUILD_LIBRARY
contains(QT_CONFIG, system-zlib) {
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include($$PWD/../zlib_dependency.pri) include(../zlib_dependency.pri)
}
contains(QT_CONFIG, system-png) { contains(QT_CONFIG, system-png) {
DEFINES += FT_CONFIG_OPTION_USE_PNG DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri) include($$PWD/../png_dependency.pri)

View File

@ -7,4 +7,8 @@ contains(QT_CONFIG, system-zlib) {
} }
} else { } else {
INCLUDEPATH += $$PWD/zlib INCLUDEPATH += $$PWD/zlib
!no_core_dep {
CONFIG += qt
QT_PRIVATE += core
}
} }

View File

@ -0,0 +1,57 @@
From 5cacddc702624d64a4917a7a704dbbb92aeba53c Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Thu, 19 May 2016 10:55:46 +0200
Subject: [PATCH] ANGLE: fixed usage of shared handles for WinRT/WinPhone
applications
Both checks are not relevant in Qt's context and were skipped before but
they sneaked back in with the latest ANGLE update.
Change-Id: Ic44de5468a3254afd76ef4804d97d245676daeb1
---
src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 3 +++
src/3rdparty/angle/src/libANGLE/validationEGL.cpp | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 62badcc..0173311 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2618,12 +2618,15 @@ bool Renderer11::getShareHandleSupport() const
return false;
}
+ // Qt: we don't care about the 9_3 limitation
+#if 0
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
mSupportsShareHandles = false;
return false;
}
+#endif
// Find out which type of D3D11 device the Renderer11 is using
d3d11::ANGLED3D11DeviceType deviceType = getDeviceType();
diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
index 972f6a7..903f51b 100644
--- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
+++ b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
@@ -642,11 +642,14 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
return Error(EGL_BAD_ATTRIBUTE);
}
+// On Windows Store, we know the originating texture came from D3D11, so bypass this check
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
const Caps &caps = display->getCaps();
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
{
return Error(EGL_BAD_MATCH);
}
+#endif
}
return Error(EGL_SUCCESS);
--
2.7.0.windows.1

View File

@ -0,0 +1,44 @@
From db13a9cf7e41207660f080827983655864df802d Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Wed, 11 May 2016 13:51:54 +0200
Subject: [PATCH] ANGLE: Disable support for shared handles in warp mode on
Windows < 8
Shared handles are not supported on Windows 7 and below. If the
according flag is set CreateTexture2D will fail with E_OUTOFMEMORY. The
check already happens with newer ANGLE versions, which we use in 5.7
but has to happen here as well. Otherwise Qt applications running on
Windows 7 and below will crash at startup.
Change-Id: I8f539f16dce298611fb1ec7b2f6804d4a04d04e0
---
.../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 223e2b0..dd554f4 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2370,6 +2370,19 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const
bool Renderer11::getShareHandleSupport() const
{
+ if (mDriverType == D3D_DRIVER_TYPE_WARP)
+ {
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ // Warp mode does not support shared handles in Windows versions below Windows 8
+ OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
+ if (GetVersionEx(&result) &&
+ ((result.dwMajorVersion == 6 && result.dwMinorVersion < 2) || result.dwMajorVersion < 6))
+ {
+ // WARP on Windows 7 doesn't support shared handles
+ return false;
+ }
+#endif // ANGLE_ENABLE_WINDOWS_STORE
+ }
// We only currently support share handles with BGRA surfaces, because
// chrome needs BGRA. Once chrome fixes this, we should always support them.
// PIX doesn't seem to support using share handles, so disable them.
--
2.7.0.windows.1

View File

@ -2,7 +2,8 @@ TARGET = QtConcurrent
QT = core-private QT = core-private
CONFIG += exceptions CONFIG += exceptions
DEFINES += QT_NO_USING_NAMESPACE DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf

View File

@ -4,7 +4,7 @@ project = QtConcurrent
description = Qt Concurrent Reference Documentation description = Qt Concurrent Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/qtconcurrent examplesinstallpath = qtconcurrent
qhp.projects = QtConcurrent qhp.projects = QtConcurrent

View File

@ -8,7 +8,7 @@ MODULE_CONFIG = moc resources
CONFIG += $$MODULE_CONFIG CONFIG += $$MODULE_CONFIG
DEFINES += $$MODULE_DEFINES DEFINES += $$MODULE_DEFINES
DEFINES += QT_NO_USING_NAMESPACE DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused

View File

@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation description = Qt Core Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/corelib examplesinstallpath = corelib
qhp.projects = QtCore qhp.projects = QtCore

View File

@ -61,6 +61,9 @@
#include <QtCore/qfeatures.h> #include <QtCore/qfeatures.h>
#endif #endif
// The QT_SUPPORTS macro is deprecated. Don't use it in new code.
// Instead, use #ifdef/ndef QT_NO_feature.
// ### Qt6: remove macro
#ifdef _MSC_VER #ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE) # define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else #else
@ -920,6 +923,8 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
# endif # endif
#endif #endif
#ifndef QT_NO_FOREACH
template <typename T> template <typename T>
class QForeachContainer { class QForeachContainer {
QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE; QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE;
@ -945,11 +950,15 @@ for (QForeachContainer<typename QtPrivate::remove_reference<decltype(container)>
++_container_.i, _container_.control ^= 1) \ ++_container_.i, _container_.control ^= 1) \
for (variable = *_container_.i; _container_.control; _container_.control = 0) for (variable = *_container_.i; _container_.control; _container_.control = 0)
#endif // QT_NO_FOREACH
#define Q_FOREVER for(;;) #define Q_FOREVER for(;;)
#ifndef QT_NO_KEYWORDS #ifndef QT_NO_KEYWORDS
# ifndef QT_NO_FOREACH
# ifndef foreach # ifndef foreach
# define foreach Q_FOREACH # define foreach Q_FOREACH
# endif # endif
# endif // QT_NO_FOREACH
# ifndef forever # ifndef forever
# define forever Q_FOREVER # define forever Q_FOREVER
# endif # endif

View File

@ -54,6 +54,7 @@
#include "qthread.h" #include "qthread.h"
#include "private/qloggingregistry_p.h" #include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h" #include "private/qcoreapplication_p.h"
#include "private/qsimd_p.h"
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> #include <qt_windows.h>
@ -1193,6 +1194,89 @@ void QMessagePattern::setPattern(const QString &pattern)
memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*)); memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*));
} }
#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
// make sure the function has "Message" in the name so the function is removed
#if (defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)
// force skipping the frame pointer, to save the backtrace() function some work
__attribute__((optimize("omit-frame-pointer")))
#endif
static QStringList backtraceFramesForLogMessage(int frameCount)
{
QStringList result;
if (frameCount == 0)
return result;
// The results of backtrace_symbols looks like this:
// /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
// The offset and function name are optional.
// This regexp tries to extract the library name (without the path) and the function name.
// This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
QRegularExpression::OptimizeOnFirstUsageOption);
QVarLengthArray<void*, 32> buffer(7 + frameCount);
int n = backtrace(buffer.data(), buffer.size());
if (n > 0) {
int numberPrinted = 0;
for (int i = 0; i < n && numberPrinted < frameCount; ++i) {
QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
QString trace = QString::fromLatin1(strings.data()[0]);
QRegularExpressionMatch m = rx.match(trace);
if (m.hasMatch()) {
QString library = m.captured(1);
QString function = m.captured(2);
// skip the trace from QtCore that are because of the qDebug itself
if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
&& (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
|| function.contains(QLatin1String("QDebug")))) {
continue;
}
if (function.startsWith(QLatin1String("_Z"))) {
QScopedPointer<char, QScopedPointerPodDeleter> demangled(
abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
if (demangled)
function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
}
if (function.isEmpty()) {
result.append(QLatin1Char('?') + library + QLatin1Char('?'));
} else {
result.append(function);
}
} else {
if (numberPrinted == 0) {
// innermost, unknown frames are usually the logging framework itself
continue;
}
result.append(QStringLiteral("???"));
}
numberPrinted++;
}
}
return result;
}
static QString formatBacktraceForLogMessage(const QMessagePattern::BacktraceParams backtraceParams,
const char *function)
{
QString backtraceSeparator = backtraceParams.backtraceSeparator;
int backtraceDepth = backtraceParams.backtraceDepth;
QStringList frames = backtraceFramesForLogMessage(backtraceDepth);
if (frames.isEmpty())
return QString();
// if the first frame is unknown, replace it with the context function
if (function && frames.at(0).startsWith(QLatin1Char('?')))
frames[0] = QString::fromUtf8(qCleanupFuncinfo(function));
return frames.join(backtraceSeparator);
}
#endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED
#if defined(QT_USE_SLOG2) #if defined(QT_USE_SLOG2)
#ifndef QT_LOG_CODE #ifndef QT_LOG_CODE
#define QT_LOG_CODE 9000 #define QT_LOG_CODE 9000
@ -1336,62 +1420,8 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
#ifdef QLOGGING_HAVE_BACKTRACE #ifdef QLOGGING_HAVE_BACKTRACE
} else if (token == backtraceTokenC) { } else if (token == backtraceTokenC) {
QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx); QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx);
QString backtraceSeparator = backtraceParams.backtraceSeparator;
int backtraceDepth = backtraceParams.backtraceDepth;
backtraceArgsIdx++; backtraceArgsIdx++;
QVarLengthArray<void*, 32> buffer(7 + backtraceDepth); message.append(formatBacktraceForLogMessage(backtraceParams, context.function));
int n = backtrace(buffer.data(), buffer.size());
if (n > 0) {
int numberPrinted = 0;
for (int i = 0; i < n && numberPrinted < backtraceDepth; ++i) {
QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
QString trace = QString::fromLatin1(strings.data()[0]);
// The results of backtrace_symbols looks like this:
// /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
// The offset and function name are optional.
// This regexp tries to extract the librry name (without the path) and the function name.
// This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
QRegularExpression::OptimizeOnFirstUsageOption);
QRegularExpressionMatch m = rx.match(trace);
if (m.hasMatch()) {
// skip the trace from QtCore that are because of the qDebug itself
QString library = m.captured(1);
QString function = m.captured(2);
if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
&& (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
|| function.contains(QLatin1String("QDebug")))) {
continue;
}
if (function.startsWith(QLatin1String("_Z"))) {
QScopedPointer<char, QScopedPointerPodDeleter> demangled(
abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
if (demangled)
function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
}
if (numberPrinted > 0)
message.append(backtraceSeparator);
if (function.isEmpty()) {
if (numberPrinted == 0 && context.function)
message += QString::fromUtf8(qCleanupFuncinfo(context.function));
else
message += QLatin1Char('?') + library + QLatin1Char('?');
} else {
message += function;
}
} else {
if (numberPrinted == 0)
continue;
message += backtraceSeparator + QLatin1String("???");
}
numberPrinted++;
}
}
#endif #endif
} else if (token == timeTokenC) { } else if (token == timeTokenC) {
QString timeFormat = pattern->timeArgs.at(timeArgsIdx); QString timeFormat = pattern->timeArgs.at(timeArgsIdx);

View File

@ -503,7 +503,8 @@ public:
AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me
AA_DontUseNativeDialogs = 23, AA_DontUseNativeDialogs = 23,
AA_SynthesizeMouseForUnhandledTabletEvents = 24, AA_SynthesizeMouseForUnhandledTabletEvents = 24,
AA_DontCheckOpenGLContextThreadAffinity = 25, AA_CompressHighFrequencyEvents = 25,
AA_DontCheckOpenGLContextThreadAffinity = 26,
// Add new attributes before this line // Add new attributes before this line
AA_AttributeCount AA_AttributeCount

View File

@ -239,6 +239,17 @@
to mouse events instead. This attribute is enabled to mouse events instead. This attribute is enabled
by default. This value has been added in Qt 5.7. by default. This value has been added in Qt 5.7.
\value AA_CompressHighFrequencyEvents Enables compression of certain frequent events.
On the X11 windowing system, the default value is true, which means that
QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and
position will be combined whenever they occur more frequently than the
application handles them, so that they don't accumulate and overwhelm the
application later. On other platforms, the default is false.
(In the future, the compression feature may be implemented across platforms.)
You can test the attribute to see whether compression is enabled.
If your application needs to handle all events with no compression,
you can unset this attribute. This value has been added in Qt 5.7.
\value AA_DontCheckOpenGLContextThreadAffinity When making a context \value AA_DontCheckOpenGLContextThreadAffinity When making a context
current using QOpenGLContext, do not check that the current using QOpenGLContext, do not check that the
\l{QObject#Thread Affinity}{QObject thread affinity} \l{QObject#Thread Affinity}{QObject thread affinity}

View File

@ -107,7 +107,7 @@
# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM # define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
# elif defined(_M_ARM) && _M_ARM > 1 # elif defined(_M_ARM) && _M_ARM > 1
# define Q_PROCESSOR_ARM _M_ARM # define Q_PROCESSOR_ARM _M_ARM
# elif defined(__ARM64_ARCH_8__) # elif defined(__ARM64_ARCH_8__) || defined(__aarch64__)
# define Q_PROCESSOR_ARM 8 # define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \ # elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \ || defined(__ARM_ARCH_7A__) \

View File

@ -793,6 +793,17 @@ QDebug &QDebug::resetFormat()
Writes \a flag to \a stream. Writes \a flag to \a stream.
*/ */
/*!
\fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
\relates QSharedPointer
\since 5.7
Writes the pointer tracked by \a ptr into the debug object \a debug for
debugging purposes.
\sa {Debugging Techniques}
*/
/*! /*!
\class QDebugStateSaver \class QDebugStateSaver
\inmodule QtCore \inmodule QtCore

View File

@ -51,6 +51,7 @@
#include <QtCore/qvector.h> #include <QtCore/qvector.h>
#include <QtCore/qset.h> #include <QtCore/qset.h>
#include <QtCore/qcontiguouscache.h> #include <QtCore/qcontiguouscache.h>
#include <QtCore/qsharedpointer.h>
// all these have already been included by various headers above, but don't rely on indirect includes: // all these have already been included by various headers above, but don't rely on indirect includes:
#include <vector> #include <vector>
@ -330,6 +331,14 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.maybeSpace(); return debug.maybeSpace();
} }
template <class T>
inline QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
{
QDebugStateSaver saver(debug);
debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
return debug;
}
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value); Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value);
template <typename Int> template <typename Int>

View File

@ -812,7 +812,9 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
#if !defined(Q_OS_WINRT) #if !defined(Q_OS_WINRT)
if (fname.isDriveRoot()) { if (fname.isDriveRoot()) {
// a valid drive ?? // a valid drive ??
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
DWORD drivesBitmask = ::GetLogicalDrives(); DWORD drivesBitmask = ::GetLogicalDrives();
::SetErrorMode(oldErrorMode);
int drivebit = 1 << (fname.filePath().at(0).toUpper().unicode() - QLatin1Char('A').unicode()); int drivebit = 1 << (fname.filePath().at(0).toUpper().unicode() - QLatin1Char('A').unicode());
if (drivesBitmask & drivebit) { if (drivesBitmask & drivebit) {
fileAttrib = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM; fileAttrib = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM;

View File

@ -551,7 +551,9 @@ QFileInfoList QFSFileEngine::drives()
QFileInfoList ret; QFileInfoList ret;
#if !defined(Q_OS_WINRT) #if !defined(Q_OS_WINRT)
# if defined(Q_OS_WIN32) # if defined(Q_OS_WIN32)
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
::SetErrorMode(oldErrorMode);
# endif # endif
char driveName[] = "A:/"; char driveName[] = "A:/";

View File

@ -108,25 +108,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
{
if (mountDir.startsWith(QLatin1String("/dev"))
|| mountDir.startsWith(QLatin1String("/proc"))
|| mountDir.startsWith(QLatin1String("/sys"))
|| mountDir.startsWith(QLatin1String("/var/run"))
|| mountDir.startsWith(QLatin1String("/var/lock"))) {
return true;
}
if (type == "tmpfs")
return true;
#if defined(Q_OS_LINUX)
if (type == "rootfs" || type == "rpc_pipefs")
return true;
#endif
return false;
}
class QStorageIterator class QStorageIterator
{ {
public: public:
@ -164,6 +145,39 @@ private:
#endif #endif
}; };
template <typename String>
static bool isParentOf(const String &parent, const QString &dirName)
{
return dirName.startsWith(parent) &&
(dirName.size() == parent.size() || dirName.at(parent.size()) == QLatin1Char('/') ||
parent.size() == 1);
}
static bool isPseudoFs(const QStorageIterator &it)
{
QString mountDir = it.rootPath();
if (isParentOf(QLatin1String("/dev"), mountDir)
|| isParentOf(QLatin1String("/proc"), mountDir)
|| isParentOf(QLatin1String("/sys"), mountDir)
|| isParentOf(QLatin1String("/var/run"), mountDir)
|| isParentOf(QLatin1String("/var/lock"), mountDir)) {
return true;
}
QByteArray type = it.fileSystemType();
if (type == "tmpfs")
return false;
#if defined(Q_OS_LINUX)
if (type == "rootfs" || type == "rpc_pipefs")
return true;
#endif
if (!it.device().startsWith('/'))
return true;
return false;
}
#if defined(Q_OS_BSD4) #if defined(Q_OS_BSD4)
inline QStorageIterator::QStorageIterator() inline QStorageIterator::QStorageIterator()
@ -450,10 +464,8 @@ void QStorageInfoPrivate::initRootPath()
while (it.next()) { while (it.next()) {
const QString mountDir = it.rootPath(); const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType(); const QByteArray fsName = it.fileSystemType();
if (isPseudoFs(mountDir, fsName))
continue;
// we try to find most suitable entry // we try to find most suitable entry
if (oldRootPath.startsWith(mountDir) && maxLength < mountDir.length()) { if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) {
maxLength = mountDir.length(); maxLength = mountDir.length();
rootPath = mountDir; rootPath = mountDir;
device = it.device(); device = it.device();
@ -467,11 +479,14 @@ static inline QString retrieveLabel(const QByteArray &device)
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
static const char pathDiskByLabel[] = "/dev/disk/by-label"; static const char pathDiskByLabel[] = "/dev/disk/by-label";
QFileInfo devinfo(QFile::decodeName(device));
QString devicePath = devinfo.canonicalFilePath();
QDirIterator it(QLatin1String(pathDiskByLabel), QDir::NoDotAndDotDot); QDirIterator it(QLatin1String(pathDiskByLabel), QDir::NoDotAndDotDot);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
QFileInfo fileInfo(it.fileInfo()); QFileInfo fileInfo(it.fileInfo());
if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device) if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
return fileInfo.fileName(); return fileInfo.fileName();
} }
#elif defined Q_OS_HAIKU #elif defined Q_OS_HAIKU
@ -542,11 +557,10 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
QList<QStorageInfo> volumes; QList<QStorageInfo> volumes;
while (it.next()) { while (it.next()) {
const QString mountDir = it.rootPath(); if (isPseudoFs(it))
const QByteArray fsName = it.fileSystemType();
if (isPseudoFs(mountDir, fsName))
continue; continue;
const QString mountDir = it.rootPath();
volumes.append(QStorageInfo(mountDir)); volumes.append(QStorageInfo(mountDir));
} }

View File

@ -3690,7 +3690,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelAboutToBeReset() \fn QAbstractItemModel::modelAboutToBeReset()
\since 4.2 \since 4.2
This signal is emitted when reset() is called, before the model's internal This signal is emitted when beginResetModel() is called, before the model's internal
state (e.g. persistent model indexes) has been invalidated. state (e.g. persistent model indexes) has been invalidated.
\sa beginResetModel(), modelReset() \sa beginResetModel(), modelReset()
@ -3700,7 +3700,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelReset() \fn QAbstractItemModel::modelReset()
\since 4.1 \since 4.1
This signal is emitted when reset() or endResetModel() is called, after the This signal is emitted when endResetModel() is called, after the
model's internal state (e.g. persistent model indexes) has been invalidated. model's internal state (e.g. persistent model indexes) has been invalidated.
Note that if a model is reset it should be considered that all information Note that if a model is reset it should be considered that all information

View File

@ -945,6 +945,26 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
} }
} }
#endif #endif
if (QMetaType::typeFlags(t) & QMetaType::IsEnumeration) {
qlonglong value = qConvertToNumber(d, ok);
if (*ok) {
switch (QMetaType::sizeOf(t)) {
case 1:
*static_cast<signed char *>(result) = value;
return true;
case 2:
*static_cast<qint16 *>(result) = value;
return true;
case 4:
*static_cast<qint32 *>(result) = value;
return true;
case 8:
*static_cast<qint64 *>(result) = value;
return true;
}
}
return *ok;
}
return false; return false;
} }
return true; return true;
@ -2819,7 +2839,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double /*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
| 1 << QVariant::Char | 1 << QVariant::ByteArray, | 1 << QVariant::Char | 1 << QVariant::ByteArray | 1 << QVariant::Int,
/*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double /*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong

View File

@ -1778,7 +1778,11 @@ void QStateMachinePrivate::_q_start()
{ {
Q_Q(QStateMachine); Q_Q(QStateMachine);
Q_ASSERT(state == Starting); Q_ASSERT(state == Starting);
foreach (QAbstractState *state, configuration) { // iterate over a copy, since we emit signals which may cause
// 'configuration' to change, resulting in undefined behavior when
// iterating at the same time:
const auto config = configuration;
for (QAbstractState *state : config) {
QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state); QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state);
abstractStatePrivate->active = false; abstractStatePrivate->active = false;
emit state->activeChanged(false); emit state->activeChanged(false);

View File

@ -232,8 +232,8 @@ public:
AtomicType _q_value; AtomicType _q_value;
Type load() const Q_DECL_NOTHROW { return _q_value; } Type load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
void store(Type newValue) Q_DECL_NOTHROW { _q_value = newValue; } void store(Type newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
operator Type() const Q_DECL_NOTHROW { return loadAcquire(); } operator Type() const Q_DECL_NOTHROW { return loadAcquire(); }
Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; } Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }

View File

@ -56,6 +56,11 @@
# error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted" # error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted"
#endif #endif
#ifndef FUTEX_PRIVATE_FLAG
# define FUTEX_PRIVATE_FLAG 128
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/* /*
@ -104,40 +109,6 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1); static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1);
static int checkFutexPrivateSupport()
{
int value = 0;
#if defined(FUTEX_PRIVATE_FLAG)
// check if the kernel supports extra futex flags
// FUTEX_PRIVATE_FLAG appeared in v2.6.22
Q_STATIC_ASSERT(FUTEX_PRIVATE_FLAG != 0x80000000);
// try an operation that has no side-effects: wake up 42 threads
// futex will return -1 (errno==ENOSYS) if the flag isn't supported
// there should be no other error conditions
value = syscall(__NR_futex, &futexFlagSupport,
FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
42, 0, 0, 0);
if (value != -1)
value = FUTEX_PRIVATE_FLAG;
else
value = 0;
#else
value = 0;
#endif
futexFlagSupport.store(value);
return value;
}
static inline int futexFlags()
{
int value = futexFlagSupport.load();
if (Q_LIKELY(value != -1))
return value;
return checkFutexPrivateSupport();
}
static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) Q_DECL_NOTHROW static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) Q_DECL_NOTHROW
{ {
volatile int *int_addr = reinterpret_cast<volatile int *>(addr); volatile int *int_addr = reinterpret_cast<volatile int *>(addr);
@ -149,7 +120,7 @@ static inline int _q_futex(void *addr, int op, int val, const struct timespec *t
// we use __NR_futex because some libcs (like Android's bionic) don't // we use __NR_futex because some libcs (like Android's bionic) don't
// provide SYS_futex etc. // provide SYS_futex etc.
return syscall(__NR_futex, int_addr, op | futexFlags(), val, timeout, addr2, val2); return syscall(__NR_futex, int_addr, op | FUTEX_PRIVATE_FLAG, val, timeout, addr2, val2);
} }
static inline QMutexData *dummyFutexValue() static inline QMutexData *dummyFutexValue()

View File

@ -71,7 +71,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
// Don't allocate empty headers // Don't allocate empty headers
if (!(options & RawData) && !capacity) { if (!(options & RawData) && !capacity) {
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (options & Unsharable) if (options & Unsharable)
return const_cast<QArrayData *>(&qt_array_unsharable_empty); return const_cast<QArrayData *>(&qt_array_unsharable_empty);
#endif #endif
@ -116,7 +116,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
quintptr data = (quintptr(header) + sizeof(QArrayData) + alignment - 1) quintptr data = (quintptr(header) + sizeof(QArrayData) + alignment - 1)
& ~(alignment - 1); & ~(alignment - 1);
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
header->ref.atomic.store(bool(!(options & Unsharable))); header->ref.atomic.store(bool(!(options & Unsharable)));
#else #else
header->ref.atomic.store(1); header->ref.atomic.store(1);
@ -138,7 +138,7 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize,
&& !(alignment & (alignment - 1))); && !(alignment & (alignment - 1)));
Q_UNUSED(objectSize) Q_UNUSED(alignment) Q_UNUSED(objectSize) Q_UNUSED(alignment)
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (data == &qt_array_unsharable_empty) if (data == &qt_array_unsharable_empty)
return; return;
#endif #endif

View File

@ -78,7 +78,7 @@ struct Q_CORE_EXPORT QArrayData
enum AllocationOption { enum AllocationOption {
CapacityReserved = 0x1, CapacityReserved = 0x1,
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Unsharable = 0x2, Unsharable = 0x2,
#endif #endif
RawData = 0x4, RawData = 0x4,
@ -255,7 +255,7 @@ struct QTypedArrayData
return allocate(/* capacity */ 0); return allocate(/* capacity */ 0);
} }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
static QTypedArrayData *unsharableEmpty() static QTypedArrayData *unsharableEmpty()
{ {
Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));

View File

@ -133,7 +133,7 @@ public:
return (!d->isMutable() || d->ref.isShared()); return (!d->isMutable() || d->ref.isShared());
} }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
void setSharable(bool sharable) void setSharable(bool sharable)
{ {
if (needsDetach()) { if (needsDetach()) {

View File

@ -102,7 +102,7 @@ public:
inline void detach() { if (d->ref.load() != 1) detach_helper(); } inline void detach() { if (d->ref.load() != 1) detach_helper(); }
inline bool isDetached() const { return d->ref.load() == 1; } inline bool isDetached() const { return d->ref.load() == 1; }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
#endif #endif

View File

@ -713,7 +713,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
QDTPDEBUG << "sectionValue for" << sn.name() QDTPDEBUG << "sectionValue for" << sn.name()
<< "with text" << text << "and st" << sectiontext << "with text" << text << "and st" << sectiontext
<< text.mid(index, sectionmaxsize) << text.midRef(index, sectionmaxsize)
<< index; << index;
int used = 0; int used = 0;
@ -743,9 +743,8 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
QDTPDEBUGN("This should never happen (findAmPm returned %d)", ampm); QDTPDEBUGN("This should never happen (findAmPm returned %d)", ampm);
break; break;
} }
if (state != Invalid) { if (state != Invalid)
text.replace(index, used, sectiontext.left(used)); text.replace(index, used, sectiontext.constData(), used);
}
break; } break; }
case MonthSection: case MonthSection:
case DayOfWeekSectionShort: case DayOfWeekSectionShort:
@ -764,7 +763,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
if (num != -1) { if (num != -1) {
state = (used == sectiontext.size() ? Acceptable : Intermediate); state = (used == sectiontext.size() ? Acceptable : Intermediate);
text.replace(index, used, sectiontext.left(used)); text.replace(index, used, sectiontext.constData(), used);
} else { } else {
state = Intermediate; state = Intermediate;
} }
@ -810,7 +809,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
} }
} }
if (ok && tmp <= absMax) { if (ok && tmp <= absMax) {
QDTPDEBUG << sectiontext.left(digits) << tmp << digits; QDTPDEBUG << sectiontext.leftRef(digits) << tmp << digits;
last = tmp; last = tmp;
used = digits; used = digits;
break; break;
@ -911,7 +910,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
for (int index=0; state != Invalid && index<sectionNodesCount; ++index) { for (int index=0; state != Invalid && index<sectionNodesCount; ++index) {
if (QStringRef(&input, pos, separators.at(index).size()) != separators.at(index)) { if (QStringRef(&input, pos, separators.at(index).size()) != separators.at(index)) {
QDTPDEBUG << "invalid because" << input.mid(pos, separators.at(index).size()) QDTPDEBUG << "invalid because" << input.midRef(pos, separators.at(index).size())
<< "!=" << separators.at(index) << "!=" << separators.at(index)
<< index << pos << currentSectionIndex; << index << pos << currentSectionIndex;
state = Invalid; state = Invalid;
@ -983,7 +982,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
} }
if (state != Invalid && QStringRef(&input, pos, input.size() - pos) != separators.last()) { if (state != Invalid && QStringRef(&input, pos, input.size() - pos) != separators.last()) {
QDTPDEBUG << "invalid because" << input.mid(pos) QDTPDEBUG << "invalid because" << input.midRef(pos)
<< "!=" << separators.last() << pos; << "!=" << separators.last() << pos;
state = Invalid; state = Invalid;
} }
@ -1384,7 +1383,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI
} }
if (used) if (used)
*used = str.size(); *used = str.size();
if (str.trimmed().isEmpty()) { if (QStringRef(&str).trimmed().isEmpty()) {
return PossibleBoth; return PossibleBoth;
} }
const QLatin1Char space(' '); const QLatin1Char space(' ');

View File

@ -38,9 +38,6 @@
** **
****************************************************************************/ ****************************************************************************/
// ask for the latest POSIX, just in case
#define _POSIX_C_SOURCE 200809L
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#if defined(Q_OS_VXWORKS) #if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h" #include "qfunctions_vxworks.h"

View File

@ -272,7 +272,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); } inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); } inline bool isDetached() const { return !d->ref.isShared(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QHashData::shared_null) d->sharable = sharable; } inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QHashData::shared_null) d->sharable = sharable; }
#endif #endif
bool isSharedWith(const QHash &other) const { return d == other.d; } bool isSharedWith(const QHash &other) const { return d == other.d; }
@ -1092,9 +1092,6 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value)
return n; return n;
} }
Q_CORE_EXPORT int qGlobalQHashSeed();
Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash) Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash) Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)

View File

@ -64,6 +64,9 @@ class QString;
class QStringRef; class QStringRef;
class QLatin1String; class QLatin1String;
Q_CORE_EXPORT int qGlobalQHashSeed();
Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW;
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }

View File

@ -105,7 +105,7 @@ public:
inline void detach() inline void detach()
{ if (d->ref.isShared()) detach_helper2(this->e); } { if (d->ref.isShared()) detach_helper2(this->e); }
inline bool isDetached() const { return !d->ref.isShared(); } inline bool isDetached() const { return !d->ref.isShared(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QLinkedListData::shared_null) d->sharable = sharable; } inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QLinkedListData::shared_null) d->sharable = sharable; }
#endif #endif
inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; } inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; }

View File

@ -178,7 +178,7 @@ public:
} }
inline bool isDetached() const { return !d->ref.isShared(); } inline bool isDetached() const { return !d->ref.isShared(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) inline void setSharable(bool sharable)
{ {
if (sharable == d->ref.isSharable()) if (sharable == d->ref.isSharable())

View File

@ -365,7 +365,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); } inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); } inline bool isDetached() const { return !d->ref.isShared(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) inline void setSharable(bool sharable)
{ {
if (sharable == d->ref.isSharable()) if (sharable == d->ref.isSharable())

View File

@ -53,7 +53,7 @@ class RefCount
public: public:
inline bool ref() Q_DECL_NOTHROW { inline bool ref() Q_DECL_NOTHROW {
int count = atomic.load(); int count = atomic.load();
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable if (count == 0) // !isSharable
return false; return false;
#endif #endif
@ -64,7 +64,7 @@ public:
inline bool deref() Q_DECL_NOTHROW { inline bool deref() Q_DECL_NOTHROW {
int count = atomic.load(); int count = atomic.load();
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable if (count == 0) // !isSharable
return false; return false;
#endif #endif
@ -73,7 +73,7 @@ public:
return atomic.deref(); return atomic.deref();
} }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
bool setSharable(bool sharable) Q_DECL_NOTHROW bool setSharable(bool sharable) Q_DECL_NOTHROW
{ {
Q_ASSERT(!isShared()); Q_ASSERT(!isShared());

View File

@ -85,7 +85,7 @@ public:
inline void detach() { q_hash.detach(); } inline void detach() { q_hash.detach(); }
inline bool isDetached() const { return q_hash.isDetached(); } inline bool isDetached() const { return q_hash.isDetached(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { q_hash.setSharable(sharable); } inline void setSharable(bool sharable) { q_hash.setSharable(sharable); }
#endif #endif

View File

@ -1323,17 +1323,6 @@
compile. Use qSharedPointerConstCast to cast away the constness. compile. Use qSharedPointerConstCast to cast away the constness.
*/ */
/*!
\fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
\relates QSharedPointer
\since 5.7
Writes the pointer tracked by \a ptr into the debug object \a debug for
debugging purposes.
\sa {Debugging Techniques}
*/
#include <qset.h> #include <qset.h>
#include <qmutex.h> #include <qmutex.h>

View File

@ -161,8 +161,6 @@ template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QWe
template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src); template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src);
template <class T> QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr);
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // Q_QDOC #endif // Q_QDOC

View File

@ -62,7 +62,6 @@ QT_END_NAMESPACE
#include <new> #include <new>
#include <QtCore/qatomic.h> #include <QtCore/qatomic.h>
#include <QtCore/qobject.h> // for qobject_cast #include <QtCore/qobject.h> // for qobject_cast
#include <QtCore/qdebug.h>
#if QT_DEPRECATED_SINCE(5, 6) #if QT_DEPRECATED_SINCE(5, 6)
#include <QtCore/qhash.h> #include <QtCore/qhash.h>
#endif #endif
@ -883,16 +882,6 @@ inline void qSwap(QSharedPointer<T> &p1, QSharedPointer<T> &p2)
p1.swap(p2); p1.swap(p2);
} }
#ifndef QT_NO_DEBUG_STREAM
template <class T>
Q_INLINE_TEMPLATE QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
{
QDebugStateSaver saver(debug);
debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
return debug;
}
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
namespace std { namespace std {
template <class T> template <class T>

View File

@ -670,7 +670,11 @@ void qDetectCpuFeatures()
// contains all the features that the code required. Qt 4 ran for years // contains all the features that the code required. Qt 4 ran for years
// like that, so it shouldn't be a problem. // like that, so it shouldn't be a problem.
qt_cpu_features.store(minFeature | quint32(QSimdInitialized)); qt_cpu_features[0].store(minFeature | quint32(QSimdInitialized));
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
qt_cpu_features[1].store(minFeature >> 32);
#endif
return; return;
# endif # endif
#endif #endif

View File

@ -106,7 +106,7 @@ public:
inline void detach(); inline void detach();
inline bool isDetached() const { return !d->ref.isShared(); } inline bool isDetached() const { return !d->ref.isShared(); }
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) inline void setSharable(bool sharable)
{ {
if (sharable == d->ref.isSharable()) if (sharable == d->ref.isSharable())
@ -382,7 +382,7 @@ template <typename T>
void QVector<T>::detach() void QVector<T>::detach()
{ {
if (!isDetached()) { if (!isDetached()) {
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (!d->alloc) if (!d->alloc)
d = Data::unsharableEmpty(); d = Data::unsharableEmpty();
else else
@ -539,7 +539,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
x = Data::allocate(aalloc, options); x = Data::allocate(aalloc, options);
Q_CHECK_PTR(x); Q_CHECK_PTR(x);
// aalloc is bigger then 0 so it is not [un]sharedEmpty // aalloc is bigger then 0 so it is not [un]sharedEmpty
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(x->ref.isSharable() || options.testFlag(QArrayData::Unsharable)); Q_ASSERT(x->ref.isSharable() || options.testFlag(QArrayData::Unsharable));
#endif #endif
Q_ASSERT(!x->ref.isStatic()); Q_ASSERT(!x->ref.isStatic());
@ -607,7 +607,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
Q_ASSERT(d->data()); Q_ASSERT(d->data());
Q_ASSERT(uint(d->size) <= d->alloc); Q_ASSERT(uint(d->size) <= d->alloc);
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) #if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(d != Data::unsharableEmpty()); Q_ASSERT(d != Data::unsharableEmpty());
#endif #endif
Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull()); Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull());

View File

@ -152,6 +152,7 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
contains(QT_CONFIG, system-zlib) { contains(QT_CONFIG, system-zlib) {
include($$PWD/../../3rdparty/zlib_dependency.pri) include($$PWD/../../3rdparty/zlib_dependency.pri)
} else { } else {
CONFIG += no_core_dep
include($$PWD/../../3rdparty/zlib.pri) include($$PWD/../../3rdparty/zlib.pri)
} }

View File

@ -23,6 +23,8 @@ win32 {
-luser32 -luser32
} }
DEFINES += QT_NO_FOREACH
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
PUB_HEADERS = qdbusargument.h \ PUB_HEADERS = qdbusargument.h \

View File

@ -19,7 +19,7 @@ sourcedirs += .. \
../../../examples/dbus/doc/src ../../../examples/dbus/doc/src
excludedirs += ../../../examples/widgets/doc excludedirs += ../../../examples/widgets/doc
examplesinstallpath = qtbase/dbus examplesinstallpath = dbus
depends += qtdoc qtcore depends += qtdoc qtcore

View File

@ -259,7 +259,7 @@ private:
const QVector<int> &metaTypes, int slotIdx); const QVector<int> &metaTypes, int slotIdx);
SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it); SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it);
void disconnectObjectTree(ObjectTreeNode &node); void collectAllObjects(ObjectTreeNode &node, QSet<QObject *> &set);
bool isServiceRegisteredByThread(const QString &serviceName); bool isServiceRegisteredByThread(const QString &serviceName);

View File

@ -1076,17 +1076,18 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
} }
} }
void QDBusConnectionPrivate::disconnectObjectTree(QDBusConnectionPrivate::ObjectTreeNode &haystack) void QDBusConnectionPrivate::collectAllObjects(QDBusConnectionPrivate::ObjectTreeNode &haystack,
QSet<QObject *> &set)
{ {
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin();
while (it != haystack.children.end()) { while (it != haystack.children.end()) {
disconnectObjectTree(*it); collectAllObjects(*it, set);
it++; it++;
} }
if (haystack.obj) if (haystack.obj)
haystack.obj->disconnect(this); set.insert(haystack.obj);
} }
void QDBusConnectionPrivate::closeConnection() void QDBusConnectionPrivate::closeConnection()
@ -1115,15 +1116,23 @@ void QDBusConnectionPrivate::closeConnection()
// Disconnect all signals from signal hooks and from the object tree to // Disconnect all signals from signal hooks and from the object tree to
// avoid QObject::destroyed being sent to dbus daemon thread which has // avoid QObject::destroyed being sent to dbus daemon thread which has
// already quit. // already quit. We need to make sure we disconnect exactly once per
SignalHookHash::iterator sit = signalHooks.begin(); // object, because if we tried a second time, we might be hitting a
while (sit != signalHooks.end()) { // dangling pointer.
sit.value().obj->disconnect(this); QSet<QObject *> allObjects;
sit++; collectAllObjects(rootNode, allObjects);
SignalHookHash::const_iterator sit = signalHooks.constBegin();
while (sit != signalHooks.constEnd()) {
allObjects.insert(sit.value().obj);
++sit;
} }
disconnectObjectTree(rootNode); // now disconnect ourselves
rootNode.children.clear(); // free resources QSet<QObject *>::const_iterator oit = allObjects.constBegin();
while (oit != allObjects.constEnd()) {
(*oit)->disconnect(this);
++oit;
}
} }
void QDBusConnectionPrivate::handleDBusDisconnection() void QDBusConnectionPrivate::handleDBusDisconnection()

View File

@ -4,7 +4,7 @@ project = QtGui
description = Qt GUI Reference Documentation description = Qt GUI Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/gui examplesinstallpath = gui
qhp.projects = QtGui qhp.projects = QtGui

View File

@ -138,22 +138,6 @@ QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g)
enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan }; enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan };
static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="}; static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="};
static inline QString valueKey() { return QStringLiteral("value"); }
static inline QString opKey() { return QStringLiteral("op"); }
static inline QString versionKey() { return QStringLiteral("version"); }
static inline QString releaseKey() { return QStringLiteral("release"); }
static inline QString typeKey() { return QStringLiteral("type"); }
static inline QString osKey() { return QStringLiteral("os"); }
static inline QString vendorIdKey() { return QStringLiteral("vendor_id"); }
static inline QString glVendorKey() { return QStringLiteral("gl_vendor"); }
static inline QString deviceIdKey() { return QStringLiteral("device_id"); }
static inline QString driverVersionKey() { return QStringLiteral("driver_version"); }
static inline QString driverDescriptionKey() { return QStringLiteral("driver_description"); }
static inline QString featuresKey() { return QStringLiteral("features"); }
static inline QString idKey() { return QStringLiteral("id"); }
static inline QString descriptionKey() { return QStringLiteral("description"); }
static inline QString exceptionsKey() { return QStringLiteral("exceptions"); }
typedef QJsonArray::ConstIterator JsonArrayConstIt; typedef QJsonArray::ConstIterator JsonArrayConstIt;
static inline bool contains(const QJsonArray &haystack, unsigned needle) static inline bool contains(const QJsonArray &haystack, unsigned needle)
@ -216,8 +200,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
if (!v.isObject()) if (!v.isObject())
return result; return result;
const QJsonObject o = v.toObject(); const QJsonObject o = v.toObject();
result.number = QVersionNumber::fromString(o.value(valueKey()).toString()); result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());
const QString opS = o.value(opKey()).toString(); const QString opS = o.value(QLatin1String("op")).toString();
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) { for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
if (opS == QLatin1String(operators[i])) { if (opS == QLatin1String(operators[i])) {
result.op = static_cast<Operator>(i); result.op = static_cast<Operator>(i);
@ -292,9 +276,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)
if (!v.isObject()) if (!v.isObject())
return result; return result;
const QJsonObject o = v.toObject(); const QJsonObject o = v.toObject();
result.type = o.value(typeKey()).toString(); result.type = o.value(QLatin1String("type")).toString();
result.versionTerm = VersionTerm::fromJson(o.value(versionKey())); result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));
result.release = o.value(releaseKey()).toArray(); result.release = o.value(QLatin1String("release")).toArray();
return result; return result;
} }
@ -318,8 +302,8 @@ QString OsTypeTerm::hostOs()
static QString msgSyntaxWarning(const QJsonObject &object, const QString &what) static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)
{ {
QString result; QString result;
QTextStream(&result) << "Id " << object.value(idKey()).toInt() QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()
<< " (\"" << object.value(descriptionKey()).toString() << " (\"" << object.value(QLatin1String("description")).toString()
<< "\"): " << what; << "\"): " << what;
return result; return result;
} }
@ -333,11 +317,11 @@ static bool matches(const QJsonObject &object,
const QString &osRelease, const QString &osRelease,
const QOpenGLConfig::Gpu &gpu) const QOpenGLConfig::Gpu &gpu)
{ {
const OsTypeTerm os = OsTypeTerm::fromJson(object.value(osKey())); const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os")));
if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease)) if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease))
return false; return false;
const QJsonValue exceptionsV = object.value(exceptionsKey()); const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));
if (exceptionsV.isArray()) { if (exceptionsV.isArray()) {
const QJsonArray exceptionsA = exceptionsV.toArray(); const QJsonArray exceptionsA = exceptionsV.toArray();
for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) { for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) {
@ -346,20 +330,20 @@ static bool matches(const QJsonObject &object,
} }
} }
const QJsonValue vendorV = object.value(vendorIdKey()); const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));
if (vendorV.isString()) { if (vendorV.isString()) {
if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0)) if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0))
return false; return false;
} else { } else {
if (object.contains(glVendorKey())) { if (object.contains(QLatin1String("gl_vendor"))) {
const QByteArray glVendorV = object.value(glVendorKey()).toString().toUtf8(); const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();
if (!gpu.glVendor.contains(glVendorV)) if (!gpu.glVendor.contains(glVendorV))
return false; return false;
} }
} }
if (gpu.deviceId) { if (gpu.deviceId) {
const QJsonValue deviceIdV = object.value(deviceIdKey()); const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));
switch (deviceIdV.type()) { switch (deviceIdV.type()) {
case QJsonValue::Array: case QJsonValue::Array:
if (!contains(deviceIdV.toArray(), gpu.deviceId)) if (!contains(deviceIdV.toArray(), gpu.deviceId))
@ -375,7 +359,7 @@ static bool matches(const QJsonObject &object,
} }
} }
if (!gpu.driverVersion.isNull()) { if (!gpu.driverVersion.isNull()) {
const QJsonValue driverVersionV = object.value(driverVersionKey()); const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));
switch (driverVersionV.type()) { switch (driverVersionV.type()) {
case QJsonValue::Object: case QJsonValue::Object:
if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion)) if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion))
@ -392,7 +376,7 @@ static bool matches(const QJsonObject &object,
} }
if (!gpu.driverDescription.isEmpty()) { if (!gpu.driverDescription.isEmpty()) {
const QJsonValue driverDescriptionV = object.value(driverDescriptionKey()); const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));
if (driverDescriptionV.isString()) { if (driverDescriptionV.isString()) {
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8())) if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
return false; return false;
@ -412,7 +396,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
{ {
result->clear(); result->clear();
errorMessage->clear(); errorMessage->clear();
const QJsonValue entriesV = doc.object().value(QStringLiteral("entries")); const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));
if (!entriesV.isArray()) { if (!entriesV.isArray()) {
*errorMessage = QLatin1String("No entries read."); *errorMessage = QLatin1String("No entries read.");
return false; return false;
@ -423,7 +407,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
if (eit->isObject()) { if (eit->isObject()) {
const QJsonObject object = eit->toObject(); const QJsonObject object = eit->toObject();
if (matches(object, osName, kernelVersion, osRelease, gpu)) { if (matches(object, osName, kernelVersion, osRelease, gpu)) {
const QJsonValue featuresListV = object.value(featuresKey()); const QJsonValue featuresListV = object.value(QLatin1String("features"));
if (featuresListV.isArray()) { if (featuresListV.isArray()) {
const QJsonArray featuresListA = featuresListV.toArray(); const QJsonArray featuresListA = featuresListV.toArray();
for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit) for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit)

View File

@ -6272,7 +6272,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setColor(uc); pen.setColor(uc);
// Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms
const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / 2.), pen); const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / qreal(2.)), pen);
const int descent = qFloor(maxHeight); const int descent = qFloor(maxHeight);
painter->setBrushOrigin(painter->brushOrigin().x(), 0); painter->setBrushOrigin(painter->brushOrigin().x(), 0);
@ -6283,7 +6283,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
// the text above it, but limit it to stay within descent. // the text above it, but limit it to stay within descent.
qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5; qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5;
if (underlineOffset <= fe->descent().toReal()) if (underlineOffset <= fe->descent().toReal())
adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - 0.5); adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5));
const qreal underlinePos = pos.y() + adjustedUnderlineOffset; const qreal underlinePos = pos.y() + adjustedUnderlineOffset;
QColor uc = charFormat.underlineColor(); QColor uc = charFormat.underlineColor();
if (uc.isValid()) if (uc.isValid())

View File

@ -232,7 +232,8 @@ void QPlatformTextureList::clear()
Flushes the given \a region from the specified \a window onto the Flushes the given \a region from the specified \a window onto the
screen. screen.
Note that the \a offset parameter is currently unused. The \a offset parameter is relative to the origin of the backing
store image.
*/ */
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL

View File

@ -428,7 +428,7 @@ void QStroker::processCurrentSubpath()
bool fwclosed = qt_stroke_side(&fwit, this, false, &fwStartTangent); bool fwclosed = qt_stroke_side(&fwit, this, false, &fwStartTangent);
bool bwclosed = qt_stroke_side(&bwit, this, !fwclosed, &bwStartTangent); bool bwclosed = qt_stroke_side(&bwit, this, !fwclosed, &bwStartTangent);
if (!bwclosed) if (!bwclosed && !fwStartTangent.isNull())
joinPoints(m_elements.at(0).x, m_elements.at(0).y, fwStartTangent, m_capStyle); joinPoints(m_elements.at(0).x, m_elements.at(0).y, fwStartTangent, m_capStyle);
} }

View File

@ -118,9 +118,6 @@ bool QFontDef::exactMatch(const QFontDef &other) const
QFontDatabase::parseFontName(family, this_foundry, this_family); QFontDatabase::parseFontName(family, this_foundry, this_family);
QFontDatabase::parseFontName(other.family, other_foundry, other_family); QFontDatabase::parseFontName(other.family, other_foundry, other_family);
this_family = QFontDatabase::resolveFontFamilyAlias(this_family);
other_family = QFontDatabase::resolveFontFamilyAlias(other_family);
return (styleHint == other.styleHint return (styleHint == other.styleHint
&& styleStrategy == other.styleStrategy && styleStrategy == other.styleStrategy
&& weight == other.weight && weight == other.weight

View File

@ -480,6 +480,9 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
// //
connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)), connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
SLOT(_q_onlineStateChanged(bool))); SLOT(_q_onlineStateChanged(bool)));
connect(&d->networkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration &)),
SLOT(_q_configurationChanged(const QNetworkConfiguration &)));
#endif #endif
} }
@ -1578,6 +1581,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)), QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
} }
//switch to new session (null if config was invalid) //switch to new session (null if config was invalid)
@ -1585,7 +1590,6 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
networkSessionWeakRef = networkSessionStrongRef.toWeakRef(); networkSessionWeakRef = networkSessionStrongRef.toWeakRef();
if (!networkSessionStrongRef) { if (!networkSessionStrongRef) {
online = false;
if (networkAccessible == QNetworkAccessManager::NotAccessible || !online) if (networkAccessible == QNetworkAccessManager::NotAccessible || !online)
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
@ -1601,6 +1605,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::connect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection); QObject::connect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)), QObject::connect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
_q_networkSessionStateChanged(networkSessionStrongRef->state()); _q_networkSessionStateChanged(networkSessionStrongRef->state());
} }
@ -1617,6 +1623,9 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
networkSessionStrongRef.clear(); networkSessionStrongRef.clear();
networkSessionWeakRef.clear(); networkSessionWeakRef.clear();
} }
@ -1625,46 +1634,57 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state) void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state)
{ {
Q_Q(QNetworkAccessManager); Q_Q(QNetworkAccessManager);
bool reallyOnline = false;
//Do not emit the networkSessionConnected signal here, except for roaming -> connected //Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection. //transition, otherwise it is emitted twice in a row when opening a connection.
if (state == QNetworkSession::Connected && lastSessionState == QNetworkSession::Roaming) if (state == QNetworkSession::Connected && lastSessionState != QNetworkSession::Roaming)
emit q->networkSessionConnected(); emit q->networkSessionConnected();
lastSessionState = state; lastSessionState = state;
if (online) { if (online && state == QNetworkSession::Disconnected) {
const auto cfgs = networkConfigurationManager.allConfigurations();
for (const QNetworkConfiguration &cfg : cfgs) {
if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
reallyOnline = true;
}
}
} else if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
reallyOnline = true;
}
if (!reallyOnline) {
if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) { if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) {
online = false;
if (networkAccessible != QNetworkAccessManager::NotAccessible) { if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible; networkAccessible = QNetworkAccessManager::NotAccessible;
emit q->networkAccessibleChanged(networkAccessible); emit q->networkAccessibleChanged(networkAccessible);
} }
} }
} else { } else {
if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
online = true;
if (defaultAccessControl) if (defaultAccessControl)
if (networkAccessible != QNetworkAccessManager::Accessible) { if (networkAccessible != QNetworkAccessManager::Accessible) {
networkAccessible = QNetworkAccessManager::Accessible; networkAccessible = QNetworkAccessManager::Accessible;
emit q->networkAccessibleChanged(networkAccessible); emit q->networkAccessibleChanged(networkAccessible);
} }
} }
online = reallyOnline;
if (online && (state != QNetworkSession::Connected && state != QNetworkSession::Roaming)) {
_q_networkSessionClosed();
createSession(q->configuration());
} }
} }
void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline) void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
{ {
Q_Q(QNetworkAccessManager); Q_Q(QNetworkAccessManager);
// if the user set a config, we only care whether this one is active. // if the user set a config, we only care whether this one is active.
// Otherwise, this QNAM is online if there is an online config. // Otherwise, this QNAM is online if there is an online config.
if (customNetworkConfiguration) { if (customNetworkConfiguration) {
online = (networkConfiguration.state() & QNetworkConfiguration::Active); online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else { } else {
if (online != isOnline) { if (online != isOnline) {
if (isOnline) { _q_networkSessionClosed();
networkSessionStrongRef.clear(); createSession(q->configuration());
networkSessionWeakRef.clear();
}
online = isOnline; online = isOnline;
} }
} }
@ -1675,11 +1695,6 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
emit q->networkAccessibleChanged(networkAccessible); emit q->networkAccessibleChanged(networkAccessible);
} }
} }
} else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined)) {
if (networkAccessible != QNetworkAccessManager::UnknownAccessibility) {
networkAccessible = QNetworkAccessManager::UnknownAccessibility;
emit q->networkAccessibleChanged(networkAccessible);
}
} else { } else {
if (networkAccessible != QNetworkAccessManager::NotAccessible) { if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible; networkAccessible = QNetworkAccessManager::NotAccessible;
@ -1688,6 +1703,50 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
} }
} }
void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfiguration &configuration)
{
const QString id = configuration.identifier();
if (configuration.state().testFlag(QNetworkConfiguration::Active)) {
if (!onlineConfigurations.contains(id)) {
QSharedPointer<QNetworkSession> session(getNetworkSession());
if (session) {
if (online && session->configuration().identifier()
!= networkConfigurationManager.defaultConfiguration().identifier()) {
onlineConfigurations.insert(id);
//this one disconnected but another one is online,
// close and create new session
_q_networkSessionClosed();
createSession(networkConfigurationManager.defaultConfiguration());
}
}
}
} else if (onlineConfigurations.contains(id)) {
//this one is disconnecting
onlineConfigurations.remove(id);
if (!onlineConfigurations.isEmpty()) {
_q_networkSessionClosed();
createSession(configuration);
}
}
}
void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::SessionError)
{
const auto cfgs = networkConfigurationManager.allConfigurations();
for (const QNetworkConfiguration &cfg : cfgs) {
if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
online = true;
_q_networkSessionClosed();
createSession(networkConfigurationManager.defaultConfiguration());
return;
}
}
}
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart) QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)

View File

@ -183,6 +183,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
Q_PRIVATE_SLOT(d_func(), void _q_onlineStateChanged(bool)) Q_PRIVATE_SLOT(d_func(), void _q_onlineStateChanged(bool))
Q_PRIVATE_SLOT(d_func(), void _q_configurationChanged(const QNetworkConfiguration &))
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed(QNetworkSession::SessionError))
#endif #endif
}; };

View File

@ -152,6 +152,11 @@ public:
bool isSeamless); bool isSeamless);
void _q_networkSessionStateChanged(QNetworkSession::State state); void _q_networkSessionStateChanged(QNetworkSession::State state);
void _q_onlineStateChanged(bool isOnline); void _q_onlineStateChanged(bool isOnline);
void _q_configurationChanged(const QNetworkConfiguration &configuration);
void _q_networkSessionFailed(QNetworkSession::SessionError error);
QSet<QString> onlineConfigurations;
#endif #endif
QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart); QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart);

View File

@ -4,7 +4,7 @@ project = QtNetwork
description = Qt Network Reference Documentation description = Qt Network Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/network examplesinstallpath = network
qhp.projects = QtNetwork qhp.projects = QtNetwork

View File

@ -199,6 +199,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
{ {
if (d == other.d) if (d == other.d)
return true; return true;
if (!d || !other.d)
return false;
return d->user == other.d->user return d->user == other.d->user
&& d->password == other.d->password && d->password == other.d->password
&& d->realm == other.d->realm && d->realm == other.d->realm

View File

@ -1,7 +1,7 @@
TARGET = QtNetwork TARGET = QtNetwork
QT = core-private QT = core-private
DEFINES += QT_NO_USING_NAMESPACE DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
#DEFINES += QLOCALSERVER_DEBUG QLOCALSOCKET_DEBUG #DEFINES += QLOCALSERVER_DEBUG QLOCALSOCKET_DEBUG
#DEFINES += QNETWORKDISKCACHE_DEBUG #DEFINES += QNETWORKDISKCACHE_DEBUG
#DEFINES += QSSLSOCKET_DEBUG #DEFINES += QSSLSOCKET_DEBUG

View File

@ -188,17 +188,26 @@ bool QHttpSocketEngine::connectToHostByName(const QString &hostname, quint16 por
bool QHttpSocketEngine::bind(const QHostAddress &, quint16) bool QHttpSocketEngine::bind(const QHostAddress &, quint16)
{ {
qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Unsupported socket operation"));
return false; return false;
} }
bool QHttpSocketEngine::listen() bool QHttpSocketEngine::listen()
{ {
qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Unsupported socket operation"));
return false; return false;
} }
int QHttpSocketEngine::accept() int QHttpSocketEngine::accept()
{ {
return 0; qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Unsupported socket operation"));
return -1;
} }
void QHttpSocketEngine::close() void QHttpSocketEngine::close()
@ -251,16 +260,18 @@ qint64 QHttpSocketEngine::write(const char *data, qint64 len)
bool QHttpSocketEngine::joinMulticastGroup(const QHostAddress &, bool QHttpSocketEngine::joinMulticastGroup(const QHostAddress &,
const QNetworkInterface &) const QNetworkInterface &)
{ {
qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError, setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Operation on socket is not supported")); QLatin1String("Unsupported socket operation"));
return false; return false;
} }
bool QHttpSocketEngine::leaveMulticastGroup(const QHostAddress &, bool QHttpSocketEngine::leaveMulticastGroup(const QHostAddress &,
const QNetworkInterface &) const QNetworkInterface &)
{ {
qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError, setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Operation on socket is not supported")); QLatin1String("Unsupported socket operation"));
return false; return false;
} }
@ -271,30 +282,39 @@ QNetworkInterface QHttpSocketEngine::multicastInterface() const
bool QHttpSocketEngine::setMulticastInterface(const QNetworkInterface &) bool QHttpSocketEngine::setMulticastInterface(const QNetworkInterface &)
{ {
qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError, setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Operation on socket is not supported")); QLatin1String("Unsupported socket operation"));
return false; return false;
} }
#endif // QT_NO_NETWORKINTERFACE #endif // QT_NO_NETWORKINTERFACE
qint64 QHttpSocketEngine::readDatagram(char *, qint64, QIpPacketHeader *, PacketHeaderOptions) qint64 QHttpSocketEngine::readDatagram(char *, qint64, QIpPacketHeader *, PacketHeaderOptions)
{ {
return 0; qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Unsupported socket operation"));
return -1;
} }
qint64 QHttpSocketEngine::writeDatagram(const char *, qint64, const QIpPacketHeader &) qint64 QHttpSocketEngine::writeDatagram(const char *, qint64, const QIpPacketHeader &)
{ {
return 0; qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Unsupported socket operation"));
return -1;
} }
bool QHttpSocketEngine::hasPendingDatagrams() const bool QHttpSocketEngine::hasPendingDatagrams() const
{ {
qWarning("Operation is not supported");
return false; return false;
} }
qint64 QHttpSocketEngine::pendingDatagramSize() const qint64 QHttpSocketEngine::pendingDatagramSize() const
{ {
return 0; qWarning("Operation is not supported");
return -1;
} }
#endif // QT_NO_UDPSOCKET #endif // QT_NO_UDPSOCKET

View File

@ -61,7 +61,6 @@
#if defined(QT_LOCALSOCKET_TCP) #if defined(QT_LOCALSOCKET_TCP)
# include "qtcpsocket.h" # include "qtcpsocket.h"
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
# include <private/qringbuffer_p.h>
# include "private/qwindowspipereader_p.h" # include "private/qwindowspipereader_p.h"
# include "private/qwindowspipewriter_p.h" # include "private/qwindowspipewriter_p.h"
# include <qwineventnotifier.h> # include <qwineventnotifier.h>
@ -134,7 +133,6 @@ public:
void _q_pipeClosed(); void _q_pipeClosed();
void _q_winError(ulong windowsError, const QString &function); void _q_winError(ulong windowsError, const QString &function);
HANDLE handle; HANDLE handle;
QRingBuffer writeBuffer;
QWindowsPipeWriter *pipeWriter; QWindowsPipeWriter *pipeWriter;
QWindowsPipeReader *pipeReader; QWindowsPipeReader *pipeReader;
QLocalSocket::LocalSocketError error; QLocalSocket::LocalSocketError error;

View File

@ -107,6 +107,7 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
error(QLocalSocket::UnknownSocketError), error(QLocalSocket::UnknownSocketError),
state(QLocalSocket::UnconnectedState) state(QLocalSocket::UnconnectedState)
{ {
writeBufferChunkSize = QIODEVICE_BUFFERSIZE;
} }
QLocalSocketPrivate::~QLocalSocketPrivate() QLocalSocketPrivate::~QLocalSocketPrivate()
@ -214,8 +215,7 @@ qint64 QLocalSocket::writeData(const char *data, qint64 len)
Q_D(QLocalSocket); Q_D(QLocalSocket);
if (len == 0) if (len == 0)
return 0; return 0;
char *dest = d->writeBuffer.reserve(len); d->writeBuffer.append(data, len);
memcpy(dest, data, len);
if (!d->pipeWriter) { if (!d->pipeWriter) {
d->pipeWriter = new QWindowsPipeWriter(d->handle, this); d->pipeWriter = new QWindowsPipeWriter(d->handle, this);
connect(d->pipeWriter, &QWindowsPipeWriter::bytesWritten, connect(d->pipeWriter, &QWindowsPipeWriter::bytesWritten,
@ -233,7 +233,6 @@ void QLocalSocket::abort()
if (d->pipeWriter) { if (d->pipeWriter) {
delete d->pipeWriter; delete d->pipeWriter;
d->pipeWriter = 0; d->pipeWriter = 0;
d->writeBuffer.clear();
} }
close(); close();
} }
@ -291,6 +290,7 @@ void QLocalSocket::close()
if (openMode() == NotOpen) if (openMode() == NotOpen)
return; return;
d->setWriteChannelCount(0);
QIODevice::close(); QIODevice::close();
d->serverName = QString(); d->serverName = QString();
d->fullServerName = QString(); d->fullServerName = QString();

View File

@ -464,6 +464,9 @@ void QNativeSocketEngine::close()
} }
#if _MSC_VER >= 1900 #if _MSC_VER >= 1900
if (d->socketType == QAbstractSocket::TcpSocket) {
hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
HRESULT hr;
// To close the connection properly (not with a hard reset) all pending read operation have to // To close the connection properly (not with a hard reset) all pending read operation have to
// be finished or cancelled. The API isn't available on Windows 8.1 though. // be finished or cancelled. The API isn't available on Windows 8.1 though.
ComPtr<IStreamSocket3> socket3; ComPtr<IStreamSocket3> socket3;
@ -475,6 +478,10 @@ void QNativeSocketEngine::close()
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(action); hr = QWinRTFunctions::await(action);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
return S_OK;
});
Q_ASSERT_SUCCEEDED(hr);
}
#endif // _MSC_VER >= 1900 #endif // _MSC_VER >= 1900
if (d->readOp) { if (d->readOp) {
@ -1271,9 +1278,12 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio
HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status) HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status)
{ {
Q_Q(QNativeSocketEngine); if (closingDown || wasDeleted || isDeletingChildren
if (wasDeleted || isDeletingChildren) || socketState == QAbstractSocket::UnconnectedState) {
return S_OK; return S_OK;
}
Q_Q(QNativeSocketEngine);
// A read in UnconnectedState will close the socket and return -1 and thus tell the caller, // A read in UnconnectedState will close the socket and return -1 and thus tell the caller,
// that the connection was closed. The socket cannot be closed here, as the subsequent read // that the connection was closed. The socket cannot be closed here, as the subsequent read

View File

@ -154,7 +154,7 @@ public:
qintptr socketDescriptor; qintptr socketDescriptor;
bool notifyOnRead, notifyOnWrite, notifyOnException; bool notifyOnRead, notifyOnWrite, notifyOnException;
bool closingDown; QAtomicInt closingDown;
enum ErrorString { enum ErrorString {
NonBlockingInitFailedErrorString, NonBlockingInitFailedErrorString,

View File

@ -213,6 +213,7 @@ bool QSslConfiguration::operator==(const QSslConfiguration &other) const
d->preSharedKeyIdentityHint == other.d->preSharedKeyIdentityHint && d->preSharedKeyIdentityHint == other.d->preSharedKeyIdentityHint &&
d->ciphers == other.d->ciphers && d->ciphers == other.d->ciphers &&
d->ellipticCurves == other.d->ellipticCurves && d->ellipticCurves == other.d->ellipticCurves &&
d->ephemeralServerKey == other.d->ephemeralServerKey &&
d->caCertificates == other.d->caCertificates && d->caCertificates == other.d->caCertificates &&
d->protocol == other.d->protocol && d->protocol == other.d->protocol &&
d->peerVerifyMode == other.d->peerVerifyMode && d->peerVerifyMode == other.d->peerVerifyMode &&
@ -254,6 +255,7 @@ bool QSslConfiguration::isNull() const
d->caCertificates.count() == 0 && d->caCertificates.count() == 0 &&
d->ciphers.count() == 0 && d->ciphers.count() == 0 &&
d->ellipticCurves.isEmpty() && d->ellipticCurves.isEmpty() &&
d->ephemeralServerKey.isNull() &&
d->localCertificateChain.isEmpty() && d->localCertificateChain.isEmpty() &&
d->privateKey.isNull() && d->privateKey.isNull() &&
d->peerCertificate.isNull() && d->peerCertificate.isNull() &&

View File

@ -88,6 +88,7 @@ public:
peerSessionShared(false), peerSessionShared(false),
sslOptions(QSslConfigurationPrivate::defaultSslOptions), sslOptions(QSslConfigurationPrivate::defaultSslOptions),
sslSessionTicketLifeTimeHint(-1), sslSessionTicketLifeTimeHint(-1),
ephemeralServerKey(),
preSharedKeyIdentityHint(), preSharedKeyIdentityHint(),
nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone) nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone)
{ } { }

View File

@ -207,7 +207,7 @@ init_context:
QList<QSslCipher> ciphers = sslContext->sslConfiguration.ciphers(); QList<QSslCipher> ciphers = sslContext->sslConfiguration.ciphers();
if (ciphers.isEmpty()) if (ciphers.isEmpty())
ciphers = QSslSocketPrivate::defaultCiphers(); ciphers = QSslSocketPrivate::defaultCiphers();
foreach (const QSslCipher &cipher, ciphers) { for (const QSslCipher &cipher : qAsConst(ciphers)) {
if (first) if (first)
first = false; first = false;
else else

View File

@ -21,7 +21,7 @@ imagedirs += images \
depends += qtdoc qtcore qtgui qtwidgets qmake depends += qtdoc qtcore qtgui qtwidgets qmake
examplesinstallpath = qtbase/opengl examplesinstallpath = opengl
# The following parameters are for creating a qhp file, the qhelpgenerator # The following parameters are for creating a qhp file, the qhelpgenerator
# program can convert the qhp file into a qch file which can be opened in # program can convert the qhp file into a qch file which can be opened in

View File

@ -1,7 +1,8 @@
TARGET = QtOpenGL TARGET = QtOpenGL
QT = core-private gui-private widgets-private QT = core-private gui-private widgets-private
DEFINES += QT_NO_USING_NAMESPACE DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused

View File

@ -4,7 +4,8 @@ CONFIG += static
contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles2):CONFIG += opengles2 contains(QT_CONFIG, opengles2):CONFIG += opengles2
DEFINES += QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
PRECOMPILED_HEADER = PRECOMPILED_HEADER =
HEADERS = qopenglextensions.h HEADERS = qopenglextensions.h

View File

@ -4,7 +4,7 @@ project = QtPlatformHeaders
description = Qt Platform Headers Reference Documentation description = Qt Platform Headers Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/qtplatformheaders examplesinstallpath = qtplatformheaders
qhp.projects = QtPlatformHeaders qhp.projects = QtPlatformHeaders

View File

@ -757,7 +757,7 @@ bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
QString QMacPasteboardMimeVCard::flavorFor(const QString &mime) QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
{ {
if (mime.startsWith(QLatin1String("text/plain"))) if (mime.startsWith(QLatin1String("text/vcard")))
return QLatin1String("public.vcard"); return QLatin1String("public.vcard");
return QString(); return QString();
} }
@ -765,14 +765,14 @@ QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
QString QMacPasteboardMimeVCard::mimeFor(QString flav) QString QMacPasteboardMimeVCard::mimeFor(QString flav)
{ {
if (flav == QLatin1String("public.vcard")) if (flav == QLatin1String("public.vcard"))
return QLatin1String("text/plain"); return QLatin1String("text/vcard");
return QString(); return QString();
} }
QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString) QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString)
{ {
QByteArray cards; QByteArray cards;
if (mime == QLatin1String("text/plain")) { if (mime == QLatin1String("text/vcard")) {
for (int i=0; i<data.size(); ++i) for (int i=0; i<data.size(); ++i)
cards += data[i]; cards += data[i];
} }
@ -782,7 +782,7 @@ QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByte
QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString) QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString)
{ {
QList<QByteArray> ret; QList<QByteArray> ret;
if (mime == QLatin1String("text/plain")) if (mime == QLatin1String("text/vcard"))
ret.append(data.toString().toUtf8()); ret.append(data.toString().toUtf8());
return ret; return ret;
} }

View File

@ -65,9 +65,10 @@ const QString MenuBarPath = QLatin1String("/MenuBar");
A D-Bus connection which is used for both menu and tray icon services. A D-Bus connection which is used for both menu and tray icon services.
Connects to the session bus and registers with the respective watcher services. Connects to the session bus and registers with the respective watcher services.
*/ */
QDBusMenuConnection::QDBusMenuConnection(QObject *parent) QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName)
: QObject(parent) : QObject(parent)
, m_connection(QDBusConnection::sessionBus()) , m_connection(serviceName.isNull() ? QDBusConnection::sessionBus()
: QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName))
, m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this)) , m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this))
, m_statusNotifierHostRegistered(false) , m_statusNotifierHostRegistered(false)
{ {

View File

@ -67,7 +67,7 @@ class QDBusMenuConnection : public QObject
Q_OBJECT Q_OBJECT
public: public:
QDBusMenuConnection(QObject *parent = 0); QDBusMenuConnection(QObject *parent = 0, const QString &serviceName = QString());
QDBusConnection connection() const { return m_connection; } QDBusConnection connection() const { return m_connection; }
bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; } bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON #ifndef QT_NO_SYSTEMTRAYICON

View File

@ -171,7 +171,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
QDBusMenuConnection * QDBusTrayIcon::dBusConnection() QDBusMenuConnection * QDBusTrayIcon::dBusConnection()
{ {
if (!m_dbusConnection) { if (!m_dbusConnection) {
m_dbusConnection = new QDBusMenuConnection(this); m_dbusConnection = new QDBusMenuConnection(this, m_instanceId);
m_notifier = new QXdgNotificationInterface(XdgNotificationService, m_notifier = new QXdgNotificationInterface(XdgNotificationService,
XdgNotificationPath, m_dbusConnection->connection(), this); XdgNotificationPath, m_dbusConnection->connection(), this);
connect(m_notifier, SIGNAL(NotificationClosed(uint,uint)), this, SLOT(notificationClosed(uint,uint))); connect(m_notifier, SIGNAL(NotificationClosed(uint,uint)), this, SLOT(notificationClosed(uint,uint)));

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