Merge "Merge remote-tracking branch 'origin/dev' into wip/qt6"

This commit is contained in:
Alexandru Croitor 2019-07-08 12:32:29 +02:00
commit f44850b5c3
434 changed files with 4447 additions and 2580 deletions

View File

@ -1,6 +1,8 @@
load(qt_build_config) load(qt_build_config)
CONFIG += warning_clean CONFIG += warning_clean
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
QT_SOURCE_TREE = $$PWD QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD) QT_BUILD_TREE = $$shadowed($$PWD)

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qt3d.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtactiveqt.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtandroidextras.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtbase.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtcharts.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtconnectivity.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtdatavis3d.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtdoc.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtgamepad.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtgraphicaleffects.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtimageformats.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtlocation.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtlottie.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtmacextras.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtnetworkauth.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtpurchasing.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtquickcontrols.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtremoteobjects.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtscript.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtscxml.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtsensors.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtserialbus.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtserialport.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtspeech.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtsvg.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qttools.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtvirtualkeyboard.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwayland.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwebchannel.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwebengine.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwebsockets.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwebview.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtwinextras.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtx11extras.git/tree/examples/\1?h=$QT_VER"

View File

@ -0,0 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtxmlpatterns.git/tree/examples/\1?h=$QT_VER"

View File

@ -118,6 +118,7 @@ Cpp.ignoretokens += \
Q_POSITIONING_EXPORT \ Q_POSITIONING_EXPORT \
Q_MULTIMEDIA_EXPORT \ Q_MULTIMEDIA_EXPORT \
Q_NAMESPACE \ Q_NAMESPACE \
Q_NAMESPACE_EXPORT \
Q_NETWORK_EXPORT \ Q_NETWORK_EXPORT \
Q_NEVER_INLINE \ Q_NEVER_INLINE \
Q_NORETURN \ Q_NORETURN \

View File

@ -79,6 +79,32 @@ QVariant addAuthor(QSqlQuery &q, const QString &name, const QDate &birthdate)
return q.lastInsertId(); return q.lastInsertId();
} }
const auto BOOKS_SQL = QLatin1String(R"(
create table books(id integer primary key, title varchar, author integer,
genre integer, year integer, rating integer)
)");
const auto AUTHORS_SQL = QLatin1String(R"(
create table authors(id integer primary key, name varchar, birthdate date)
)");
const auto GENRES_SQL = QLatin1String(R"(
create table genres(id integer primary key, name varchar)
)");
const auto INSERT_AUTHOR_SQL = QLatin1String(R"(
insert into authors(name, birthdate) values(?, ?)
)");
const auto INSERT_BOOK_SQL = QLatin1String(R"(
insert into books(title, year, author, genre, rating)
values(?, ?, ?, ?, ?)
)");
const auto INSERT_GENRE_SQL = QLatin1String(R"(
insert into genres(name) values(?)
)");
QSqlError initDb() QSqlError initDb()
{ {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
@ -93,26 +119,26 @@ QSqlError initDb()
return QSqlError(); return QSqlError();
QSqlQuery q; QSqlQuery q;
if (!q.exec(QLatin1String("create table books(id integer primary key, title varchar, author integer, genre integer, year integer, rating integer)"))) if (!q.exec(BOOKS_SQL))
return q.lastError(); return q.lastError();
if (!q.exec(QLatin1String("create table authors(id integer primary key, name varchar, birthdate date)"))) if (!q.exec(AUTHORS_SQL))
return q.lastError(); return q.lastError();
if (!q.exec(QLatin1String("create table genres(id integer primary key, name varchar)"))) if (!q.exec(GENRES_SQL))
return q.lastError(); return q.lastError();
if (!q.prepare(QLatin1String("insert into authors(name, birthdate) values(?, ?)"))) if (!q.prepare(INSERT_AUTHOR_SQL))
return q.lastError(); return q.lastError();
QVariant asimovId = addAuthor(q, QLatin1String("Isaac Asimov"), QDate(1920, 2, 1)); QVariant asimovId = addAuthor(q, QLatin1String("Isaac Asimov"), QDate(1920, 2, 1));
QVariant greeneId = addAuthor(q, QLatin1String("Graham Greene"), QDate(1904, 10, 2)); QVariant greeneId = addAuthor(q, QLatin1String("Graham Greene"), QDate(1904, 10, 2));
QVariant pratchettId = addAuthor(q, QLatin1String("Terry Pratchett"), QDate(1948, 4, 28)); QVariant pratchettId = addAuthor(q, QLatin1String("Terry Pratchett"), QDate(1948, 4, 28));
if (!q.prepare(QLatin1String("insert into genres(name) values(?)"))) if (!q.prepare(INSERT_GENRE_SQL))
return q.lastError(); return q.lastError();
QVariant sfiction = addGenre(q, QLatin1String("Science Fiction")); QVariant sfiction = addGenre(q, QLatin1String("Science Fiction"));
QVariant fiction = addGenre(q, QLatin1String("Fiction")); QVariant fiction = addGenre(q, QLatin1String("Fiction"));
QVariant fantasy = addGenre(q, QLatin1String("Fantasy")); QVariant fantasy = addGenre(q, QLatin1String("Fantasy"));
if (!q.prepare(QLatin1String("insert into books(title, year, author, genre, rating) values(?, ?, ?, ?, ?)"))) if (!q.prepare(INSERT_BOOK_SQL))
return q.lastError(); return q.lastError();
addBook(q, QLatin1String("Foundation"), 1951, asimovId, sfiction, 3); addBook(q, QLatin1String("Foundation"), 1951, asimovId, sfiction, 3);
addBook(q, QLatin1String("Foundation and Empire"), 1952, asimovId, sfiction, 4); addBook(q, QLatin1String("Foundation and Empire"), 1952, asimovId, sfiction, 4);

View File

@ -269,7 +269,7 @@
\codeline \codeline
\snippet itemviews/stardelegate/main.cpp 4 \snippet itemviews/stardelegate/main.cpp 4
Notice the call to qVariantFromValue to convert a \c Notice the call to QVariant::fromValue to convert a \c
StarRating to a QVariant. StarRating to a QVariant.
\section1 Possible Extensions and Suggestions \section1 Possible Extensions and Suggestions

View File

@ -64,9 +64,9 @@ void NorwegianWoodStyle::polish(QPalette &palette)
QColor beige(236, 182, 120); QColor beige(236, 182, 120);
QColor slightlyOpaqueBlack(0, 0, 0, 63); QColor slightlyOpaqueBlack(0, 0, 0, 63);
QPixmap backgroundImage(":/images/woodbackground.png"); QImage backgroundImage(":/images/woodbackground.png");
QPixmap buttonImage(":/images/woodbutton.png"); QImage buttonImage(":/images/woodbutton.png");
QPixmap midImage = buttonImage; QImage midImage = buttonImage.convertToFormat(QImage::Format_RGB32);
QPainter painter; QPainter painter;
painter.begin(&midImage); painter.begin(&midImage);
@ -311,11 +311,12 @@ void NorwegianWoodStyle::drawControl(ControlElement element,
//! [37] //! [37]
void NorwegianWoodStyle::setTexture(QPalette &palette, QPalette::ColorRole role, void NorwegianWoodStyle::setTexture(QPalette &palette, QPalette::ColorRole role,
//! [37] //! [38] //! [37] //! [38]
const QPixmap &pixmap) const QImage &image)
{ {
for (int i = 0; i < QPalette::NColorGroups; ++i) { for (int i = 0; i < QPalette::NColorGroups; ++i) {
QColor color = palette.brush(QPalette::ColorGroup(i), role).color(); QBrush brush(image);
palette.setBrush(QPalette::ColorGroup(i), role, QBrush(color, pixmap)); brush.setColor(palette.brush(QPalette::ColorGroup(i), role).color());
palette.setBrush(QPalette::ColorGroup(i), role, brush);
} }
} }
//! [38] //! [38]

View File

@ -80,7 +80,7 @@ public:
private: private:
static void setTexture(QPalette &palette, QPalette::ColorRole role, static void setTexture(QPalette &palette, QPalette::ColorRole role,
const QPixmap &pixmap); const QImage &image);
static QPainterPath roundRectPath(const QRect &rect); static QPainterPath roundRectPath(const QRect &rect);
}; };
//! [0] //! [0]

View File

@ -57,8 +57,10 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include "../posix/qplatformdefs.h" #define __LINUX_ERRNO_EXTENSIONS__
#include <errno.h>
#include "../posix/qplatformdefs.h"
#ifdef __STRICT_ANSI__ #ifdef __STRICT_ANSI__
#undef __STRICT_ANSI__ #undef __STRICT_ANSI__

View File

@ -31,7 +31,7 @@ QMAKE_LIBS_OPENGL_ES2 = $${VC_LINK_LINE} -lGLESv2
# The official opt vc EGL references GLESv2 symbols: need to link it # The official opt vc EGL references GLESv2 symbols: need to link it
QMAKE_LIBS_EGL = $${VC_LINK_LINE} -lEGL -lGLESv2 QMAKE_LIBS_EGL = $${VC_LINK_LINE} -lEGL -lGLESv2
QMAKE_LIBDIR_BCM_HOST = $$VC_LIBRARY_PATH QMAKE_LIBDIR_BCM_HOST = =$$VC_LIBRARY_PATH
QMAKE_INCDIR_BCM_HOST = $$VC_INCLUDE_PATH QMAKE_INCDIR_BCM_HOST = $$VC_INCLUDE_PATH
QMAKE_LIBS_BCM_HOST = -lbcm_host QMAKE_LIBS_BCM_HOST = -lbcm_host

View File

@ -0,0 +1,6 @@
load(spec_post)
# Work around idiosyncracy in Android NDK's make executable
# which tries to call the shell-builtin "move" as direct process
equals(QMAKE_HOST.os, Windows):equals(QMAKE_MOVE, move): \
QMAKE_MOVE = cmd /c move

View File

@ -34,10 +34,20 @@ CMAKE_INCLUDE_NAME = $$eval(QT.$${MODULE}.name)
# TARGET here is the one changed at the end of qt_module.prf, # TARGET here is the one changed at the end of qt_module.prf,
# which already contains the Qt5 prefix and QT_LIBINFIX suffix : # which already contains the Qt5 prefix and QT_LIBINFIX suffix :
# Qt5Core_suffix, Qt5Network_suffix, Foo_suffix # Qt5Core_{libinfix_suffix}, Qt5Network_{libinfix_suffix}, Foo_{libinfix_suffix}
# (or QtCore_suffix, Foo_suffix on macos with -framework) # (or QtCore_{libinfix_suffix}, Foo_{libinfix_suffix} on macos with -framework).
CMAKE_QT_STEM = $${TARGET} CMAKE_QT_STEM = $${TARGET}
# On macOS when building just a debug configuration which is not part of debug_and_release,
# $${TARGET} already contains a _debug suffix, as per the following call chain:
# qt_module.prf -> qt5LibraryTarget -> qtLibraryTarget -> qtPlatformTargetSuffix.
# Remove the _debug suffix in the stem, to keep all further uses of CMAKE_QT_STEM consistent.
# The _debug suffix is then re-added where needed regardless if it's a debug_and_release build
# or just debug.
darwin:!qt_framework:!debug_and_release:CONFIG(debug, debug|release) {
CMAKE_QT_STEM = $$replace(CMAKE_QT_STEM, _debug$, )
}
!generated_privates { !generated_privates {
isEmpty(SYNCQT.INJECTED_PRIVATE_HEADER_FILES):isEmpty(SYNCQT.PRIVATE_HEADER_FILES): \ isEmpty(SYNCQT.INJECTED_PRIVATE_HEADER_FILES):isEmpty(SYNCQT.PRIVATE_HEADER_FILES): \
CMAKE_NO_PRIVATE_INCLUDES = true CMAKE_NO_PRIVATE_INCLUDES = true
@ -211,18 +221,18 @@ CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";")
mac { mac {
!isEmpty(CMAKE_STATIC_TYPE) { !isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.a CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.prl CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else { } else {
qt_framework { qt_framework {
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM} CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}_debug
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM} CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}
CMAKE_BUILD_IS_FRAMEWORK = "true" CMAKE_BUILD_IS_FRAMEWORK = "true"
} else { } else {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.$$eval(QT.$${MODULE}.VERSION).dylib
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib
} }
} }

View File

@ -56,10 +56,17 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
get_filename_component(_qt5_install_libs \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" ABSOLUTE) get_filename_component(_qt5_install_libs \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" ABSOLUTE)
if(EXISTS \"${prl_file_location}\") if(EXISTS \"${prl_file_location}\")
file(STRINGS \"${prl_file_location}\" _prl_strings REGEX \"QMAKE_PRL_LIBS[ \\t]*=\") file(STRINGS \"${prl_file_location}\" _prl_strings REGEX \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=\")
string(REGEX REPLACE \"QMAKE_PRL_LIBS[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends ${_prl_strings})
string(REGEX REPLACE \"[ \\t]+\" \";\" _static_depends ${_static_depends}) # file(STRINGS) replaces all semicolons read from the file with backslash semicolons.
string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries ${CMAKE_CXX_STANDARD_LIBRARIES}) # We need to do a reverse transformation in CMake. For that we replace all backslash
# semicolons with just semicolons, but due to the qmake substitution feature
# creating this file, we need to double the amount of backslashes, so the final file
# should have three backslashes and one semicolon.
string(REGEX REPLACE \"\\\\\\;\" \";\" _prl_strings \"${_prl_strings}\")
string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends \"${_prl_strings}\")
string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
set(_search_paths) set(_search_paths)
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\") string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
foreach(_flag ${_static_depends}) foreach(_flag ${_static_depends})

View File

@ -21,7 +21,9 @@ RUN echo "#!/usr/bin/env bash\n" \
RUN chmod +x startup.sh RUN chmod +x startup.sh
# rewrite the default configurations of avahi-daemon # rewrite the default configurations of avahi-daemon
# Disable IPv6 of avahi-daemon to resolve the unstable connections on Windows
ARG test_domain ARG test_domain
RUN sed -i -e "s,#domain-name=local,domain-name=${test_domain:-test-net.qt.local}," \ RUN sed -i -e "s,#domain-name=local,domain-name=${test_domain:-test-net.qt.local}," \
-e "s,#publish-aaaa-on-ipv4=yes,publish-aaaa-on-ipv4=no," \ -e "s,#publish-aaaa-on-ipv4=yes,publish-aaaa-on-ipv4=no," \
-e "s,use-ipv6=yes,use-ipv6=no," \
/etc/avahi/avahi-daemon.conf /etc/avahi/avahi-daemon.conf

View File

@ -0,0 +1,38 @@
version: '2.1'
# This is a template docker-compose file shared with all modules. It is based
# on 'extending services' feature of compose file version 2.1.
# See https://docs.docker.com/compose/extends/#extending-services for details.
#
# Example: testserver/docker-compose.yml
# services:
# foo:
# extends:
# file: ${SHARED_DATA}/docker-compose-common.yml
# service: ${SHARED_SERVICE}
# container_name: qt-test-server-foo
# hostname: ${HOST_NAME:-foo}
# build:
# context: .
# args:
# provisioningImage: qt-test-server-foo:537fe302f61851d1663...
# serviceDir: ./foo
# command: service/foo.sh
x-services:
&default-service
domainname: ${TEST_DOMAIN}
build:
context: .
dockerfile: ${SHARED_DATA}/Dockerfile
args:
test_domain: ${TEST_DOMAIN}
entrypoint: ./startup.sh
services:
bridge-network: *default-service
host-network:
<< : *default-service
network_mode: "host"
extra_hosts:
- "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}"

View File

@ -1,4 +1,6 @@
CONFIG(release, debug|release) { static:no-static-ltcg {
# Static library but no-static-ltcg enabled: skip LTCG
} else: CONFIG(release, debug|release) {
# We need fat object files when creating static libraries on some platforms # We need fat object files when creating static libraries on some platforms
# so the linker will know to load a particular object from the library # so the linker will know to load a particular object from the library
# in the first place. On others, we have special ar and nm to create the symbol # in the first place. On others, we have special ar and nm to create the symbol
@ -22,7 +24,7 @@ CONFIG(release, debug|release) {
} }
} }
fat-lto { fat-lto|if(static:fat-static-lto) {
QMAKE_CFLAGS_LTCG += $$QMAKE_CFLAGS_LTCG_FATOBJECTS QMAKE_CFLAGS_LTCG += $$QMAKE_CFLAGS_LTCG_FATOBJECTS
QMAKE_CXXFLAGS_LTCG += $$QMAKE_CXXFLAGS_LTCG_FATOBJECTS QMAKE_CXXFLAGS_LTCG += $$QMAKE_CXXFLAGS_LTCG_FATOBJECTS
} }

View File

@ -291,6 +291,12 @@ load(qt_targets)
QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))$$qtPlatformTargetSuffix() QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))$$qtPlatformTargetSuffix()
isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \ isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \
QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module
!isEmpty(lib_replace0.match) {
pclib_replace0.match = $$lib_replace0.match
pclib_replace0.replace = $$QMAKE_PKGCONFIG_LIBDIR/
pclib_replace0.CONFIG = path
QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace0
}
pclib_replace.match = $$lib_replace.match pclib_replace.match = $$lib_replace.match
!isEmpty(lib_replace.replace): \ !isEmpty(lib_replace.replace): \
pclib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR pclib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
@ -303,6 +309,12 @@ load(qt_targets)
QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS] QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS]
else: \ else: \
QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]" QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]"
!isEmpty(lib_replace0.match) {
ltlib_replace0.match = $$lib_replace0.match
ltlib_replace0.replace = $$QMAKE_LIBTOOL_LIBDIR/
ltlib_replace0.CONFIG = path
QMAKE_LIBTOOL_INSTALL_REPLACE += ltlib_replace0
}
ltlib_replace.match = $$lib_replace.match ltlib_replace.match = $$lib_replace.match
!isEmpty(lib_replace.replace): \ !isEmpty(lib_replace.replace): \
ltlib_replace.replace = $$QMAKE_LIBTOOL_LIBDIR ltlib_replace.replace = $$QMAKE_LIBTOOL_LIBDIR

View File

@ -94,29 +94,33 @@ isEmpty(TESTSERVER_VERSION) {
# binds the same port on the host. An alternative solution is to deploy # binds the same port on the host. An alternative solution is to deploy
# the docker environment into VirtualBox using docker-machine. # the docker environment into VirtualBox using docker-machine.
isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \ isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \
$$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-macOS.yml $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-host-network.yml
# The connection configuration for the target machine # The connection configuration for the target machine
MACHINE_CONFIG = $(shell docker-machine config qt-test-server) MACHINE_CONFIG = $(shell docker-machine config qt-test-server)
# The environment variables passed to the docker-compose file # The environment variables passed to the docker-compose file
TEST_ENV = 'MACHINE_IP=$(shell docker-machine ip qt-test-server)' TEST_ENV = 'MACHINE_IP=$(shell docker-machine ip qt-test-server)'
TEST_ENV += 'HOST_NAME=qt-test-server'
TEST_ENV += 'TEST_DOMAIN=$$DNSDOMAIN' TEST_ENV += 'TEST_DOMAIN=$$DNSDOMAIN'
TEST_ENV += 'SHARED_DATA=$$PWD/../data/testserver' TEST_ENV += 'SHARED_DATA=$$PWD/../data/testserver'
TEST_ENV += 'SHARED_SERVICE=host-network'
TEST_CMD = env TEST_CMD = env
} else:equals(QMAKE_HOST.os, Windows) { } else:equals(QMAKE_HOST.os, Windows) {
# There is no docker bridge on Windows. It is impossible to ping a container. # There is no docker bridge on Windows. It is impossible to ping a container.
# Use docker-machine to deploy the docker environment into VirtualBox. # Use docker-machine to deploy the docker environment into VirtualBox.
isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \ isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \
$$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-windows.yml $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-host-network.yml
# The connection configuration for the target machine # The connection configuration for the target machine
MACHINE_CONFIG = (docker-machine config qt-test-server) MACHINE_CONFIG = (docker-machine config qt-test-server)
# The environment variables passed to the docker-compose file # The environment variables passed to the docker-compose file
TEST_ENV = '\$\$env:MACHINE_IP = docker-machine ip qt-test-server;' TEST_ENV = '\$\$env:MACHINE_IP = docker-machine ip qt-test-server;'
TEST_ENV += '\$\$env:HOST_NAME = $$shell_quote(\"qt-test-server\");'
TEST_ENV += '\$\$env:TEST_DOMAIN = $$shell_quote(\"$$DNSDOMAIN\");' TEST_ENV += '\$\$env:TEST_DOMAIN = $$shell_quote(\"$$DNSDOMAIN\");'
TEST_ENV += '\$\$env:SHARED_DATA = $$shell_quote(\"$$PWD/../data/testserver\");' TEST_ENV += '\$\$env:SHARED_DATA = $$shell_quote(\"$$PWD/../data/testserver\");'
TEST_ENV += '\$\$env:SHARED_SERVICE = $$shell_quote(\"host-network\");'
# Docker-compose CLI environment variables: # Docker-compose CLI environment variables:
# Enable path conversion from Windows-style to Unix-style in volume definitions. # Enable path conversion from Windows-style to Unix-style in volume definitions.
@ -126,12 +130,18 @@ isEmpty(TESTSERVER_VERSION) {
CONFIG += PowerShell CONFIG += PowerShell
} else { } else {
isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \ isEmpty(TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \
$$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-bridge-network.yml
# The environment variables passed to the docker-compose file # The environment variables passed to the docker-compose file
TEST_ENV = 'TEST_DOMAIN=$$DNSDOMAIN' TEST_ENV = 'TEST_DOMAIN=$$DNSDOMAIN'
TEST_ENV += 'SHARED_DATA=$$PWD/../data/testserver' TEST_ENV += 'SHARED_DATA=$$PWD/../data/testserver'
TEST_ENV += 'SHARED_SERVICE=bridge-network'
TEST_CMD = env TEST_CMD = env
} }
# If $$TESTSERVER_COMPOSE_FILE defined by platform doesn't exist, the default
# docker-compose.yml is used as a fallback.
!exists($$TESTSERVER_COMPOSE_FILE): TESTSERVER_COMPOSE_FILE = \
$$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml
!exists($$TESTSERVER_COMPOSE_FILE): error("Invalid TESTSERVER_COMPOSE_FILE specified") !exists($$TESTSERVER_COMPOSE_FILE): error("Invalid TESTSERVER_COMPOSE_FILE specified")

View File

@ -22,15 +22,15 @@ dumpcpp_impl.depends += ${QMAKE_FILE_BASE}.h
QMAKE_EXTRA_COMPILERS += dumpcpp_impl QMAKE_EXTRA_COMPILERS += dumpcpp_impl
# Create dependencies from every object file to our generated header files. # Call dumpcpp the first time if the files do not exist to help find dependencies
if(isEmpty(BUILDS)|build_pass):have_target:!contains(TEMPLATE, vc.*) { !build_pass:have_target:!contains(TEMPLATE, vc.*) {
for(tlb, TYPELIBS) { for(tlb, TYPELIBS) {
tlbCopy = $$replace(tlb, \", )
hdr = $$basename(tlb) hdr = $$basename(tlb)
hdr = $$section(hdr, ., 0, -2).h hdr = $$section(hdr, ., 0, -2)
TYPELIB_HEADERS += $$hdr tmp_command = $$QMAKE_DUMPCPP $$system_quote($$absolute_path($$tlb, $$_PRO_FILE_PWD_)) \
-o $$system_quote($$OUT_PWD/$$hdr)
qaxcontainer_compat: tmp_command += -compat
!exists($$OUT_PWD/$${hdr}.h): system($$tmp_command)
} }
objtgt.target = $(OBJECTS)
objtgt.depends += $$TYPELIB_HEADERS
QMAKE_EXTRA_TARGETS += objtgt
} }

View File

@ -1,7 +1,7 @@
isEmpty(QMAKE_INCDIR_VULKAN) { isEmpty(QMAKE_INCDIR_VULKAN) {
# Pick up the VULKAN_SDK env var set by the LunarG SDK so that the Vulkan # Pick up the VULKAN_SDK env var set by the LunarG SDK so that the Vulkan
# headers are found out-of-the-box on typical Windows setups. # headers are found out-of-the-box on typical Windows setups.
QMAKE_INCDIR_VULKAN = $$(VULKAN_SDK)\\include QMAKE_INCDIR_VULKAN = $$(VULKAN_SDK)/include
# Do not export the include dir but resolve it on every qmake call. # Do not export the include dir but resolve it on every qmake call.
QMAKE_EXPORT_INCDIR_VULKAN = - QMAKE_EXPORT_INCDIR_VULKAN = -

View File

@ -1015,6 +1015,14 @@ MakefileGenerator::writePrlFile(QTextStream &t)
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
t << qv(project->values((*it).toKey())); t << qv(project->values((*it).toKey()));
t << Qt::endl; t << Qt::endl;
t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
QString sep;
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) {
t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
sep = ';';
}
t << Qt::endl;
} }
} }
@ -3441,7 +3449,7 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
QString ret; QString ret;
if (project->isEmpty(replace_rule) if (project->isEmpty(replace_rule)
|| project->isActiveConfig("no_sed_meta_install")) { || project->isActiveConfig("no_sed_meta_install")) {
ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else { } else {
QString sedargs; QString sedargs;
const ProStringList &replace_rules = project->values(replace_rule); const ProStringList &replace_rules = project->values(replace_rule);
@ -3456,9 +3464,9 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
} }
} }
if (sedargs.isEmpty()) { if (sedargs.isEmpty()) {
ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else { } else {
ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); ret += "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
} }
} }
return ret; return ret;

View File

@ -946,10 +946,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData()); debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData());
int line_count = 1; int line_count = 1;
bool ignore[3] = { false, false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE, [3] for Q_NAMESPACE_EXPORT
bool ignore[4] = { false, false, false, false };
/* qmake ignore Q_GADGET */ /* qmake ignore Q_GADGET */
/* qmake ignore Q_OBJECT */ /* qmake ignore Q_OBJECT */
/* qmake ignore Q_NAMESPACE */ /* qmake ignore Q_NAMESPACE */
/* qmake ignore Q_NAMESPACE_EXPORT */
for(int x = 0; x < buffer_len; x++) { for(int x = 0; x < buffer_len; x++) {
#define SKIP_BSNL(pos) skipEscapedLineEnds(buffer, buffer_len, (pos), &line_count) #define SKIP_BSNL(pos) skipEscapedLineEnds(buffer, buffer_len, (pos), &line_count)
x = SKIP_BSNL(x); x = SKIP_BSNL(x);
@ -988,6 +990,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
file->file.real().toLatin1().constData(), line_count); file->file.real().toLatin1().constData(), line_count);
x += 23; x += 23;
ignore[2] = true; ignore[2] = true;
} else if (buffer_len >= (x + 30) &&
!strncmp(buffer + x + 1, "make ignore Q_NAMESPACE_EXPORT", 30)) {
debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_NAMESPACE_EXPORT\"",
file->file.real().toLatin1().constData(), line_count);
x += 30;
ignore[3] = true;
} }
} else if (buffer[x] == '*') { } else if (buffer[x] == '*') {
extralines = 0; extralines = 0;
@ -1015,8 +1023,8 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
int morelines = 0; int morelines = 0;
int y = skipEscapedLineEnds(buffer, buffer_len, x + 1, &morelines); int y = skipEscapedLineEnds(buffer, buffer_len, x + 1, &morelines);
if (buffer[y] == 'Q') { if (buffer[y] == 'Q') {
static const char interesting[][12] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE"}; static const char interesting[][19] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE", "Q_NAMESPACE_EXPORT" };
for (int interest = 0; interest < 3; ++interest) { for (int interest = 0; interest < 4; ++interest) {
if (ignore[interest]) if (ignore[interest])
continue; continue;

View File

@ -250,7 +250,7 @@ void MingwMakefileGenerator::init()
} }
if(project->isActiveConfig("dll")) { if(project->isActiveConfig("dll")) {
project->values("QMAKE_CLEAN").append(project->first("MINGW_IMPORT_LIB")); project->values("QMAKE_DISTCLEAN").append(project->first("MINGW_IMPORT_LIB"));
} }
} }

View File

@ -517,4 +517,9 @@ ProKey ProFile::getHashStr(const ushort *&tPtr)
return ret; return ret;
} }
QDebug operator<<(QDebug debug, const ProString &str)
{
return debug << str.toQString();
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -31,6 +31,7 @@
#include "qmake_global.h" #include "qmake_global.h"
#include <qdebug.h>
#include <qstring.h> #include <qstring.h>
#include <qvector.h> #include <qvector.h>
#include <qhash.h> #include <qhash.h>
@ -468,6 +469,8 @@ struct ProFunctionDefs {
QHash<ProKey, ProFunctionDef> replaceFunctions; QHash<ProKey, ProFunctionDef> replaceFunctions;
}; };
QDebug operator<<(QDebug debug, const ProString &str);
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // PROITEMS_H #endif // PROITEMS_H

View File

@ -504,6 +504,10 @@ EGLint SwapChain11::resize(const gl::Context *context,
ASSERT(SUCCEEDED(result)); ASSERT(SUCCEEDED(result));
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
#ifndef ANGLE_ENABLE_WINDOWS_STORE
if (mNativeWindow->getNativeWindow())
InvalidateRect(mNativeWindow->getNativeWindow(), nullptr, FALSE);
#endif
const auto &format = const auto &format =
d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
mBackBufferTexture.set(backbufferTexture, format); mBackBufferTexture.set(backbufferTexture, format);

View File

@ -38,6 +38,11 @@
#include <double-conversion/strtod.h> #include <double-conversion/strtod.h>
#include <double-conversion/utils.h> #include <double-conversion/utils.h>
// Fix warning C4244: 'argument': conversion from 'const uc16' to 'char', possible loss of data
#ifdef _MSC_VER
__pragma(warning(disable: 4244))
#endif
namespace double_conversion { namespace double_conversion {
const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() { const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() {

View File

@ -267,7 +267,7 @@ static int tryReaping(pid_t pid, struct pipe_payload *payload)
static void freeInfo(Header *header, ProcessInfo *entry) static void freeInfo(Header *header, ProcessInfo *entry)
{ {
entry->deathPipe = -1; entry->deathPipe = -1;
entry->pid = 0; ffd_atomic_store(&entry->pid, 0, FFD_ATOMIC_RELEASE);
(void)ffd_atomic_add_fetch(&header->busyCount, -1, FFD_ATOMIC_RELEASE); (void)ffd_atomic_add_fetch(&header->busyCount, -1, FFD_ATOMIC_RELEASE);
assert(header->busyCount >= 0); assert(header->busyCount >= 0);
@ -519,9 +519,9 @@ static void cleanup()
ffd_atomic_store(&forkfd_status, 0, FFD_ATOMIC_RELAXED); ffd_atomic_store(&forkfd_status, 0, FFD_ATOMIC_RELAXED);
/* free any arrays we might have */ /* free any arrays we might have */
array = children.header.nextArray; array = ffd_atomic_load(&children.header.nextArray, FFD_ATOMIC_ACQUIRE);
while (array != NULL) { while (array != NULL) {
BigArray *next = array->header.nextArray; BigArray *next = ffd_atomic_load(&array->header.nextArray, FFD_ATOMIC_ACQUIRE);
free(array); free(array);
array = next; array = next;
} }

View File

@ -42,7 +42,7 @@ Changes for ARM 9/9/2010 [Downstream relative to Gladman's GitHub, upstream to Q
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
# if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(Q_OS_QNX) # if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(Q_OS_QNX)
# include <endian.h> # include <endian.h>
# if !defined( __BEOS__ ) # if !defined( __BEOS__ ) && !defined(Q_OS_RTEMS)
# include <byteswap.h> # include <byteswap.h>
# endif # endif
# endif # endif

View File

@ -36,7 +36,7 @@ android {
compileSdkVersion androidCompileSdkVersion.toInteger() compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion buildToolsVersion '28.0.3'
sourceSets { sourceSets {
main { main {

View File

@ -0,0 +1,37 @@
From 7d300c6e7d05f4e31c966f1298d11da3eae9d679 Mon Sep 17 00:00:00 2001
From: Val Doroshchuk <valentyn.doroshchuk@qt.io>
Date: Fri, 21 Jun 2019 11:24:06 +0200
Subject: [PATCH] ANGLE: Invalidate client window area when resizing swap chain
Inspired by:
https://codereview.appspot.com/6812076/
Resizing a window larger results in the newly exposed region being invalidated
but the old region is treated as valid.
This can result in the old region no longer updating.
Was added to D3D9.
Improving a fix from Filippo Cucchetto:
https://codereview.qt-project.org/c/qt/qtbase/+/195336
and pushing to D3D11.
ifndef protects against compilation error for WinRT.
Invalidate() should be used only for desktop apps.
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
index dcfd06484d..e8f13b388f 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -504,6 +504,10 @@ EGLint SwapChain11::resize(const gl::Context *context,
ASSERT(SUCCEEDED(result));
if (SUCCEEDED(result))
{
+#ifndef ANGLE_ENABLE_WINDOWS_STORE
+ if (mNativeWindow->getNativeWindow())
+ InvalidateRect(mNativeWindow->getNativeWindow(), nullptr, FALSE);
+#endif
const auto &format =
d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
mBackBufferTexture.set(backbufferTexture, format);
--
2.14.2.windows.1

View File

@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/config/exampleurl-qtbase.qdocconf)
project = QtConcurrent project = QtConcurrent
description = Qt Concurrent Reference Documentation description = Qt Concurrent Reference Documentation

View File

@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/config/exampleurl-qtbase.qdocconf)
project = QtCore project = QtCore
description = Qt Core Reference Documentation description = Qt Core Reference Documentation

View File

@ -131,9 +131,10 @@ while (i != set.end()) {
//! [10] //! [10]
QSet<QString> set; QSet<QString> set;
... ...
QSet<QString>::iterator it = qFind(set.begin(), set.end(), "Jeanette"); const auto predicate = [](const QString &s) { return s.compare("Jeanette", Qt::CaseInsensitive) == 0; };
QSet<QString>::iterator it = std::find_if(set.begin(), set.end(), predicate);
if (it != set.end()) if (it != set.end())
cout << "Found Jeanette" << Qt::endl; cout << "Found Jeanette" << endl;
//! [10] //! [10]
@ -150,9 +151,10 @@ for (i = set.begin(); i != set.end(); ++i)
//! [12] //! [12]
QSet<QString> set; QSet<QString> set;
... ...
QSet<QString>::iterator it = qFind(set.begin(), set.end(), "Jeanette"); const auto predicate = [](const QString &s) { return s.compare("Jeanette", Qt::CaseInsensitive) == 0; };
QSet<QString>::const_iterator it = std::find_if(set.cbegin(), set.cend(), predicate);
if (it != set.constEnd()) if (it != set.constEnd())
cout << "Found Jeanette" << Qt::endl; cout << "Found Jeanette" << endl;
//! [12] //! [12]
@ -161,7 +163,7 @@ QSet<QString> set;
set << "red" << "green" << "blue" << ... << "black"; set << "red" << "green" << "blue" << ... << "black";
QList<QString> list = set.toList(); QList<QString> list = set.toList();
qSort(list); std::sort(list.begin(), list.end());
//! [13] //! [13]

View File

@ -119,7 +119,7 @@ for (i = list.begin(); i != list.end(); ++i)
//! [8] //! [8]
QLinkedList<QString> list; QLinkedList<QString> list;
... ...
QLinkedList<QString>::iterator it = qFind(list.begin(), QLinkedList<QString>::iterator it = std::find(list.begin(),
list.end(), "Joel"); list.end(), "Joel");
if (it != list.end()) if (it != list.end())
cout << "Found Joel" << Qt::endl; cout << "Found Joel" << Qt::endl;
@ -189,7 +189,7 @@ for (i = list.constBegin(); i != list.constEnd(); ++i)
//! [15] //! [15]
QLinkedList<QString> list; QLinkedList<QString> list;
... ...
QLinkedList<QString>::iterator it = qFind(list.constBegin(), QLinkedList<QString>::const_iterator it = std::find(list.constBegin(),
list.constEnd(), "Joel"); list.constEnd(), "Joel");
if (it != list.constEnd()) if (it != list.constEnd())
cout << "Found Joel" << Qt::endl; cout << "Found Joel" << Qt::endl;

View File

@ -247,7 +247,7 @@ QSet<int> set;
set << 20 << 30 << 40 << ... << 70; set << 20 << 30 << 40 << ... << 70;
QList<int> list = QList<int>::fromSet(set); QList<int> list = QList<int>::fromSet(set);
qSort(list); std::sort(list.begin(), list.end());
//! [23] //! [23]

View File

@ -666,7 +666,7 @@
\li \b{Logarithmic time:} O(log \e n). A function that runs in \li \b{Logarithmic time:} O(log \e n). A function that runs in
logarithmic time is a function whose running time is logarithmic time is a function whose running time is
proportional to the logarithm of the number of items in the proportional to the logarithm of the number of items in the
container. One example is qBinaryFind(). container. One example is the binary search algorithm.
\li \b{Linear time:} O(\e n). A function that runs in linear time \li \b{Linear time:} O(\e n). A function that runs in linear time
will execute in a time directly proportional to the number of will execute in a time directly proportional to the number of

View File

@ -2369,7 +2369,7 @@
*/ */
/*! /*!
\enum Qt::SplitBehavior \enum Qt::SplitBehaviorFlags
\since 5.14 \since 5.14
This enum specifies how the split() functions should behave with This enum specifies how the split() functions should behave with

View File

@ -355,6 +355,14 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) c
return false; return false;
} }
/*!
\variable QOperatingSystemVersion::WindowsVista
\brief a version corresponding to Windows Vista (version 6.0).
\since 6.0
*/
const QOperatingSystemVersion QOperatingSystemVersion::WindowsVista =
QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 0);
/*! /*!
\variable QOperatingSystemVersion::Windows7 \variable QOperatingSystemVersion::Windows7
\brief a version corresponding to Windows 7 (version 6.1). \brief a version corresponding to Windows 7 (version 6.1).

View File

@ -60,6 +60,7 @@ public:
Android Android
}; };
static const QOperatingSystemVersion WindowsVista;
static const QOperatingSystemVersion Windows7; static const QOperatingSystemVersion Windows7;
static const QOperatingSystemVersion Windows8; static const QOperatingSystemVersion Windows8;
static const QOperatingSystemVersion Windows8_1; static const QOperatingSystemVersion Windows8_1;

View File

@ -359,17 +359,17 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
quint32 *buffer = begin; quint32 *buffer = begin;
qsizetype count = end - begin; qsizetype count = end - begin;
if (Q_UNLIKELY(uint(qt_randomdevice_control) & SetRandomData)) { if (Q_UNLIKELY(uint(qt_randomdevice_control.loadAcquire()) & SetRandomData)) {
uint value = uint(qt_randomdevice_control) & RandomDataMask; uint value = uint(qt_randomdevice_control.loadAcquire()) & RandomDataMask;
std::fill_n(buffer, count, value); std::fill_n(buffer, count, value);
return; return;
} }
qsizetype filled = 0; qsizetype filled = 0;
if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0) if (qt_has_hwrng() && (uint(qt_randomdevice_control.loadAcquire()) & SkipHWRNG) == 0)
filled += qt_random_cpu(buffer, count); filled += qt_random_cpu(buffer, count);
if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) { if (filled != count && (uint(qt_randomdevice_control.loadAcquire()) & SkipSystemRNG) == 0) {
qsizetype bytesFilled = qsizetype bytesFilled =
fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer))); fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer)));
filled += bytesFilled / qsizetype(sizeof(*buffer)); filled += bytesFilled / qsizetype(sizeof(*buffer));
@ -903,6 +903,10 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\snippet code/src_corelib_global_qrandom.cpp 12 \snippet code/src_corelib_global_qrandom.cpp 12
If the \a highest parameter is negative, the result will be negative too;
if it is infinite or NaN, the result will be infinite or NaN too (that is,
not random).
\sa generateDouble(), bounded() \sa generateDouble(), bounded()
*/ */
@ -934,7 +938,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\overload \overload
Generates one random 32-bit quantity in the range between 0 (inclusive) and Generates one random 32-bit quantity in the range between 0 (inclusive) and
\a highest (exclusive). \a highest must not be negative. \a highest (exclusive). \a highest must be positive.
Note that this function cannot be used to obtain values in the full 32-bit Note that this function cannot be used to obtain values in the full 32-bit
range of int. Instead, use generate() and cast to int. range of int. Instead, use generate() and cast to int.
@ -946,8 +950,11 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\fn quint32 QRandomGenerator::bounded(quint32 lowest, quint32 highest) \fn quint32 QRandomGenerator::bounded(quint32 lowest, quint32 highest)
\overload \overload
Generates one random 32-bit quantity in the range between \a lowest (inclusive) Generates one random 32-bit quantity in the range between \a lowest
and \a highest (exclusive). The same result may also be obtained by using (inclusive) and \a highest (exclusive). The \a highest parameter must be
greater than \a lowest.
The same result may also be obtained by using
\l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution} \l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution}
with parameters \a lowest and \c{\a highest - 1}. That class can also be used to with parameters \a lowest and \c{\a highest - 1}. That class can also be used to
obtain quantities larger than 32 bits. obtain quantities larger than 32 bits.
@ -968,7 +975,8 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\overload \overload
Generates one random 32-bit quantity in the range between \a lowest Generates one random 32-bit quantity in the range between \a lowest
(inclusive) and \a highest (exclusive), both of which may be negative. (inclusive) and \a highest (exclusive), both of which may be negative, but
\a highest must be greater than \a lowest.
Note that this function cannot be used to obtain values in the full 32-bit Note that this function cannot be used to obtain values in the full 32-bit
range of int. Instead, use generate() and cast to int. range of int. Instead, use generate() and cast to int.
@ -1222,7 +1230,7 @@ void QRandomGenerator::_fillRange(void *buffer, void *bufferEnd)
quint32 *begin = static_cast<quint32 *>(buffer); quint32 *begin = static_cast<quint32 *>(buffer);
quint32 *end = static_cast<quint32 *>(bufferEnd); quint32 *end = static_cast<quint32 *>(bufferEnd);
if (type == SystemRNG || Q_UNLIKELY(uint(qt_randomdevice_control) & (UseSystemRNG|SetRandomData))) if (type == SystemRNG || Q_UNLIKELY(uint(qt_randomdevice_control.loadAcquire()) & (UseSystemRNG|SetRandomData)))
return SystemGenerator::self().generate(begin, end); return SystemGenerator::self().generate(begin, end);
SystemAndGlobalGenerators::PRNGLocker lock(this); SystemAndGlobalGenerators::PRNGLocker lock(this);

View File

@ -122,16 +122,18 @@ public:
return quint32(value); return quint32(value);
} }
int bounded(int highest)
{
return int(bounded(quint32(highest)));
}
quint32 bounded(quint32 lowest, quint32 highest) quint32 bounded(quint32 lowest, quint32 highest)
{ {
Q_ASSERT(highest > lowest);
return bounded(highest - lowest) + lowest; return bounded(highest - lowest) + lowest;
} }
int bounded(int highest)
{
Q_ASSERT(highest > 0);
return int(bounded(0U, quint32(highest)));
}
int bounded(int lowest, int highest) int bounded(int lowest, int highest)
{ {
return bounded(highest - lowest) + lowest; return bounded(highest - lowest) + lowest;

View File

@ -76,7 +76,9 @@ Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC
#elif defined(QT_BUILD_INTERNAL) #elif defined(QT_BUILD_INTERNAL)
extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control; extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control;
#else #else
enum { qt_randomdevice_control = 0 }; static const struct {
uint loadAcquire() const { return 0; }
} qt_randomdevice_control;
#endif #endif
inline bool qt_has_hwrng() inline bool qt_has_hwrng()

View File

@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE
#define FFD_ATOMIC_RELAXED Relaxed #define FFD_ATOMIC_RELAXED Relaxed
#define FFD_ATOMIC_ACQUIRE Acquire #define FFD_ATOMIC_ACQUIRE Acquire
#define FFD_ATOMIC_RELEASE Release #define FFD_ATOMIC_RELEASE Release
#define loadRelaxed load
#define storeRelaxed store
#define FFD_CONCAT(x, y) x ## y #define FFD_CONCAT(x, y) x ## y

View File

@ -97,6 +97,9 @@
#include <QtCore/qset.h> #include <QtCore/qset.h>
#include <QtCore/qstack.h> #include <QtCore/qstack.h>
#include <QtCore/qvariant.h> #include <QtCore/qvariant.h>
#if QT_CONFIG(regularexpression)
#include <QtCore/qregularexpression.h>
#endif
#include <QtCore/private/qfilesystemiterator_p.h> #include <QtCore/private/qfilesystemiterator_p.h>
#include <QtCore/private/qfilesystementry_p.h> #include <QtCore/private/qfilesystementry_p.h>
@ -136,8 +139,11 @@ public:
const QDir::Filters filters; const QDir::Filters filters;
const QDirIterator::IteratorFlags iteratorFlags; const QDirIterator::IteratorFlags iteratorFlags;
#ifndef QT_NO_REGEXP #if defined(QT_BOOTSTRAPPED)
// ### Qt6: Get rid of this once we don't bootstrap qmake anymore
QVector<QRegExp> nameRegExps; QVector<QRegExp> nameRegExps;
#elif QT_CONFIG(regularexpression)
QVector<QRegularExpression> nameRegExps;
#endif #endif
QDirIteratorPrivateIteratorStack<QAbstractFileEngineIterator> fileEngineIterators; QDirIteratorPrivateIteratorStack<QAbstractFileEngineIterator> fileEngineIterators;
@ -162,13 +168,21 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QFileSystemEntry &entry, const QS
, filters(QDir::NoFilter == filters ? QDir::AllEntries : filters) , filters(QDir::NoFilter == filters ? QDir::AllEntries : filters)
, iteratorFlags(flags) , iteratorFlags(flags)
{ {
#ifndef QT_NO_REGEXP #if defined(QT_BOOTSTRAPPED)
nameRegExps.reserve(nameFilters.size()); nameRegExps.reserve(nameFilters.size());
for (int i = 0; i < nameFilters.size(); ++i) for (const auto &filter : nameFilters) {
nameRegExps.append( nameRegExps.append(
QRegExp(nameFilters.at(i), QRegExp(filter,
(filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive, (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive,
QRegExp::Wildcard)); QRegExp::Wildcard));
}
#elif QT_CONFIG(regularexpression)
nameRegExps.reserve(nameFilters.size());
for (const auto &filter : nameFilters) {
QString re = QRegularExpression::anchoredPattern(QRegularExpression::wildcardToRegularExpression(filter));
nameRegExps.append(
QRegularExpression(re, (filters & QDir::CaseSensitive) ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption));
}
#endif #endif
QFileSystemMetaData metaData; QFileSystemMetaData metaData;
if (resolveEngine) if (resolveEngine)
@ -335,19 +349,23 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
return false; return false;
// name filter // name filter
#ifndef QT_NO_REGEXP #if QT_CONFIG(regularexpression) || defined(QT_BOOTSTRAPPED)
// Pass all entries through name filters, except dirs if the AllDirs // Pass all entries through name filters, except dirs if the AllDirs
if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) { if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) {
bool matched = false; bool matched = false;
for (QVector<QRegExp>::const_iterator iter = nameRegExps.constBegin(), for (const auto &re : nameRegExps) {
end = nameRegExps.constEnd(); #if defined(QT_BOOTSTRAPPED)
iter != end; ++iter) { QRegExp copy = re;
QRegExp copy = *iter;
if (copy.exactMatch(fileName)) { if (copy.exactMatch(fileName)) {
matched = true; matched = true;
break; break;
} }
#else
if (re.match(fileName).hasMatch()) {
matched = true;
break;
}
#endif
} }
if (!matched) if (!matched)
return false; return false;

View File

@ -47,7 +47,7 @@
#include <qset.h> #include <qset.h>
#include <qtimer.h> #include <qtimer.h>
#if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)) #if (defined(Q_OS_LINUX) || defined(Q_OS_QNX)) && QT_CONFIG(inotify)
#define USE_INOTIFY #define USE_INOTIFY
#endif #endif

View File

@ -50,6 +50,7 @@
#include <qfile.h> #include <qfile.h>
#include <qfileinfo.h> #include <qfileinfo.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <qscopeguard.h>
#undef FSEVENT_DEBUG #undef FSEVENT_DEBUG
#ifdef FSEVENT_DEBUG #ifdef FSEVENT_DEBUG
@ -338,10 +339,10 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
bool needsRestart = false; bool needsRestart = false;
WatchingState oldState = watchingState; WatchingState oldState = watchingState;
QStringList p = paths; QStringList unhandled;
QMutableListIterator<QString> it(p); for (const QString &path : paths) {
while (it.hasNext()) { auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
QString origPath = it.next().normalized(QString::NormalizationForm_C); QString origPath = path.normalized(QString::NormalizationForm_C);
QString realPath = origPath; QString realPath = origPath;
if (realPath.endsWith(QDir::separator())) if (realPath.endsWith(QDir::separator()))
realPath = realPath.mid(0, realPath.size() - 1); realPath = realPath.mid(0, realPath.size() - 1);
@ -362,17 +363,17 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
continue; continue;
directories->append(origPath); directories->append(origPath);
watchedPath = realPath; watchedPath = realPath;
it.remove();
} else { } else {
if (files->contains(origPath)) if (files->contains(origPath))
continue; continue;
files->append(origPath); files->append(origPath);
it.remove();
watchedPath = fi.path(); watchedPath = fi.path();
parentPath = watchedPath; parentPath = watchedPath;
} }
sg.dismiss();
for (PathRefCounts::const_iterator i = watchingState.watchedPaths.begin(), for (PathRefCounts::const_iterator i = watchingState.watchedPaths.begin(),
ei = watchingState.watchedPaths.end(); i != ei; ++i) { ei = watchingState.watchedPaths.end(); i != ei; ++i) {
if (watchedPath.startsWith(i.key() % QDir::separator())) { if (watchedPath.startsWith(i.key() % QDir::separator())) {
@ -409,14 +410,14 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
// ok, something went wrong, let's try to restore the previous state // ok, something went wrong, let's try to restore the previous state
watchingState = std::move(oldState); watchingState = std::move(oldState);
// and because we don't know which path caused the issue (if any), fail on all of them // and because we don't know which path caused the issue (if any), fail on all of them
p = paths; unhandled = paths;
if (wasRunning) if (wasRunning)
startStream(); startStream();
} }
} }
return p; return unhandled;
} }
QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &paths, QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &paths,
@ -430,10 +431,9 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
bool needsRestart = false; bool needsRestart = false;
WatchingState oldState = watchingState; WatchingState oldState = watchingState;
QStringList p = paths; QStringList unhandled;
QMutableListIterator<QString> it(p); for (const QString &origPath : paths) {
while (it.hasNext()) { auto sg = qScopeGuard([&]{ unhandled.push_back(origPath); });
QString origPath = it.next();
QString realPath = origPath; QString realPath = origPath;
if (realPath.endsWith(QDir::separator())) if (realPath.endsWith(QDir::separator()))
realPath = realPath.mid(0, realPath.size() - 1); realPath = realPath.mid(0, realPath.size() - 1);
@ -447,7 +447,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
needsRestart |= derefPath(dirIt->dirInfo.watchedPath); needsRestart |= derefPath(dirIt->dirInfo.watchedPath);
watchingState.watchedDirectories.erase(dirIt); watchingState.watchedDirectories.erase(dirIt);
directories->removeAll(origPath); directories->removeAll(origPath);
it.remove(); sg.dismiss();
DEBUG("Removed directory '%s'", qPrintable(realPath)); DEBUG("Removed directory '%s'", qPrintable(realPath));
} }
} else { } else {
@ -463,7 +463,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
if (filesInDir.isEmpty()) if (filesInDir.isEmpty())
watchingState.watchedFiles.erase(pIt); watchingState.watchedFiles.erase(pIt);
files->removeAll(origPath); files->removeAll(origPath);
it.remove(); sg.dismiss();
DEBUG("Removed file '%s'", qPrintable(realPath)); DEBUG("Removed file '%s'", qPrintable(realPath));
} }
} }
@ -479,7 +479,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
} }
} }
return p; return unhandled;
} }
// Returns false if FSEventStream* calls failed for some mysterious reason, true if things got a // Returns false if FSEventStream* calls failed for some mysterious reason, true if things got a

View File

@ -517,7 +517,7 @@ void QProcessPrivate::startProcess()
if (stderrChannel.pipe[0] != -1) if (stderrChannel.pipe[0] != -1)
::fcntl(stderrChannel.pipe[0], F_SETFL, ::fcntl(stderrChannel.pipe[0], F_GETFL) | O_NONBLOCK); ::fcntl(stderrChannel.pipe[0], F_SETFL, ::fcntl(stderrChannel.pipe[0], F_GETFL) | O_NONBLOCK);
if (threadData->eventDispatcher) { if (threadData->eventDispatcher.loadAcquire()) {
deathNotifier = new QSocketNotifier(forkfd, QSocketNotifier::Read, q); deathNotifier = new QSocketNotifier(forkfd, QSocketNotifier::Read, q);
QObject::connect(deathNotifier, SIGNAL(activated(int)), QObject::connect(deathNotifier, SIGNAL(activated(int)),
q, SLOT(_q_processDied())); q, SLOT(_q_processDied()));

View File

@ -197,13 +197,13 @@ Q_DECLARE_TYPEINFO(QResourceRoot, Q_MOVABLE_TYPE);
typedef QList<QResourceRoot*> ResourceList; typedef QList<QResourceRoot*> ResourceList;
struct QResourceGlobalData struct QResourceGlobalData
{ {
QMutex resourceMutex{QMutex::Recursive}; QRecursiveMutex resourceMutex;
ResourceList resourceList; ResourceList resourceList;
QStringList resourceSearchPaths; QStringList resourceSearchPaths;
}; };
Q_GLOBAL_STATIC(QResourceGlobalData, resourceGlobalData) Q_GLOBAL_STATIC(QResourceGlobalData, resourceGlobalData)
static inline QMutex *resourceMutex() static inline QRecursiveMutex *resourceMutex()
{ return &resourceGlobalData->resourceMutex; } { return &resourceGlobalData->resourceMutex; }
static inline ResourceList *resourceList() static inline ResourceList *resourceList()

View File

@ -2048,8 +2048,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
QPixmap, which are part of Qt GUI. In other words, there is no QPixmap, which are part of Qt GUI. In other words, there is no
\c toColor(), \c toImage(), or \c toPixmap() functions in QVariant. \c toColor(), \c toImage(), or \c toPixmap() functions in QVariant.
Instead, you can use the QVariant::value() or the qVariantValue() Instead, you can use the QVariant::value() template function.
template function. For example: For example:
\snippet code/src_corelib_io_qsettings.cpp 0 \snippet code/src_corelib_io_qsettings.cpp 0

View File

@ -220,7 +220,7 @@ static bool shouldIncludeFs(const QStorageIterator &it)
return false; return false;
} }
#ifdef Q_OS_LINUX #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
if (it.fileSystemType() == "rootfs") if (it.fileSystemType() == "rootfs")
return false; return false;
#endif #endif
@ -849,7 +849,7 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
info.d->device = it.device(); info.d->device = it.device();
info.d->fileSystemType = it.fileSystemType(); info.d->fileSystemType = it.fileSystemType();
info.d->subvolume = it.subvolume(); info.d->subvolume = it.subvolume();
if (info.bytesTotal() == 0) if (info.bytesTotal() == 0 && info != root())
continue; continue;
volumes.append(info); volumes.append(info);
} }

View File

@ -145,10 +145,10 @@ public:
bool isUnnamedFile() const override final; bool isUnnamedFile() const override final;
const QString &templateName; const QString &templateName;
quint32 fileMode; quint32 fileMode = 0;
int flags = 0; int flags = 0;
bool filePathIsTemplate; bool filePathIsTemplate = true;
bool filePathWasTemplate; bool filePathWasTemplate = true;
bool unnamedFile = false; bool unnamedFile = false;
}; };

View File

@ -445,3 +445,5 @@ void QTransposeProxyModel::sort(int column, Qt::SortOrder order)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qtransposeproxymodel.cpp"

View File

@ -52,8 +52,8 @@
// We mean it. // We mean it.
// //
#include <QtCore/private/qglobal_p.h>
#include "qplatformdefs.h" #include "qplatformdefs.h"
#include <QtCore/private/qglobal_p.h>
#include "qatomic.h" #include "qatomic.h"
#include "qbytearray.h" #include "qbytearray.h"

View File

@ -227,12 +227,14 @@ bool QCoreApplicationPrivate::checkInstance(const char *function)
return b; return b;
} }
#if QT_CONFIG(commandlineparser)
void QCoreApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options) void QCoreApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options)
{ {
options->append(QCommandLineOption(QStringLiteral("qmljsdebugger"), options->append(QCommandLineOption(QStringLiteral("qmljsdebugger"),
QStringLiteral("Activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block]. \"block\" makes the application wait for a connection."), QStringLiteral("Activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block]. \"block\" makes the application wait for a connection."),
QStringLiteral("value"))); QStringLiteral("value")));
} }
#endif
void QCoreApplicationPrivate::processCommandLineArguments() void QCoreApplicationPrivate::processCommandLineArguments()
{ {
@ -385,8 +387,8 @@ struct QCoreApplicationData {
~QCoreApplicationData() { ~QCoreApplicationData() {
#ifndef QT_NO_QOBJECT #ifndef QT_NO_QOBJECT
// cleanup the QAdoptedThread created for the main() thread // cleanup the QAdoptedThread created for the main() thread
if (QCoreApplicationPrivate::theMainThread) { if (auto *t = QCoreApplicationPrivate::theMainThread.loadAcquire()) {
QThreadData *data = QThreadData::get2(QCoreApplicationPrivate::theMainThread); QThreadData *data = QThreadData::get2(t);
data->deref(); // deletes the data and the adopted thread data->deref(); // deletes the data and the adopted thread
} }
#endif #endif
@ -486,7 +488,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
#endif #endif
QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread! QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread!
if (cur != theMainThread) if (cur != theMainThread.loadAcquire())
qWarning("WARNING: QApplication was not created in the main() thread."); qWarning("WARNING: QApplication was not created in the main() thread.");
#endif #endif
} }
@ -862,7 +864,7 @@ void QCoreApplicationPrivate::init()
Q_ASSERT(eventDispatcher); Q_ASSERT(eventDispatcher);
if (!eventDispatcher->parent()) { if (!eventDispatcher->parent()) {
eventDispatcher->moveToThread(threadData->thread); eventDispatcher->moveToThread(threadData->thread.loadAcquire());
eventDispatcher->setParent(q); eventDispatcher->setParent(q);
} }
@ -1181,7 +1183,7 @@ static bool doNotify(QObject *receiver, QEvent *event)
bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiver, QEvent *event) bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiver, QEvent *event)
{ {
// We can't access the application event filters outside of the main thread (race conditions) // We can't access the application event filters outside of the main thread (race conditions)
Q_ASSERT(receiver->d_func()->threadData->thread == mainThread()); Q_ASSERT(receiver->d_func()->threadData->thread.loadAcquire() == mainThread());
if (extraData) { if (extraData) {
// application event filters are only called for objects in the GUI thread // application event filters are only called for objects in the GUI thread
@ -1234,7 +1236,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
// send to all application event filters (only does anything in the main thread) // send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self if (QCoreApplication::self
&& receiver->d_func()->threadData->thread == mainThread() && receiver->d_func()->threadData->thread.loadAcquire() == mainThread()
&& QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver, event)) { && QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver, event)) {
filtered = true; filtered = true;
return filtered; return filtered;
@ -2655,7 +2657,7 @@ QString QCoreApplication::applicationVersion()
#if QT_CONFIG(library) #if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) Q_GLOBAL_STATIC(QRecursiveMutex, libraryPathMutex)
/*! /*!
Returns a list of paths that the application will search when Returns a list of paths that the application will search when
@ -2905,7 +2907,7 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
return; return;
} }
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(QCoreApplicationPrivate::theMainThread); QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(QCoreApplicationPrivate::theMainThread.loadAcquire());
if (!filterObj || !eventDispatcher) if (!filterObj || !eventDispatcher)
return; return;
eventDispatcher->installNativeEventFilter(filterObj); eventDispatcher->installNativeEventFilter(filterObj);
@ -2961,7 +2963,7 @@ bool QCoreApplication::hasPendingEvents()
*/ */
QAbstractEventDispatcher *QCoreApplication::eventDispatcher() QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
{ {
if (QCoreApplicationPrivate::theMainThread) if (QCoreApplicationPrivate::theMainThread.loadAcquire())
return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher(); return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher();
return 0; return 0;
} }
@ -2974,7 +2976,7 @@ QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
*/ */
void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher) void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
{ {
QThread *mainThread = QCoreApplicationPrivate::theMainThread; QThread *mainThread = QCoreApplicationPrivate::theMainThread.loadAcquire();
if (!mainThread) if (!mainThread)
mainThread = QThread::currentThread(); // will also setup theMainThread mainThread = QThread::currentThread(); // will also setup theMainThread
mainThread->setEventDispatcher(eventDispatcher); mainThread->setEventDispatcher(eventDispatcher);

View File

@ -52,7 +52,9 @@
// //
#include "QtCore/qcoreapplication.h" #include "QtCore/qcoreapplication.h"
#if QT_CONFIG(commandlineparser)
#include "QtCore/qcommandlineoption.h" #include "QtCore/qcommandlineoption.h"
#endif
#include "QtCore/qtranslator.h" #include "QtCore/qtranslator.h"
#if QT_CONFIG(settings) #if QT_CONFIG(settings)
#include "QtCore/qsettings.h" #include "QtCore/qsettings.h"
@ -105,7 +107,9 @@ public:
static bool checkInstance(const char *method); static bool checkInstance(const char *method);
#if QT_CONFIG(commandlineparser)
virtual void addQtOptions(QList<QCommandLineOption> *options); virtual void addQtOptions(QList<QCommandLineOption> *options);
#endif
#ifndef QT_NO_QOBJECT #ifndef QT_NO_QOBJECT
bool sendThroughApplicationEventFilters(QObject *, QEvent *); bool sendThroughApplicationEventFilters(QObject *, QEvent *);

View File

@ -52,7 +52,6 @@
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#include "qcoreapplication_p.h" #include "qcoreapplication_p.h"
#include <private/qthread_p.h> #include <private/qthread_p.h>
#include <private/qmutexpool_p.h>
#include <private/qwineventnotifier_p.h> #include <private/qwineventnotifier_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -101,7 +100,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
QEventDispatcherWin32Private::QEventDispatcherWin32Private() QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0),
getMessageHook(0), wakeUps(0), activateNotifiersPosted(false), wakeUps(0), activateNotifiersPosted(false),
winEventNotifierActivatedEvent(NULL) winEventNotifierActivatedEvent(NULL)
{ {
} }
@ -270,14 +269,6 @@ static inline UINT inputTimerMask()
return result; return result;
} }
LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
{
QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
Q_ASSERT(q != 0);
return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0;
}
// Provide class name and atom for the message window used by // Provide class name and atom for the message window used by
// QEventDispatcherWin32Private via Q_GLOBAL_STATIC shared between threads. // QEventDispatcherWin32Private via Q_GLOBAL_STATIC shared between threads.
struct QWindowsMessageWindowClassContext struct QWindowsMessageWindowClassContext
@ -456,38 +447,11 @@ void QEventDispatcherWin32::createInternalHwnd()
return; return;
d->internalHwnd = qt_create_internal_window(this); d->internalHwnd = qt_create_internal_window(this);
installMessageHook();
// start all normal timers // start all normal timers
for (int i = 0; i < d->timerVec.count(); ++i) for (int i = 0; i < d->timerVec.count(); ++i)
d->registerTimer(d->timerVec.at(i)); d->registerTimer(d->timerVec.at(i));
} }
void QEventDispatcherWin32::installMessageHook()
{
Q_D(QEventDispatcherWin32);
if (d->getMessageHook)
return;
// setup GetMessage hook needed to drive our posted events
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (Q_UNLIKELY(!d->getMessageHook)) {
int errorCode = GetLastError();
qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %ls",
errorCode, qUtf16Printable(qt_error_string(errorCode)));
}
}
void QEventDispatcherWin32::uninstallMessageHook()
{
Q_D(QEventDispatcherWin32);
if (d->getMessageHook)
UnhookWindowsHookEx(d->getMessageHook);
d->getMessageHook = 0;
}
QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent) QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent)
: QAbstractEventDispatcher(*new QEventDispatcherWin32Private, parent) : QAbstractEventDispatcher(*new QEventDispatcherWin32Private, parent)
{ {
@ -583,10 +547,6 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
} }
} }
if (haveMessage) { if (haveMessage) {
// The Direct2d integration unsets getMessageHook. See QTBUG-42428
if (!d->getMessageHook)
(void) qt_GetMessageHook(0, PM_REMOVE, reinterpret_cast<LPARAM>(&msg));
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
// Set result to 'true', if the message was sent by wakeUp(). // Set result to 'true', if the message was sent by wakeUp().
if (msg.wParam == WMWP_QT_FROMWAKEUP) { if (msg.wParam == WMWP_QT_FROMWAKEUP) {
@ -1044,8 +1004,6 @@ void QEventDispatcherWin32::closingDown()
d->timerDict.clear(); d->timerDict.clear();
d->closingDown = true; d->closingDown = true;
uninstallMessageHook();
} }
bool QEventDispatcherWin32::event(QEvent *e) bool QEventDispatcherWin32::event(QEvent *e)

View File

@ -73,8 +73,6 @@ class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher
protected: protected:
void createInternalHwnd(); void createInternalHwnd();
void installMessageHook();
void uninstallMessageHook();
public: public:
explicit QEventDispatcherWin32(QObject *parent = 0); explicit QEventDispatcherWin32(QObject *parent = 0);
@ -115,7 +113,6 @@ protected:
private: private:
friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
friend LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM);
}; };
struct QSockNot { struct QSockNot {
@ -169,7 +166,6 @@ public:
// internal window handle used for socketnotifiers/timers/etc // internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd; HWND internalHwnd;
HHOOK getMessageHook;
// for controlling when to send posted events // for controlling when to send posted events
QAtomicInt wakeUps; QAtomicInt wakeUps;

View File

@ -165,7 +165,7 @@ int QEventLoop::exec(ProcessEventsFlags flags)
{ {
Q_D(QEventLoop); Q_D(QEventLoop);
//we need to protect from race condition with QThread::exit //we need to protect from race condition with QThread::exit
QMutexLocker locker(&static_cast<QThreadPrivate *>(QObjectPrivate::get(d->threadData->thread))->mutex); QMutexLocker locker(&static_cast<QThreadPrivate *>(QObjectPrivate::get(d->threadData->thread.loadAcquire()))->mutex);
if (d->threadData->quitNow) if (d->threadData->quitNow)
return -1; return -1;

View File

@ -74,7 +74,7 @@ template <typename T>
class QTypeModuleInfo class QTypeModuleInfo
{ {
public: public:
enum Module { enum Module : bool {
IsCore = false, IsCore = false,
IsWidget = false, IsWidget = false,
IsGui = false, IsGui = false,

View File

@ -219,7 +219,7 @@ QObjectPrivate::QObjectPrivate(int version)
QObjectPrivate::~QObjectPrivate() QObjectPrivate::~QObjectPrivate()
{ {
if (extraData && !extraData->runningTimers.isEmpty()) { if (extraData && !extraData->runningTimers.isEmpty()) {
if (Q_LIKELY(threadData->thread == QThread::currentThread())) { if (Q_LIKELY(threadData->thread.loadAcquire() == QThread::currentThread())) {
// unregister pending timers // unregister pending timers
if (threadData->hasEventDispatcher()) if (threadData->hasEventDispatcher())
threadData->eventDispatcher.loadRelaxed()->unregisterTimers(q_ptr); threadData->eventDispatcher.loadRelaxed()->unregisterTimers(q_ptr);
@ -421,7 +421,7 @@ void QObjectPrivate::ConnectionData::cleanOrphanedConnectionsImpl(QObject *sende
ConnectionOrSignalVector *c = nullptr; ConnectionOrSignalVector *c = nullptr;
{ {
QBasicMutexLocker l(signalSlotLock(sender)); QBasicMutexLocker l(signalSlotLock(sender));
if (ref > 1) if (ref.loadAcquire() > 1)
return; return;
// Since ref == 1, no activate() is in process since we locked the mutex. That implies, // Since ref == 1, no activate() is in process since we locked the mutex. That implies,
@ -493,11 +493,11 @@ bool QObjectPrivate::maybeSignalConnected(uint signalIndex) const
if (!signalVector) if (!signalVector)
return false; return false;
if (signalVector->at(-1).first) if (signalVector->at(-1).first.loadAcquire())
return true; return true;
if (signalIndex < uint(cd->signalVectorCount())) { if (signalIndex < uint(cd->signalVectorCount())) {
const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first; const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first.loadAcquire();
return c != nullptr; return c != nullptr;
} }
return false; return false;
@ -819,8 +819,8 @@ static bool check_parent_thread(QObject *parent,
QThreadData *currentThreadData) QThreadData *currentThreadData)
{ {
if (parent && parentThreadData != currentThreadData) { if (parent && parentThreadData != currentThreadData) {
QThread *parentThread = parentThreadData->thread; QThread *parentThread = parentThreadData->thread.loadAcquire();
QThread *currentThread = currentThreadData->thread; QThread *currentThread = currentThreadData->thread.loadAcquire();
qWarning("QObject: Cannot create children for a parent that is in a different thread.\n" qWarning("QObject: Cannot create children for a parent that is in a different thread.\n"
"(Parent is %s(%p), parent's thread is %s(%p), current thread is %s(%p)", "(Parent is %s(%p), parent's thread is %s(%p), current thread is %s(%p)",
parent->metaObject()->className(), parent->metaObject()->className(),
@ -987,11 +987,11 @@ QObject::~QObject()
QObjectPrivate::ConnectionList &connectionList = cd->connectionsForSignal(signal); QObjectPrivate::ConnectionList &connectionList = cd->connectionsForSignal(signal);
while (QObjectPrivate::Connection *c = connectionList.first.loadRelaxed()) { while (QObjectPrivate::Connection *c = connectionList.first.loadRelaxed()) {
Q_ASSERT(c->receiver); Q_ASSERT(c->receiver.loadAcquire());
QBasicMutex *m = signalSlotLock(c->receiver.loadRelaxed()); QBasicMutex *m = signalSlotLock(c->receiver.loadRelaxed());
bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m); bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
if (c->receiver) { if (c->receiver.loadAcquire()) {
cd->removeConnection(c); cd->removeConnection(c);
Q_ASSERT(connectionList.first.loadRelaxed() != c); Q_ASSERT(connectionList.first.loadRelaxed() != c);
} }
@ -1003,7 +1003,7 @@ QObject::~QObject()
/* Disconnect all senders: /* Disconnect all senders:
*/ */
while (QObjectPrivate::Connection *node = cd->senders) { while (QObjectPrivate::Connection *node = cd->senders) {
Q_ASSERT(node->receiver); Q_ASSERT(node->receiver.loadAcquire());
QObject *sender = node->sender; QObject *sender = node->sender;
// Send disconnectNotify before removing the connection from sender's connection list. // Send disconnectNotify before removing the connection from sender's connection list.
// This ensures any eventual destructor of sender will block on getting receiver's lock // This ensures any eventual destructor of sender will block on getting receiver's lock
@ -1453,7 +1453,7 @@ bool QObject::blockSignals(bool block) noexcept
*/ */
QThread *QObject::thread() const QThread *QObject::thread() const
{ {
return d_func()->threadData->thread; return d_func()->threadData->thread.loadAcquire();
} }
/*! /*!
@ -1500,7 +1500,7 @@ void QObject::moveToThread(QThread *targetThread)
{ {
Q_D(QObject); Q_D(QObject);
if (d->threadData->thread == targetThread) { if (d->threadData->thread.loadAcquire() == targetThread) {
// object is already in this thread // object is already in this thread
return; return;
} }
@ -1516,7 +1516,7 @@ void QObject::moveToThread(QThread *targetThread)
QThreadData *currentData = QThreadData::current(); QThreadData *currentData = QThreadData::current();
QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : nullptr; QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : nullptr;
if (d->threadData->thread == 0 && currentData == targetData) { if (d->threadData->thread.loadAcquire() == 0 && currentData == targetData) {
// one exception to the rule: we allow moving objects with no thread affinity to the current thread // one exception to the rule: we allow moving objects with no thread affinity to the current thread
currentData = d->threadData; currentData = d->threadData;
} else if (d->threadData != currentData) { } else if (d->threadData != currentData) {
@ -2232,6 +2232,8 @@ void QObject::removeEventFilter(QObject *obj)
*/ */
/*! /*!
\threadsafe
Schedules this object for deletion. Schedules this object for deletion.
The object will be deleted when control returns to the event The object will be deleted when control returns to the event
@ -3716,7 +3718,7 @@ void doActivate(QObject *sender, int signal_index, void **argv)
bool senderDeleted = false; bool senderDeleted = false;
{ {
Q_ASSERT(sp->connections); Q_ASSERT(sp->connections.loadAcquire());
QObjectPrivate::ConnectionDataPointer connections(sp->connections.loadRelaxed()); QObjectPrivate::ConnectionDataPointer connections(sp->connections.loadRelaxed());
QObjectPrivate::SignalVector *signalVector = connections->signalVector.loadRelaxed(); QObjectPrivate::SignalVector *signalVector = connections->signalVector.loadRelaxed();
@ -3773,7 +3775,7 @@ void doActivate(QObject *sender, int signal_index, void **argv)
QSemaphore semaphore; QSemaphore semaphore;
{ {
QBasicMutexLocker locker(signalSlotLock(sender)); QBasicMutexLocker locker(signalSlotLock(sender));
if (!c->receiver) if (!c->receiver.loadAcquire())
continue; continue;
QMetaCallEvent *ev = c->isSlotObject ? QMetaCallEvent *ev = c->isSlotObject ?
new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv, &semaphore) : new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv, &semaphore) :
@ -4187,13 +4189,14 @@ void QObject::dumpObjectInfo() const
} }
#ifndef QT_NO_USERDATA #ifndef QT_NO_USERDATA
static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0);
/*! /*!
\internal \internal
*/ */
uint QObject::registerUserData() uint QObject::registerUserData()
{ {
static int user_data_registration = 0; return user_data_registration.fetchAndAddRelaxed(1);
return user_data_registration++;
} }
/*! /*!
@ -4526,6 +4529,24 @@ QDebug operator<<(QDebug dbg, const QObject *o)
Q_NAMESPACE makes an external variable, \c{staticMetaObject}, available. Q_NAMESPACE makes an external variable, \c{staticMetaObject}, available.
\c{staticMetaObject} is of type QMetaObject and provides access to the \c{staticMetaObject} is of type QMetaObject and provides access to the
enums declared with Q_ENUM_NS/Q_FLAG_NS. enums declared with Q_ENUM_NS/Q_FLAG_NS.
\sa Q_NAMESPACE_EXPORT
*/
/*!
\macro Q_NAMESPACE_EXPORT(EXPORT_MACRO)
\relates QObject
\since 5.14
The Q_NAMESPACE_EXPORT macro can be used to add QMetaObject capabilities
to a namespace.
It works exactly like the Q_NAMESPACE macro. However, the external
\c{staticMetaObject} variable that gets defined in the namespace
is declared with the supplied \c{EXPORT_MACRO} qualifier. This is
useful f.i. if the object needs to be exported from a dynamic library.
\sa Q_NAMESPACE, {Creating Shared Libraries}
*/ */
/*! /*!

View File

@ -71,12 +71,16 @@ class QObjectPrivate;
class QObject; class QObject;
class QThread; class QThread;
class QWidget; class QWidget;
class QAccessibleWidget;
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
class QRegExp; class QRegExp;
#endif #endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
class QRegularExpression; class QRegularExpression;
#endif #endif
#if !QT_DEPRECATED_SINCE(5, 14) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
# define QT_NO_USERDATA
#endif
#ifndef QT_NO_USERDATA #ifndef QT_NO_USERDATA
class QObjectUserData; class QObjectUserData;
#endif #endif
@ -405,8 +409,11 @@ public:
#endif // QT_NO_PROPERTIES #endif // QT_NO_PROPERTIES
#ifndef QT_NO_USERDATA #ifndef QT_NO_USERDATA
QT_DEPRECATED_VERSION_5_14
static uint registerUserData(); static uint registerUserData();
QT_DEPRECATED_VERSION_X_5_14("Use setProperty()")
void setUserData(uint id, QObjectUserData* data); void setUserData(uint id, QObjectUserData* data);
QT_DEPRECATED_VERSION_X_5_14("Use property()")
QObjectUserData* userData(uint id) const; QObjectUserData* userData(uint id) const;
#endif // QT_NO_USERDATA #endif // QT_NO_USERDATA
@ -453,6 +460,7 @@ protected:
friend class QCoreApplication; friend class QCoreApplication;
friend class QCoreApplicationPrivate; friend class QCoreApplicationPrivate;
friend class QWidget; friend class QWidget;
friend class QAccessibleWidget;
friend class QThreadData; friend class QThreadData;
private: private:

View File

@ -279,7 +279,7 @@ public:
void removeConnection(Connection *c); void removeConnection(Connection *c);
void cleanOrphanedConnections(QObject *sender) void cleanOrphanedConnections(QObject *sender)
{ {
if (orphaned.loadRelaxed() && ref == 1) if (orphaned.loadRelaxed() && ref.loadAcquire() == 1)
cleanOrphanedConnectionsImpl(sender); cleanOrphanedConnectionsImpl(sender);
} }
void cleanOrphanedConnectionsImpl(QObject *sender); void cleanOrphanedConnectionsImpl(QObject *sender);
@ -312,7 +312,7 @@ public:
} }
} }
int signalVectorCount() const { int signalVectorCount() const {
return signalVector ? signalVector.loadRelaxed()->count() : -1; return signalVector.loadAcquire() ? signalVector.loadRelaxed()->count() : -1;
} }
static void deleteOrphaned(ConnectionOrSignalVector *c); static void deleteOrphaned(ConnectionOrSignalVector *c);

View File

@ -201,12 +201,16 @@ private: \
QT_ANNOTATE_CLASS(qt_qgadget, "") \ QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/ /*end*/
/* qmake ignore Q_NAMESPACE */ /* qmake ignore Q_NAMESPACE_EXPORT */
#define Q_NAMESPACE \ #define Q_NAMESPACE_EXPORT(...) \
extern const QMetaObject staticMetaObject; \ extern __VA_ARGS__ const QMetaObject staticMetaObject; \
QT_ANNOTATE_CLASS(qt_qnamespace, "") \ QT_ANNOTATE_CLASS(qt_qnamespace, "") \
/*end*/ /*end*/
/* qmake ignore Q_NAMESPACE */
#define Q_NAMESPACE Q_NAMESPACE_EXPORT() \
/*end*/
#endif // QT_NO_META_MACROS #endif // QT_NO_META_MACROS
#else // Q_MOC_RUN #else // Q_MOC_RUN

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