Merge 5.7 into 5.7.0

Change-Id: I416c79d9afde98efc9e78b3a74e17dfbb2409602
This commit is contained in:
Oswald Buddenhagen 2016-05-20 19:31:18 +02:00
commit 36c025a8d6
194 changed files with 1956 additions and 751 deletions

View File

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

View File

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

View File

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

View File

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

49
configure vendored
View File

@ -91,6 +91,7 @@ for i in "$@"; do
done
# initialize global variables
CONFIG_SEPARATORS=`printf ' \t'`
QMAKE_SWITCHES=
QMAKE_VARS=
QMAKE_CONFIG=
@ -348,6 +349,21 @@ getXQMakeConf()
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()
{
cat >conftest.cpp <<EOF
@ -3926,7 +3942,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_LFLAGS
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_CXXFLAGS_RELEASE
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
@ -3938,12 +3954,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
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
win32-g++*)
EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE"
@ -3994,9 +4004,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\""
fi
if [ '!' -z "$D_FLAGS" ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $D_FLAGS"
fi
echo >>"$mkfile"
adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
@ -4225,6 +4232,7 @@ compileTest()
if [ "$CFG_SHARED" = "no" ]; then
test_config="$QMAKE_CONFIG static"
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 "$@"
}
@ -5437,6 +5445,7 @@ if [ "$CFG_OPENGL" = "es2" ]; then
fi
# auto-detect FontConfig support
ORIG_CFG_FREETYPE="$CFG_FREETYPE"
if [ "$CFG_FONTCONFIG" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
@ -5630,6 +5639,11 @@ if [ "$CFG_XCB" != "no" ]; then
if [ "$CFG_XCB" = "qt" ]; then
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
CFG_XCB="system"
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
@ -6439,7 +6453,11 @@ fi
[ "$CFG_STACK_PROTECTOR_STRONG" = "yes" ] && QT_CONFIG="$QT_CONFIG stack-protector-strong"
[ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
[ "$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_ENABLE_NEW_DTAGS" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG enable_new_dtags"
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
@ -7536,6 +7554,15 @@ if [ "$CFG_SHARED" = "no" ]; then
echo "loaded plugins. Make sure to import all needed static plugins,"
echo "or compile needed modules into the library."
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
echo
echo "NOTE: When linking against OpenSSL, you can override the default"

View File

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

View File

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

View File

@ -1,6 +1,23 @@
#
# 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)

View File

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

View File

@ -11,9 +11,13 @@
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) {
# 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 {
# stupid POSIX lex, it only generates a file called lex.yy.c
# or lex.prefix.c if the -P<prefix> option is active

View File

@ -15,8 +15,7 @@ TEMPLATE = lib
CONFIG += plugin
if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
contains(QT_CONFIG, build_all):CONFIG += build_all
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
}
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]
} 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]
CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable
}

View File

@ -71,6 +71,7 @@ CONFIG += \
create_prl link_prl \
prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \
qt_example_installs \
# Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with 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")
}
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 {
TEMPLATE = aux
CONFIG -= have_target qt staticlib dll

View File

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

View File

@ -38,7 +38,7 @@ host_build {
QT += bootstrap-private
}
} 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
# - unless this is a host library
!host_build:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
contains(QT_CONFIG, build_all):CONFIG += build_all
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
}
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -188,6 +188,16 @@ headersclean:!internal_module {
!contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \
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).

View File

@ -24,10 +24,9 @@ win32:CONFIG(shared, static|shared) {
}
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 {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
contains(QT_CONFIG, build_all):CONFIG += build_all
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
}
CONFIG += relative_qt_rpath # Qt's plugins should be relocatable

View File

@ -7,6 +7,7 @@ include(../common/wince/qmake.conf)
CE_SDK = Toradex_CE800 # replace with actual SDK name
CE_ARCH = ARMV7
CE_PLATFORMNAME = Toradex_CE800
QT_CONFIG -= accessibility
DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER

View File

@ -700,6 +700,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QString slnConf = _slnSolutionConf;
if (!project->isEmpty("VCPROJ_ARCH")) {
slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH"));
} else if (!project->isEmpty("CE_PLATFORMNAME")) {
slnConf.replace(QLatin1String("|Win32"), "|" + project->first("CE_PLATFORMNAME"));
} else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
slnConf.replace(QLatin1String("|Win32"), slnPlatform);
@ -717,6 +719,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QString xplatform = platform;
if (!project->isEmpty("VCPROJ_ARCH")) {
xplatform = project->first("VCPROJ_ARCH").toQString();
} else if (!project->isEmpty("CE_PLATFORMNAME")) {
xplatform = project->first("CE_PLATFORMNAME").toQString();
} else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
}
@ -976,6 +980,8 @@ void VcprojGenerator::initProject()
vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString();
if (!project->isEmpty("VCPROJ_ARCH")) {
vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString();
} else if (!project->isEmpty("CE_PLATFORMNAME")) {
vcProject.PlatformName = project->first("CE_PLATFORMNAME").toQString();
} else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
} else {
@ -1060,6 +1066,8 @@ void VcprojGenerator::initConfiguration()
conf.ConfigurationName = conf.Name;
if (!project->isEmpty("VCPROJ_ARCH")) {
conf.Name += "|" + project->first("VCPROJ_ARCH");
} else if (!project->isEmpty("CE_PLATFORMNAME")) {
conf.Name += "|" + project->first("CE_PLATFORMNAME");
} else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
conf.Name += (is64Bit ? "|x64" : "|Win32");
} else {

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 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; }
int toInt(bool *ok = 0, int base = 10) const { return toQString().toInt(ok, base); } // XXX optimize
short toShort(bool *ok = 0, int base = 10) const { return toQString().toShort(ok, base); } // XXX optimize
int toLongLong(bool *ok = 0, int base = 10) const { return toQStringRef().toLongLong(ok, base); }
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; }
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);
}
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();
}
@ -478,9 +477,9 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
} else {
var = args[0];
sep = args.at(1).toQString();
beg = args.at(2).toQString(m_tmp2).toInt();
beg = args.at(2).toInt();
if (args.count() == 4)
end = args.at(3).toQString(m_tmp2).toInt();
end = args.at(3).toInt();
}
} else {
if (args.count() != 1) {
@ -562,7 +561,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break;
}
bool ok;
qlonglong num = m_tmp3.toLongLong(&ok, ibase);
qlonglong num = args.at(0).toLongLong(&ok, ibase);
if (!ok) {
evalError(fL1S("format_number(): malformed number %2 for base %1.")
.arg(ibase).arg(m_tmp3));
@ -639,7 +638,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
const ProStringList &var = values(map(args.at(0)));
int start = 0, end = 0;
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);
if (!ok) {
if (args.count() == 2) {
@ -652,11 +651,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
}
if (!ok)
evalError(fL1S("member() argument 2 (start) '%2' invalid.")
.arg(start_str));
.arg(start_str.toQString(m_tmp1)));
} else {
end = start;
if (args.count() == 3)
end = args.at(2).toQString(m_tmp1).toInt(&ok);
end = args.at(2).toInt(&ok);
if (!ok)
evalError(fL1S("member() argument 3 (end) '%2' invalid.")
.arg(args.at(2).toQString(m_tmp1)));
@ -904,7 +903,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
} else {
bool recursive = false;
if (args.count() == 2)
recursive = isTrue(args.at(1), m_tmp2);
recursive = isTrue(args.at(1));
QStringList dirs;
QString r = m_option->expandEnvVars(args.at(0).toQString(m_tmp1))
.replace(QLatin1Char('\\'), QLatin1Char('/'));
@ -1292,7 +1291,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse;
}
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) {
const ProString &comp = args.at(2);
if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) {
@ -1403,7 +1402,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
flags = LoadSilent;
if (args.count() >= 2) {
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;
}
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
@ -1441,7 +1440,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
case T_LOAD: {
bool ignore_error = false;
if (args.count() == 2) {
ignore_error = isTrue(args.at(1), m_tmp2);
ignore_error = isTrue(args.at(1));
} else if (args.count() != 1) {
evalError(fL1S("load(feature) requires one or two arguments."));
return ReturnFalse;

View File

@ -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();

View File

@ -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);

View File

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

View File

@ -7,4 +7,8 @@ contains(QT_CONFIG, system-zlib) {
}
} else {
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

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

View File

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

View File

@ -61,6 +61,9 @@
#include <QtCore/qfeatures.h>
#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
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else

View File

@ -54,6 +54,7 @@
#include "qthread.h"
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
#include "private/qsimd_p.h"
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@ -1193,6 +1194,89 @@ void QMessagePattern::setPattern(const QString &pattern)
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)
#ifndef QT_LOG_CODE
#define QT_LOG_CODE 9000
@ -1336,62 +1420,8 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
#ifdef QLOGGING_HAVE_BACKTRACE
} else if (token == backtraceTokenC) {
QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx);
QString backtraceSeparator = backtraceParams.backtraceSeparator;
int backtraceDepth = backtraceParams.backtraceDepth;
backtraceArgsIdx++;
QVarLengthArray<void*, 32> buffer(7 + backtraceDepth);
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++;
}
}
message.append(formatBacktraceForLogMessage(backtraceParams, context.function));
#endif
} else if (token == timeTokenC) {
QString timeFormat = pattern->timeArgs.at(timeArgsIdx);

View File

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

View File

@ -239,6 +239,17 @@
to mouse events instead. This attribute is enabled
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.
The following values are obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully

View File

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

View File

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

View File

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

View File

@ -108,25 +108,6 @@
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
{
public:
@ -164,6 +145,39 @@ private:
#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)
inline QStorageIterator::QStorageIterator()
@ -450,10 +464,8 @@ void QStorageInfoPrivate::initRootPath()
while (it.next()) {
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
if (isPseudoFs(mountDir, fsName))
continue;
// we try to find most suitable entry
if (oldRootPath.startsWith(mountDir) && maxLength < mountDir.length()) {
if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) {
maxLength = mountDir.length();
rootPath = mountDir;
device = it.device();
@ -467,11 +479,14 @@ static inline QString retrieveLabel(const QByteArray &device)
#ifdef Q_OS_LINUX
static const char pathDiskByLabel[] = "/dev/disk/by-label";
QFileInfo devinfo(QFile::decodeName(device));
QString devicePath = devinfo.canonicalFilePath();
QDirIterator it(QLatin1String(pathDiskByLabel), QDir::NoDotAndDotDot);
while (it.hasNext()) {
it.next();
QFileInfo fileInfo(it.fileInfo());
if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
return fileInfo.fileName();
}
#elif defined Q_OS_HAIKU
@ -542,11 +557,10 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
QList<QStorageInfo> volumes;
while (it.next()) {
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
if (isPseudoFs(mountDir, fsName))
if (isPseudoFs(it))
continue;
const QString mountDir = it.rootPath();
volumes.append(QStorageInfo(mountDir));
}

View File

@ -3690,7 +3690,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelAboutToBeReset()
\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.
\sa beginResetModel(), modelReset()
@ -3700,7 +3700,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelReset()
\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.
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
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 true;
@ -2819,7 +2839,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double
| 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
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong

View File

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

View File

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

View File

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

View File

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

View File

@ -102,7 +102,7 @@ public:
inline void detach() { if (d->ref.load() != 1) detach_helper(); }
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; }
#endif

View File

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

View File

@ -272,7 +272,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
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; }
#endif
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;
}
Q_CORE_EXPORT int qGlobalQHashSeed();
Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)

View File

@ -64,6 +64,9 @@ class QString;
class QStringRef;
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_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()
{ if (d->ref.isShared()) detach_helper2(this->e); }
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; }
#endif
inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; }

View File

@ -175,7 +175,7 @@ public:
}
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 == d->ref.isSharable())

View File

@ -365,7 +365,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
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 == d->ref.isSharable())

View File

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

View File

@ -85,7 +85,7 @@ public:
inline void detach() { q_hash.detach(); }
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); }
#endif

View File

@ -697,7 +697,11 @@ void qDetectCpuFeatures()
// contains all the features that the code required. Qt 4 ran for years
// 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;
# endif
#endif

View File

@ -106,7 +106,7 @@ public:
inline void detach();
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 == d->ref.isSharable())
@ -382,7 +382,7 @@ template <typename T>
void QVector<T>::detach()
{
if (!isDetached()) {
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (!d->alloc)
d = Data::unsharableEmpty();
else
@ -539,7 +539,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
x = Data::allocate(aalloc, options);
Q_CHECK_PTR(x);
// 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));
#endif
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(uint(d->size) <= d->alloc);
#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(d != Data::unsharableEmpty());
#endif
Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull());

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ project = QtGui
description = Qt GUI Reference Documentation
version = $QT_VERSION
examplesinstallpath = qtbase/gui
examplesinstallpath = gui
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 };
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;
static inline bool contains(const QJsonArray &haystack, unsigned needle)
@ -216,8 +200,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
result.number = QVersionNumber::fromString(o.value(valueKey()).toString());
const QString opS = o.value(opKey()).toString();
result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());
const QString opS = o.value(QLatin1String("op")).toString();
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
if (opS == QLatin1String(operators[i])) {
result.op = static_cast<Operator>(i);
@ -292,9 +276,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
result.type = o.value(typeKey()).toString();
result.versionTerm = VersionTerm::fromJson(o.value(versionKey()));
result.release = o.value(releaseKey()).toArray();
result.type = o.value(QLatin1String("type")).toString();
result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));
result.release = o.value(QLatin1String("release")).toArray();
return result;
}
@ -318,8 +302,8 @@ QString OsTypeTerm::hostOs()
static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)
{
QString result;
QTextStream(&result) << "Id " << object.value(idKey()).toInt()
<< " (\"" << object.value(descriptionKey()).toString()
QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()
<< " (\"" << object.value(QLatin1String("description")).toString()
<< "\"): " << what;
return result;
}
@ -333,11 +317,11 @@ static bool matches(const QJsonObject &object,
const QString &osRelease,
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))
return false;
const QJsonValue exceptionsV = object.value(exceptionsKey());
const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));
if (exceptionsV.isArray()) {
const QJsonArray exceptionsA = exceptionsV.toArray();
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 (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0))
return false;
} else {
if (object.contains(glVendorKey())) {
const QByteArray glVendorV = object.value(glVendorKey()).toString().toUtf8();
if (object.contains(QLatin1String("gl_vendor"))) {
const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();
if (!gpu.glVendor.contains(glVendorV))
return false;
}
}
if (gpu.deviceId) {
const QJsonValue deviceIdV = object.value(deviceIdKey());
const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));
switch (deviceIdV.type()) {
case QJsonValue::Array:
if (!contains(deviceIdV.toArray(), gpu.deviceId))
@ -375,7 +359,7 @@ static bool matches(const QJsonObject &object,
}
}
if (!gpu.driverVersion.isNull()) {
const QJsonValue driverVersionV = object.value(driverVersionKey());
const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));
switch (driverVersionV.type()) {
case QJsonValue::Object:
if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion))
@ -392,7 +376,7 @@ static bool matches(const QJsonObject &object,
}
if (!gpu.driverDescription.isEmpty()) {
const QJsonValue driverDescriptionV = object.value(driverDescriptionKey());
const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));
if (driverDescriptionV.isString()) {
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
return false;
@ -412,7 +396,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
{
result->clear();
errorMessage->clear();
const QJsonValue entriesV = doc.object().value(QStringLiteral("entries"));
const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));
if (!entriesV.isArray()) {
*errorMessage = QLatin1String("No entries read.");
return false;
@ -423,7 +407,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
if (eit->isObject()) {
const QJsonObject object = eit->toObject();
if (matches(object, osName, kernelVersion, osRelease, gpu)) {
const QJsonValue featuresListV = object.value(featuresKey());
const QJsonValue featuresListV = object.value(QLatin1String("features"));
if (featuresListV.isArray()) {
const QJsonArray featuresListA = featuresListV.toArray();
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);
// 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);
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.
qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5;
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;
QColor uc = charFormat.underlineColor();
if (uc.isValid())

View File

@ -232,7 +232,8 @@ void QPlatformTextureList::clear()
Flushes the given \a region from the specified \a window onto the
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

View File

@ -428,7 +428,7 @@ void QStroker::processCurrentSubpath()
bool fwclosed = qt_stroke_side(&fwit, this, false, &fwStartTangent);
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);
}

View File

@ -480,6 +480,9 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
//
connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
SLOT(_q_onlineStateChanged(bool)));
connect(&d->networkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration &)),
SLOT(_q_configurationChanged(const QNetworkConfiguration &)));
#endif
}
@ -1570,6 +1573,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(stateChanged(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)
@ -1577,7 +1582,6 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
networkSessionWeakRef = networkSessionStrongRef.toWeakRef();
if (!networkSessionStrongRef) {
online = false;
if (networkAccessible == QNetworkAccessManager::NotAccessible || !online)
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
@ -1593,6 +1597,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::connect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
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());
}
@ -1609,6 +1615,9 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
networkSessionStrongRef.clear();
networkSessionWeakRef.clear();
}
@ -1617,46 +1626,57 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state)
{
Q_Q(QNetworkAccessManager);
bool reallyOnline = false;
//Do not emit the networkSessionConnected signal here, except for roaming -> connected
//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();
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) {
online = false;
if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible;
emit q->networkAccessibleChanged(networkAccessible);
}
}
} else {
if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
online = true;
if (defaultAccessControl)
if (networkAccessible != QNetworkAccessManager::Accessible) {
networkAccessible = QNetworkAccessManager::Accessible;
emit q->networkAccessibleChanged(networkAccessible);
}
}
if (defaultAccessControl)
if (networkAccessible != QNetworkAccessManager::Accessible) {
networkAccessible = QNetworkAccessManager::Accessible;
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)
{
Q_Q(QNetworkAccessManager);
// 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.
if (customNetworkConfiguration) {
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
if (online != isOnline) {
if (isOnline) {
networkSessionStrongRef.clear();
networkSessionWeakRef.clear();
}
_q_networkSessionClosed();
createSession(q->configuration());
online = isOnline;
}
}
@ -1667,11 +1687,6 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
emit q->networkAccessibleChanged(networkAccessible);
}
}
} else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined)) {
if (networkAccessible != QNetworkAccessManager::UnknownAccessibility) {
networkAccessible = QNetworkAccessManager::UnknownAccessibility;
emit q->networkAccessibleChanged(networkAccessible);
}
} else {
if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible;
@ -1680,6 +1695,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
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)

View File

@ -182,6 +182,8 @@ private:
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_onlineStateChanged(bool))
Q_PRIVATE_SLOT(d_func(), void _q_configurationChanged(const QNetworkConfiguration &))
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed(QNetworkSession::SessionError))
#endif
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -464,17 +464,24 @@ void QNativeSocketEngine::close()
}
#if _MSC_VER >= 1900
// 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.
ComPtr<IStreamSocket3> socket3;
hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3));
Q_ASSERT_SUCCEEDED(hr);
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
// be finished or cancelled. The API isn't available on Windows 8.1 though.
ComPtr<IStreamSocket3> socket3;
hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3));
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IAsyncAction> action;
hr = socket3->CancelIOAsync(&action);
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(action);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IAsyncAction> action;
hr = socket3->CancelIOAsync(&action);
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(action);
Q_ASSERT_SUCCEEDED(hr);
return S_OK;
});
Q_ASSERT_SUCCEEDED(hr);
}
#endif // _MSC_VER >= 1900
if (d->readOp) {
@ -1271,9 +1278,12 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio
HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status)
{
Q_Q(QNativeSocketEngine);
if (wasDeleted || isDeletingChildren)
if (closingDown || wasDeleted || isDeletingChildren
|| socketState == QAbstractSocket::UnconnectedState) {
return S_OK;
}
Q_Q(QNativeSocketEngine);
// 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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ imagedirs += images \
depends += qtdoc qtcore qtgui qtwidgets qmake
examplesinstallpath = qtbase/opengl
examplesinstallpath = opengl
# 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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,9 +51,9 @@
// We mean it.
//
#include <EGL/egl.h>
#include <qpa/qplatformoffscreensurface.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE

View File

@ -43,6 +43,7 @@
#include <qpa/qplatformwindow.h>
#include <QtGui/qscreen.h>
#include <QtGui/qpainter.h>
QT_BEGIN_NAMESPACE
@ -90,9 +91,17 @@ void QFbBackingStore::unlock()
mImageMutex.unlock();
}
void QFbBackingStore::beginPaint(const QRegion &)
void QFbBackingStore::beginPaint(const QRegion &region)
{
lock();
if (mImage.hasAlphaChannel()) {
QPainter p(&mImage);
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = region.rects();
for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
p.fillRect(*it, Qt::transparent);
}
}
void QFbBackingStore::endPaint()

View File

@ -239,6 +239,7 @@ QRegion QFbScreen::doRedraw()
if (!mCompositePainter)
mCompositePainter = new QPainter(mScreenImage);
for (int rectIndex = 0; rectIndex < mRepaintRegion.rectCount(); rectIndex++) {
QRegion rectRegion = rects[rectIndex];
@ -256,7 +257,8 @@ QRegion QFbScreen::doRedraw()
foreach (const QRect &rect, intersect.rects()) {
bool firstLayer = true;
if (layer == -1) {
mCompositePainter->fillRect(rect, Qt::black);
mCompositePainter->setCompositionMode(QPainter::CompositionMode_Source);
mCompositePainter->fillRect(rect, mScreenImage->hasAlphaChannel() ? Qt::transparent : Qt::black);
firstLayer = false;
layer = mWindowStack.size() - 1;
}
@ -289,6 +291,7 @@ QRegion QFbScreen::doRedraw()
QRect cursorRect;
if (mCursor && (mCursor->isDirty() || mRepaintRegion.intersects(mCursor->lastPainted()))) {
mCompositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver);
cursorRect = mCursor->drawCursor(*mCompositePainter);
touchedRegion += cursorRect;
}

View File

@ -373,7 +373,7 @@ static QByteArray filenameForCFUrl(CFURLRef url)
if (!CFURLGetFileSystemRepresentation(url, true, buffer, sizeof(buffer))) {
qWarning("QCoreTextFontDatabase::filenameForCFUrl: could not resolve file for URL %s",
qPrintable(QString::fromCFString(CFURLGetString(url))));
url ? qPrintable(QString::fromCFString(CFURLGetString(url))) : "(null)");
} else {
QCFType<CFStringRef> scheme = CFURLCopyScheme(url);
if (QString::fromCFString(scheme) == QLatin1String("qrc"))

View File

@ -47,6 +47,49 @@
#include <cmath>
#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
#import <AppKit/AppKit.h>
#endif
#if defined(Q_OS_IOS) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
#import <UIKit/UIKit.h>
#endif
// These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework,
// but they are not documented and are not in public headers so are private API and exposed
// only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857)
#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2)
#define kCTFontWeightUltraLight -0.8
#define kCTFontWeightThin -0.6
#define kCTFontWeightLight -0.4
#define kCTFontWeightRegular 0
#define kCTFontWeightMedium 0.23
#define kCTFontWeightSemibold 0.3
#define kCTFontWeightBold 0.4
#define kCTFontWeightHeavy 0.56
#define kCTFontWeightBlack 0.62
#elif defined(Q_OS_OSX)
#define kCTFontWeightUltraLight NSFontWeightUltraLight
#define kCTFontWeightThin NSFontWeightThin
#define kCTFontWeightLight NSFontWeightLight
#define kCTFontWeightRegular NSFontWeightRegular
#define kCTFontWeightMedium NSFontWeightMedium
#define kCTFontWeightSemibold NSFontWeightSemibold
#define kCTFontWeightBold NSFontWeightBold
#define kCTFontWeightHeavy NSFontWeightHeavy
#define kCTFontWeightBlack NSFontWeightBlack
#elif defined(Q_OS_IOS)
#define kCTFontWeightUltraLight UIFontWeightUltraLight
#define kCTFontWeightThin UIFontWeightThin
#define kCTFontWeightLight UIFontWeightLight
#define kCTFontWeightRegular UIFontWeightRegular
#define kCTFontWeightMedium UIFontWeightMedium
#define kCTFontWeightSemibold UIFontWeightSemibold
#define kCTFontWeightBold UIFontWeightBold
#define kCTFontWeightHeavy UIFontWeightHeavy
#define kCTFontWeightBlack UIFontWeightBlack
#endif
QT_BEGIN_NAMESPACE
static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f);
@ -69,24 +112,24 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff
QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value)
{
if (value >= 0.62)
if (value >= kCTFontWeightBlack)
return QFont::Black;
if (value >= 0.5)
if (value >= kCTFontWeightHeavy)
return QFont::ExtraBold;
if (value >= 0.4)
if (value >= kCTFontWeightBold)
return QFont::Bold;
if (value >= 0.3)
if (value >= kCTFontWeightSemibold)
return QFont::DemiBold;
if (value >= 0.2)
if (value >= kCTFontWeightMedium)
return QFont::Medium;
if (value == 0.0)
if (value == kCTFontWeightRegular)
return QFont::Normal;
if (value <= -0.4)
return QFont::Light;
if (value <= -0.6)
return QFont::ExtraLight;
if (value <= -0.8)
if (value <= kCTFontWeightUltraLight)
return QFont::Thin;
if (value <= kCTFontWeightThin)
return QFont::ExtraLight;
if (value <= kCTFontWeightLight)
return QFont::Light;
return QFont::Normal;
}

View File

@ -41,7 +41,6 @@
#include "platformdefs.h"
#include <QtCore/qmutex.h>
#include <QtCore/private/qmutexpool_p.h>
#include <QtCore/qlibrary.h>
#include <QtNetwork/private/qbearerplugin_p.h>
@ -52,42 +51,32 @@
QT_BEGIN_NAMESPACE
static void resolveLibrary()
static bool resolveLibraryInternal()
{
static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
if (!triedResolve.loadAcquire()) {
#ifndef QT_NO_THREAD
QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle));
#endif
if (!triedResolve.load()) {
QLibrary wlanapiLib(QLatin1String("wlanapi"));
local_WlanOpenHandle = (WlanOpenHandleProto)
wlanapiLib.resolve("WlanOpenHandle");
local_WlanRegisterNotification = (WlanRegisterNotificationProto)
wlanapiLib.resolve("WlanRegisterNotification");
local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
wlanapiLib.resolve("WlanEnumInterfaces");
local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
wlanapiLib.resolve("WlanGetAvailableNetworkList");
local_WlanQueryInterface = (WlanQueryInterfaceProto)
wlanapiLib.resolve("WlanQueryInterface");
local_WlanConnect = (WlanConnectProto)
wlanapiLib.resolve("WlanConnect");
local_WlanDisconnect = (WlanDisconnectProto)
wlanapiLib.resolve("WlanDisconnect");
local_WlanScan = (WlanScanProto)
wlanapiLib.resolve("WlanScan");
local_WlanFreeMemory = (WlanFreeMemoryProto)
wlanapiLib.resolve("WlanFreeMemory");
local_WlanCloseHandle = (WlanCloseHandleProto)
wlanapiLib.resolve("WlanCloseHandle");
triedResolve.storeRelease(true);
}
}
QLibrary wlanapiLib(QLatin1String("wlanapi"));
local_WlanOpenHandle = (WlanOpenHandleProto)
wlanapiLib.resolve("WlanOpenHandle");
local_WlanRegisterNotification = (WlanRegisterNotificationProto)
wlanapiLib.resolve("WlanRegisterNotification");
local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
wlanapiLib.resolve("WlanEnumInterfaces");
local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
wlanapiLib.resolve("WlanGetAvailableNetworkList");
local_WlanQueryInterface = (WlanQueryInterfaceProto)
wlanapiLib.resolve("WlanQueryInterface");
local_WlanConnect = (WlanConnectProto)
wlanapiLib.resolve("WlanConnect");
local_WlanDisconnect = (WlanDisconnectProto)
wlanapiLib.resolve("WlanDisconnect");
local_WlanScan = (WlanScanProto)
wlanapiLib.resolve("WlanScan");
local_WlanFreeMemory = (WlanFreeMemoryProto)
wlanapiLib.resolve("WlanFreeMemory");
local_WlanCloseHandle = (WlanCloseHandleProto)
wlanapiLib.resolve("WlanCloseHandle");
return true;
}
Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
class QNativeWifiEnginePlugin : public QBearerEnginePlugin
{

View File

@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
typedef struct
{
quint8 bWidth; // Width of the image
quint8 bHeight; // Height of the image (times 2)
quint8 bHeight; // Height of the image (actual height, not times 2)
quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ]
quint8 bReserved; // Reserved
quint16 wPlanes; // Color Planes
@ -687,8 +687,8 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
entries[i].bColorCount = 0;
entries[i].bReserved = 0;
entries[i].wBitCount = nbits;
entries[i].bHeight = image.height();
entries[i].bWidth = image.width();
entries[i].bHeight = image.height() < 256 ? image.height() : 0; // 0 means 256
entries[i].bWidth = image.width() < 256 ? image.width() : 0; // 0 means 256
entries[i].dwBytesInRes = BMP_INFOHDR_SIZE + (bpl_bmp * image.height())
+ (maskImage.bytesPerLine() * maskImage.height());
entries[i].wPlanes = 1;
@ -702,11 +702,11 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
bmpHeaders[i].biClrImportant = 0;
bmpHeaders[i].biClrUsed = entries[i].bColorCount;
bmpHeaders[i].biCompression = 0;
bmpHeaders[i].biHeight = entries[i].bHeight * 2; // 2 is for the mask
bmpHeaders[i].biHeight = entries[i].bHeight ? entries[i].bHeight * 2 : 256 * 2; // 2 is for the mask
bmpHeaders[i].biPlanes = entries[i].wPlanes;
bmpHeaders[i].biSize = BMP_INFOHDR_SIZE;
bmpHeaders[i].biSizeImage = entries[i].dwBytesInRes - BMP_INFOHDR_SIZE;
bmpHeaders[i].biWidth = entries[i].bWidth;
bmpHeaders[i].biWidth = entries[i].bWidth ? entries[i].bWidth : 256;
bmpHeaders[i].biXPelsPerMeter = 0;
bmpHeaders[i].biYPelsPerMeter = 0;

View File

@ -58,7 +58,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview)
[button setButtonType:NSMomentaryLightButton];
[button setBezelStyle:NSRoundedBezelStyle];
[button setTitle:(NSString*)(CFStringRef)QCFString(
QPlatformTheme::removeMnemonics(QCoreApplication::translate("QDialogButtonBox", text)))];
QPlatformTheme::removeMnemonics(QCoreApplication::translate("QPlatformTheme", text)))];
[[button cell] setFont:[NSFont systemFontOfSize:
[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
[superview addSubview:button];

View File

@ -179,7 +179,9 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
}
}
nativeItemForMenu(cocoaMenu).hidden = shouldHide;
NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu);
nativeMenuItem.title = cocoaMenu->nsMenu().title;
nativeMenuItem.hidden = shouldHide;
}
NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const

View File

@ -118,6 +118,8 @@ QCocoaMenuItem::~QCocoaMenuItem()
if (m_merged) {
[m_native setHidden:YES];
} else {
if (m_menu && m_menu->attachedItem() == m_native)
m_menu->setAttachedItem(nil);
[m_native release];
}

View File

@ -44,6 +44,7 @@
#include <qpa/qplatformwindow.h>
#include <QRect>
#include <QPointer>
#ifndef QT_NO_OPENGL
#include "qcocoaglcontext.h"
@ -53,6 +54,32 @@
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
QT_BEGIN_NAMESPACE
class QCocoaWindowPointer
{
public:
void assign(QCocoaWindow *w);
void clear();
QCocoaWindow *data() const
{ return watcher.isNull() ? Q_NULLPTR : window; }
bool isNull() const
{ return watcher.isNull(); }
operator QCocoaWindow*() const
{ return data(); }
QCocoaWindow *operator->() const
{ return data(); }
QCocoaWindow &operator*() const
{ return *data(); }
private:
QPointer<QObject> watcher;
QCocoaWindow *window;
};
QT_END_NAMESPACE
@class QT_MANGLE_NAMESPACE(QNSWindowHelper);
@protocol QNSWindowProtocol
@ -69,14 +96,13 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@interface QT_MANGLE_NAMESPACE(QNSWindowHelper) : NSObject
{
QCocoaNSWindow *_window;
QCocoaWindow *_platformWindow;
QCocoaWindowPointer _platformWindow;
BOOL _grabbingMouse;
BOOL _releaseOnMouseUp;
QPointer<QObject> _watcher;
}
@property (nonatomic, readonly) QCocoaNSWindow *window;
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
@property (nonatomic, readonly) QCocoaWindowPointer platformWindow;
@property (nonatomic) BOOL grabbingMouse;
@property (nonatomic) BOOL releaseOnMouseUp;
@ -260,7 +286,7 @@ public: // for QNSView
NSView *m_contentView;
QNSView *m_qtView;
QCocoaNSWindow *m_nsWindow;
QCocoaWindow *m_forwardWindow;
QCocoaWindowPointer m_forwardWindow;
// TODO merge to one variable if possible
bool m_contentViewIsEmbedded; // true if the m_contentView is actually embedded in a "foreign" NSView hiearchy
@ -323,9 +349,8 @@ public: // for QNSView
QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower
QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false)
// This object is tracked by a 'watcher'
// object in a window helper, preventing use of dangling
// pointers.
// This object is tracked by QCocoaWindowPointer,
// preventing the use of dangling pointers.
QObject sentinel;
};

View File

@ -90,7 +90,7 @@ static bool isMouseEvent(NSEvent *ev)
self = [super init];
if (self) {
_window = window;
_platformWindow = platformWindow;
_platformWindow.assign(platformWindow);
_window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow];
@ -99,7 +99,6 @@ static bool isMouseEvent(NSEvent *ev)
// make sure that m_nsWindow stays valid until the
// QCocoaWindow is deleted by Qt.
[_window setReleasedWhenClosed:NO];
_watcher = &_platformWindow->sentinel;
}
return self;
@ -108,19 +107,19 @@ static bool isMouseEvent(NSEvent *ev)
- (void)handleWindowEvent:(NSEvent *)theEvent
{
QCocoaWindow *pw = self.platformWindow;
if (_watcher && pw && pw->m_forwardWindow) {
if (pw && pw->m_forwardWindow) {
if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) {
QNSView *forwardView = pw->m_qtView;
if (theEvent.type == NSLeftMouseUp) {
[forwardView mouseUp:theEvent];
pw->m_forwardWindow = 0;
pw->m_forwardWindow.clear();
} else {
[forwardView mouseDragged:theEvent];
}
}
if (!pw->m_isNSWindowChild && theEvent.type == NSLeftMouseDown) {
pw->m_forwardWindow = 0;
pw->m_forwardWindow.clear();
}
}
@ -147,7 +146,7 @@ static bool isMouseEvent(NSEvent *ev)
if (!self.window.delegate)
return; // Already detached, pending NSAppKitDefined event
if (_watcher && pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) {
if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) {
NSPoint loc = [theEvent locationInWindow];
NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]];
NSRect contentFrame = [[self.window contentView] frame];
@ -162,8 +161,7 @@ static bool isMouseEvent(NSEvent *ev)
- (void)detachFromPlatformWindow
{
_platformWindow = 0;
_watcher.clear();
self.platformWindow.clear();
[self.window.delegate release];
self.window.delegate = nil;
}
@ -184,7 +182,7 @@ static bool isMouseEvent(NSEvent *ev)
- (void)dealloc
{
_window = nil;
_platformWindow = 0;
self.platformWindow.clear();
[super dealloc];
}
@ -336,6 +334,18 @@ static bool isMouseEvent(NSEvent *ev)
@end
void QCocoaWindowPointer::assign(QCocoaWindow *w)
{
window = w;
watcher = &w->sentinel;
}
void QCocoaWindowPointer::clear()
{
window = Q_NULLPTR;
watcher.clear();
}
const int QCocoaWindow::NoAlertRequest = -1;
QCocoaWindow::QCocoaWindow(QWindow *tlw)
@ -343,7 +353,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_contentView(nil)
, m_qtView(nil)
, m_nsWindow(0)
, m_forwardWindow(0)
, m_contentViewIsEmbedded(false)
, m_contentViewIsToBeEmbedded(false)
, m_parentCocoaWindow(0)
@ -1138,8 +1147,7 @@ bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
if (grab && ![m_nsWindow isKeyWindow])
[m_nsWindow makeKeyWindow];
else if (!grab && [m_nsWindow isKeyWindow])
[m_nsWindow resignKeyWindow];
return true;
}
@ -1151,8 +1159,7 @@ bool QCocoaWindow::setMouseGrabEnabled(bool grab)
if (grab && ![m_nsWindow isKeyWindow])
[m_nsWindow makeKeyWindow];
else if (!grab && [m_nsWindow isKeyWindow])
[m_nsWindow resignKeyWindow];
return true;
}
@ -1339,7 +1346,7 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
if (oldParentCocoaWindow) {
if (!m_isNSWindowChild || oldParentCocoaWindow != m_parentCocoaWindow)
oldParentCocoaWindow->removeChildWindow(this);
m_forwardWindow = oldParentCocoaWindow;
m_forwardWindow.assign(oldParentCocoaWindow);
}
setNSWindow(m_nsWindow);

View File

@ -290,6 +290,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToWindow
{
m_backingStore = Q_NULLPTR;
m_isMenuView = [self.window.className isEqualToString:@"NSCarbonMenuWindow"];
if (self.window) {
// This is the case of QWidgetAction's generated QWidget inserted in an NSMenu.
@ -760,7 +761,7 @@ QT_WARNING_POP
if (theEvent.type == NSLeftMouseDragged || theEvent.type == NSLeftMouseUp)
targetView = m_platformWindow->m_forwardWindow->m_qtView;
else
m_platformWindow->m_forwardWindow = 0;
m_platformWindow->m_forwardWindow.clear();
}
// Popups implicitly grap mouse events; forward to the active popup if there is one

View File

@ -48,6 +48,7 @@
#include <QtCore/QJsonArray>
#include <QtCore/QLoggingCategory>
#include <QtGui/QPainter>
#include <QtGui/private/qguiapplication_p.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
@ -69,13 +70,13 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
, m_cursorSize(64, 64) // 64x64 is the old standard size, we now try to query the real size below
, m_bo(Q_NULLPTR)
, m_cursorImage(0, 0, 0, 0, 0, 0)
, m_visible(true)
, m_state(CursorPendingVisible)
{
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
if (!hideCursorVal.isEmpty())
m_visible = hideCursorVal.toInt() == 0;
if (!m_visible)
if (!hideCursorVal.isEmpty() && hideCursorVal.toInt()) {
m_state = CursorDisabled;
return;
}
uint64_t width, height;
if ((drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_WIDTH, &width) == 0)
@ -92,6 +93,12 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
initCursorAtlas();
}
m_deviceListener = new QEglFSKmsGbmCursorDeviceListener(this);
connect(QGuiApplicationPrivate::inputDeviceManager(), &QInputDeviceManager::deviceListChanged,
m_deviceListener, &QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged);
if (!m_deviceListener->hasMouse())
m_state = CursorPendingHidden;
#ifndef QT_NO_CURSOR
QCursor cursor(Qt::ArrowCursor);
changeCursor(&cursor, 0);
@ -101,6 +108,8 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor()
{
delete m_deviceListener;
Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
@ -113,6 +122,31 @@ QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor()
}
}
void QEglFSKmsGbmCursor::updateMouseStatus()
{
const bool wasVisible = m_state == CursorVisible;
const bool visible = m_deviceListener->hasMouse();
if (visible == wasVisible)
return;
m_state = visible ? CursorPendingVisible : CursorPendingHidden;
#ifndef QT_NO_CURSOR
changeCursor(nullptr, m_screen->topLevelAt(pos()));
#endif
}
bool QEglFSKmsGbmCursorDeviceListener::hasMouse() const
{
return QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
}
void QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::DeviceType type)
{
if (type == QInputDeviceManager::DeviceTypePointer)
m_cursor->updateMouseStatus();
}
void QEglFSKmsGbmCursor::pointerEvent(const QMouseEvent &event)
{
setPos(event.screenPos().toPoint());
@ -126,7 +160,15 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
if (!m_bo)
return;
if (!m_visible)
if (m_state == CursorPendingHidden) {
m_state = CursorHidden;
Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
}
}
if (m_state == CursorHidden || m_state == CursorDisabled)
return;
const Qt::CursorShape newShape = windowCursor ? windowCursor->shape() : Qt::ArrowCursor;
@ -166,6 +208,9 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
uint32_t handle = gbm_bo_get_handle(m_bo).u32;
if (m_state == CursorPendingVisible)
m_state = CursorVisible;
Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
@ -213,7 +258,7 @@ void QEglFSKmsGbmCursor::initCursorAtlas()
drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
drmModeMoveCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0);
}
m_visible = false;
m_state = CursorDisabled;
return;
}

View File

@ -43,12 +43,29 @@
#include <qpa/qplatformcursor.h>
#include <QtCore/QList>
#include <QtGui/QImage>
#include <QtGui/private/qinputdevicemanager_p.h>
#include <gbm.h>
QT_BEGIN_NAMESPACE
class QEglFSKmsGbmScreen;
class QEglFSKmsGbmCursor;
class QEglFSKmsGbmCursorDeviceListener : public QObject
{
Q_OBJECT
public:
QEglFSKmsGbmCursorDeviceListener(QEglFSKmsGbmCursor *cursor) : m_cursor(cursor) { }
bool hasMouse() const;
public slots:
void onDeviceListChanged(QInputDeviceManager::DeviceType type);
private:
QEglFSKmsGbmCursor *m_cursor;
};
class QEglFSKmsGbmCursor : public QPlatformCursor
{
@ -66,15 +83,26 @@ public:
QPoint pos() const Q_DECL_OVERRIDE;
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
void updateMouseStatus();
private:
void initCursorAtlas();
enum CursorState {
CursorDisabled,
CursorPendingHidden,
CursorHidden,
CursorPendingVisible,
CursorVisible
};
QEglFSKmsGbmScreen *m_screen;
QSize m_cursorSize;
gbm_bo *m_bo;
QPoint m_pos;
QPlatformCursorImage m_cursorImage;
bool m_visible;
CursorState m_state;
QEglFSKmsGbmCursorDeviceListener *m_deviceListener;
// cursor atlas information
struct CursorAtlas {

View File

@ -37,6 +37,7 @@
**
****************************************************************************/
#include "qeglfsglobal.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>

View File

@ -40,9 +40,9 @@
#ifndef QEGLFSCONTEXT_H
#define QEGLFSCONTEXT_H
#include "qeglfsglobal.h"
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant>
#include "qeglfsglobal.h"
QT_BEGIN_NAMESPACE

View File

@ -51,13 +51,12 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
#include <QtCore/QString>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QImage>
#include <EGL/egl.h>
#include "qeglfsglobal.h"
QT_BEGIN_NAMESPACE

View File

@ -48,4 +48,17 @@
#define Q_EGLFS_EXPORT Q_DECL_IMPORT
#endif
#include <EGL/egl.h>
#undef Status
#undef None
#undef Bool
#undef CursorShape
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef Expose
#undef Unsorted
#endif

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