Merge "Merge remote-tracking branch 'origin/5.13' into dev" into refs/staging/dev
This commit is contained in:
commit
ed485243b5
@ -465,7 +465,9 @@ defineTest(reloadSpec) {
|
||||
$$[QT_HOST_DATA/src]/mkspecs/features/mac/toolchain.prf \
|
||||
$$[QT_HOST_DATA/src]/mkspecs/features/toolchain.prf
|
||||
|
||||
_SAVED_CONFIG = $$CONFIG
|
||||
saved_variables = CONFIG QMAKE_CXXFLAGS
|
||||
for (name, saved_variables): \
|
||||
_SAVED_$$name = $$eval($$name)
|
||||
load(spec_pre)
|
||||
# qdevice.pri gets written too late (and we can't write it early
|
||||
# enough, as it's populated in stages, with later ones depending
|
||||
@ -474,7 +476,8 @@ defineTest(reloadSpec) {
|
||||
eval($$l)
|
||||
include($$QMAKESPEC/qmake.conf)
|
||||
load(spec_post)
|
||||
CONFIG += $$_SAVED_CONFIG
|
||||
for (name, saved_variables): \
|
||||
$$name += $$eval(_SAVED_$$name)
|
||||
load(default_pre)
|
||||
|
||||
# ensure pristine environment for configuration. again.
|
||||
|
105
dist/changes-5.12.2
vendored
Normal file
105
dist/changes-5.12.2
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
Qt 5.12.2 is a bug-fix release. It maintains both forward and backward
|
||||
compatibility (source and binary) with Qt 5.12.0 through 5.12.1.
|
||||
|
||||
For more details, refer to the online documentation included in this
|
||||
distribution. The documentation is also available online:
|
||||
|
||||
https://doc.qt.io/qt-5/index.html
|
||||
|
||||
The Qt version 5.12 series is binary compatible with the 5.11.x series.
|
||||
Applications compiled for 5.11 will continue to run with 5.12.
|
||||
|
||||
Some of the changes listed in this file include issue tracking numbers
|
||||
corresponding to tasks in the Qt Bug Tracker:
|
||||
|
||||
https://bugreports.qt.io/
|
||||
|
||||
Each of these identifiers can be entered in the bug tracker to obtain more
|
||||
information about a particular change.
|
||||
|
||||
****************************************************************************
|
||||
* Important Behavior Changes *
|
||||
****************************************************************************
|
||||
|
||||
- QtTestLib:
|
||||
* [QTBUG-72928] Blacklisting of tests will be taken into account for
|
||||
XPASS and XFAIL. A blacklisted test that causes an XPASS will no
|
||||
longer be a fail.
|
||||
|
||||
****************************************************************************
|
||||
* QtCore *
|
||||
****************************************************************************
|
||||
|
||||
- [QTBUG-72885] Fixed a number of warnings with Clang or Clang-Tidy in
|
||||
Qt headers related to alignment of Qt private classes.
|
||||
|
||||
- QDate, QTime and QDateTime;
|
||||
* [QTBUG-51208] Corrected documentation of how non-placeholder
|
||||
characters are handled in format patterns passed to toString().
|
||||
|
||||
- QCoreApplication:
|
||||
* [QTBUG-57171] Fixed an out-of-bounds access if the translatable
|
||||
string passed to tr() ended in '%'.
|
||||
|
||||
- QFileInfo:
|
||||
* [QTBUG-72644] Fixed a bug that would cause QFileInfo to report an
|
||||
link incorrectly as a non-link.
|
||||
|
||||
- QLocale:
|
||||
* Fixed a crash if qDebug() is used after main() has exited.
|
||||
* [QTBUG-73403] Fixed a race condition in getting the system locale
|
||||
(possible regression from Qt 5.11.x)
|
||||
|
||||
- QSysInfo:
|
||||
* Fixed a bug on BSD systems in getting the machineUniqueId().
|
||||
* Fixed a bug on Windows in 32-bit applications getting the
|
||||
machineUniqueId() when the OS is 64-bit.
|
||||
|
||||
- QWaitCondition:
|
||||
* Fixed handling of wait(QDeadlineTimer::Forever) on 32-bit platforms.
|
||||
|
||||
****************************************************************************
|
||||
* QtWidgets *
|
||||
****************************************************************************
|
||||
|
||||
- ItemViews:
|
||||
* Fixed a regression with wrongly drawn centered/right aligned item
|
||||
texts
|
||||
|
||||
****************************************************************************
|
||||
* Third-Party Code *
|
||||
****************************************************************************
|
||||
|
||||
- libpng was updated to version 1.6.36
|
||||
|
||||
****************************************************************************
|
||||
* Freetype *
|
||||
****************************************************************************
|
||||
|
||||
- Upgraded bundled Freetype version to 2.9.1. This also adds support for
|
||||
the latest emoji font in use on Android 9.
|
||||
|
||||
****************************************************************************
|
||||
* Android *
|
||||
****************************************************************************
|
||||
|
||||
- Added the --no-strip command line option to androiddeployqt.
|
||||
|
||||
- qmake:
|
||||
* Can now set the version name and code for Android using
|
||||
ANDROID_VERSION_NAME and ANDROID_VERSION_CODE respectively in the pro
|
||||
file.
|
||||
|
||||
****************************************************************************
|
||||
* Windows *
|
||||
****************************************************************************
|
||||
|
||||
- Fixed an issue where loading fonts from files or data would sometimes
|
||||
mistakenly classify them as oblique.
|
||||
|
||||
****************************************************************************
|
||||
* qmake *
|
||||
****************************************************************************
|
||||
|
||||
- [QTBUG-27079] A new feature "cmdline" was added that implies "CONFIG +=
|
||||
console" and "CONFIG -= app_bundle".
|
@ -70,7 +70,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
|
||||
static QVariantList listFromXml(QXmlStreamReader &xml, Converter::Options options)
|
||||
{
|
||||
QVariantList list;
|
||||
while (!xml.atEnd() && !xml.isEndElement()) {
|
||||
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("list"))) {
|
||||
xml.readNext();
|
||||
switch (xml.tokenType()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
@ -107,7 +107,7 @@ static QVariantList listFromXml(QXmlStreamReader &xml, Converter::Options option
|
||||
static VariantOrderedMap::value_type mapEntryFromXml(QXmlStreamReader &xml, Converter::Options options)
|
||||
{
|
||||
QVariant key, value;
|
||||
while (!xml.atEnd() && !xml.isEndElement()) {
|
||||
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("entry"))) {
|
||||
xml.readNext();
|
||||
switch (xml.tokenType()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
@ -150,7 +150,7 @@ static QVariant mapFromXml(QXmlStreamReader &xml, Converter::Options options)
|
||||
QVariantMap map1;
|
||||
VariantOrderedMap map2;
|
||||
|
||||
while (!xml.atEnd() && !xml.isEndElement()) {
|
||||
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("map"))) {
|
||||
xml.readNext();
|
||||
switch (xml.tokenType()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
|
@ -117,8 +117,8 @@
|
||||
|
||||
\snippet tools/customtype/main.cpp storing a custom value
|
||||
|
||||
Alternatively, the QVariant::fromValue() and qVariantSetValue() functions
|
||||
can be used if you are using a compiler without support for member template
|
||||
Alternatively, the QVariant::fromValue() function can be used if
|
||||
you are using a compiler without support for member template
|
||||
functions.
|
||||
|
||||
The value can be retrieved using the QVariant::value() member template
|
||||
@ -126,9 +126,6 @@
|
||||
|
||||
\snippet tools/customtype/main.cpp retrieving a custom value
|
||||
|
||||
Alternatively, the qVariantValue() template function can be used if
|
||||
you are using a compiler without support for member template functions.
|
||||
|
||||
\section1 Further Reading
|
||||
|
||||
The custom \c Message type can also be used with direct signal-slot
|
||||
|
@ -49,6 +49,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "renderer.h"
|
||||
#include "qrandom.h"
|
||||
#include <QVulkanFunctions>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QTime>
|
||||
@ -77,8 +78,6 @@ Renderer::Renderer(VulkanWindow *w, int initialCount)
|
||||
m_cam(QVector3D(0.0f, 0.0f, 20.0f)), // starting camera position
|
||||
m_instCount(initialCount)
|
||||
{
|
||||
qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
|
||||
|
||||
m_floorModel.translate(0, -5, 0);
|
||||
m_floorModel.rotate(-90, 1, 0, 0);
|
||||
m_floorModel.scale(20, 100, 1);
|
||||
@ -793,7 +792,9 @@ void Renderer::ensureInstanceBuffer()
|
||||
qDebug("Preparing instances %d..%d", m_preparedInstCount, m_instCount - 1);
|
||||
char *p = m_instData.data();
|
||||
p += m_preparedInstCount * PER_INSTANCE_DATA_SIZE;
|
||||
auto gen = [](float a, float b) { return float((qrand() % int(b - a + 1)) + a); };
|
||||
auto gen = [](int a, int b) {
|
||||
return float(QRandomGenerator::global()->bounded(double(b - a)) + a);
|
||||
};
|
||||
for (int i = m_preparedInstCount; i < m_instCount; ++i) {
|
||||
// Apply a random translation to each instance of the mesh.
|
||||
float t[] = { gen(-5, 5), gen(-4, 6), gen(-30, 5) };
|
||||
|
@ -59,6 +59,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(systray);
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
|
@ -59,6 +59,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(classwizard);
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
|
@ -59,6 +59,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(licensewizard);
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
|
@ -59,6 +59,7 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication app(argc, argv);
|
||||
QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
|
||||
|
||||
|
@ -123,6 +123,8 @@ QWizardPage *createConclusionPage()
|
||||
int main(int argc, char *argv[])
|
||||
//! [9] //! [11]
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
|
@ -49,7 +49,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtCore>
|
||||
#include <stdio.h>
|
||||
|
||||
//! [0]
|
||||
class Factorial : public QObject
|
||||
@ -143,7 +142,7 @@ public:
|
||||
|
||||
void onTransition(QEvent *) override
|
||||
{
|
||||
fprintf(stdout, "%d\n", m_fact->property("fac").toInt());
|
||||
qInfo() << m_fact->property("fac").toInt();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -17,8 +17,8 @@ os_directory = $$(INTEGRITY_DIR)
|
||||
isEmpty(os_directory): \
|
||||
error("This qmakespec requires $INTEGRITY_DIR to be set")
|
||||
|
||||
QMAKE_CC = cxintarm64 -U__ARM_NEON__ -U__ARM_NEON -bsp $$bsp_name -os_dir $$os_directory -non_shared
|
||||
QMAKE_CXX = cxintarm64 -U__ARM_NEON__ -U__ARM_NEON -bsp $$bsp_name -os_dir $$os_directory -non_shared
|
||||
QMAKE_CC = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared
|
||||
QMAKE_CXX = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_AR = $$QMAKE_CXX -archive -o
|
||||
|
||||
|
@ -62,6 +62,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
||||
set(_search_paths)
|
||||
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
|
||||
foreach(_flag ${_static_depends})
|
||||
string(REPLACE \"\\\"\" \"\" _flag ${_flag})
|
||||
if(_flag MATCHES \"^-l(.*)$\")
|
||||
# Handle normal libraries passed as -lfoo
|
||||
set(_lib \"${CMAKE_MATCH_1}\")
|
||||
|
@ -13,7 +13,14 @@ equals(TEMPLATE, app): TEMPLATE = aux
|
||||
|
||||
isEmpty(TARGETPATH): error("Must set TARGETPATH (QML import name)")
|
||||
|
||||
qmldir_file = $$_PRO_FILE_PWD_/qmldir
|
||||
!isEmpty(DYNAMIC_QMLDIR) {
|
||||
qmldir_path = $$OUT_PWD
|
||||
write_file($${qmldir_path}/qmldir, DYNAMIC_QMLDIR)|error("Aborting.")
|
||||
} else {
|
||||
qmldir_path = $$_PRO_FILE_PWD_
|
||||
}
|
||||
|
||||
qmldir_file = $${qmldir_path}/qmldir
|
||||
|
||||
fq_qml_files =
|
||||
for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
|
||||
@ -42,13 +49,20 @@ builtin_resources {
|
||||
}
|
||||
|
||||
# Install rules
|
||||
qmldir.base = $$_PRO_FILE_PWD_
|
||||
qmldir.base = $$qmldir_path
|
||||
# Tools need qmldir and plugins.qmltypes always installed on the file system
|
||||
qmldir.files = $$qmldir_file $$fq_aux_qml_files
|
||||
|
||||
qmldir.files = $$qmldir_file
|
||||
install_qml_files: qmldir.files += $$fq_qml_files
|
||||
qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
|
||||
INSTALLS += qmldir
|
||||
|
||||
qmlfiles.base = $$_PRO_FILE_PWD_
|
||||
qmlfiles.files = $$fq_aux_qml_files
|
||||
install_qml_files: qmlfiles.files += $$fq_qml_files
|
||||
qmlfiles.path = $${qmldir.path}
|
||||
INSTALLS += qmlfiles
|
||||
|
||||
!debug_and_release|!build_all|CONFIG(release, debug|release) {
|
||||
!prefix_build {
|
||||
COPIES += qmldir
|
||||
|
@ -61,6 +61,13 @@ defineTest(qtConfCommandlineSetInput) {
|
||||
val = $${2}
|
||||
!isEmpty($${currentConfig}.commandline.options.$${arg}.name): \
|
||||
arg = $$eval($${currentConfig}.commandline.options.$${arg}.name)
|
||||
!isEmpty(config.input.$$arg) {
|
||||
oldval = $$eval(config.input.$$arg)
|
||||
equals(oldval, $$val): \
|
||||
qtConfAddNote("Option '$$arg' with value '$$val' was specified twice")
|
||||
else: \
|
||||
qtConfAddNote("Overriding option '$$arg' with '$$val' (was: '$$oldval')")
|
||||
}
|
||||
|
||||
config.input.$$arg = $$val
|
||||
export(config.input.$$arg)
|
||||
@ -544,7 +551,15 @@ defineTest(qtConfResolveLibs) {
|
||||
} else: contains(l, "^-l.*") {
|
||||
lib = $$replace(l, "^-l", )
|
||||
lcan =
|
||||
unix {
|
||||
integrity:contains(lib, "^.*\\.a") {
|
||||
# INTEGRITY compiler searches for exact filename
|
||||
# if -l argument has .a suffix
|
||||
lcan += $${lib}
|
||||
} else: contains(lib, "^:.*") {
|
||||
# Use exact filename when -l:filename syntax is used.
|
||||
lib ~= s/^://
|
||||
lcan += $${lib}
|
||||
} else: unix {
|
||||
# Under UNIX, we look for actual shared libraries, in addition
|
||||
# to static ones.
|
||||
shexts = $$QMAKE_EXTENSION_SHLIB $$QMAKE_EXTENSIONS_AUX_SHLIB
|
||||
|
@ -28,6 +28,7 @@ for(resource, RESOURCES) {
|
||||
!exists($$absolute_path($$resource, $$_PRO_FILE_PWD_)): \
|
||||
warning("Failure to find: $$resource")
|
||||
qmake_immediate.files += $$resource
|
||||
OTHER_FILES *= $$resource
|
||||
}
|
||||
RESOURCES -= $$resource
|
||||
next()
|
||||
@ -57,6 +58,7 @@ for(resource, RESOURCES) {
|
||||
alias = $$relative_path($$file, $$abs_base)
|
||||
resource_file_content += \
|
||||
"<file alias=\"$$xml_escape($$alias)\">$$xml_escape($$file)</file>"
|
||||
OTHER_FILES *= $$file
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,9 +75,11 @@ for(resource, RESOURCES) {
|
||||
}
|
||||
|
||||
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
|
||||
resource_init_function = $$lower($$basename(TARGET))_plugin_resource_init
|
||||
pluginBaseName = $$basename(TARGET)
|
||||
pluginName = $$lower($$replace(pluginBaseName, [-], _))
|
||||
resource_init_function = $${pluginName}_plugin_resource_init
|
||||
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
|
||||
RESOURCE_INIT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_resources.cpp
|
||||
RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
|
||||
|
||||
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
|
||||
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
|
||||
|
@ -32,15 +32,6 @@ EMCC_COMMON_LFLAGS = \
|
||||
--bind \
|
||||
-s \"BINARYEN_TRAP_MODE=\'clamp\'\"
|
||||
|
||||
EMCC_USE_PORTS_FLAGS = \
|
||||
-s USE_FREETYPE=1 \
|
||||
-s USE_ZLIB=1
|
||||
|
||||
# libpng does not build for WASM_OBJECT_FILES=1, see
|
||||
# https://github.com/emscripten-core/emscripten/issues/8143
|
||||
equals(WASM_OBJECT_FILES, 0):\
|
||||
EMCC_USE_PORTS_FLAGS += -s USE_LIBPNG=1
|
||||
|
||||
# The -s arguments can also be used with release builds,
|
||||
# but are here in debug for clarity.
|
||||
EMCC_COMMON_LFLAGS_DEBUG = \
|
||||
@ -87,9 +78,6 @@ QMAKE_COMPILER += emscripten
|
||||
QMAKE_CC = emcc
|
||||
QMAKE_CXX = em++
|
||||
|
||||
QMAKE_CFLAGS += $$EMCC_USE_PORTS_FLAGS
|
||||
QMAKE_CXXFLAGS += $$EMCC_USE_PORTS_FLAGS
|
||||
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
||||
QMAKE_LINK_C = $$QMAKE_CC
|
||||
|
@ -13,19 +13,19 @@ QMAKE_CFLAGS_SSE4_1 = -msse4.1
|
||||
QMAKE_CFLAGS_SSE4_2 = -msse4.2
|
||||
QMAKE_CFLAGS_AVX = -mavx
|
||||
QMAKE_CFLAGS_AVX2 = -mavx2
|
||||
QMAKE_CFLAGS_F16C = -mf16c
|
||||
QMAKE_CFLAGS_RDRND = -mrdrnd
|
||||
QMAKE_CFLAGS_AVX512F = -mavx512f
|
||||
QMAKE_CFLAGS_AVX512ER = -mavx512er
|
||||
QMAKE_CFLAGS_AVX512CD = -mavx512cd
|
||||
QMAKE_CFLAGS_AVX512PF = -mavx512pf
|
||||
QMAKE_CFLAGS_AVX512DQ = -mavx512dq
|
||||
QMAKE_CFLAGS_AVX512BW = -mavx512bw
|
||||
QMAKE_CFLAGS_AVX512VL = -mavx512vl
|
||||
QMAKE_CFLAGS_F16C = -mf16c
|
||||
QMAKE_CFLAGS_RDRND = -mrdrnd
|
||||
QMAKE_CFLAGS_AVX512F = -mavx512f
|
||||
QMAKE_CFLAGS_AVX512ER = -mavx512er
|
||||
QMAKE_CFLAGS_AVX512CD = -mavx512cd
|
||||
QMAKE_CFLAGS_AVX512PF = -mavx512pf
|
||||
QMAKE_CFLAGS_AVX512DQ = -mavx512dq
|
||||
QMAKE_CFLAGS_AVX512BW = -mavx512bw
|
||||
QMAKE_CFLAGS_AVX512VL = -mavx512vl
|
||||
QMAKE_CFLAGS_AVX512IFMA = -mavx512ifma
|
||||
QMAKE_CFLAGS_AVX512VBMI = -mavx512vbmi
|
||||
QMAKE_CFLAGS_AESNI = -maes
|
||||
QMAKE_CFLAGS_SHANI = -msha
|
||||
QMAKE_CFLAGS_AESNI = -maes
|
||||
QMAKE_CFLAGS_SHANI = -msha
|
||||
|
||||
QMAKE_COMPILER += clang_cl llvm
|
||||
|
||||
|
@ -23,4 +23,8 @@ QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
|
||||
QMAKE_LINK = $${CROSS_COMPILE}g++
|
||||
QMAKE_LINK_C = $${CROSS_COMPILE}gcc
|
||||
|
||||
QMAKE_CFLAGS_LTCG = -flto
|
||||
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||
|
||||
load(qt_config)
|
||||
|
@ -95,7 +95,9 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
|
||||
|
||||
if (project->isActiveConfig("debug_info")) {
|
||||
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
|
||||
QString pdb_target = project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb";
|
||||
const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
|
||||
+ project->first("TARGET_EXT");
|
||||
const QString pdb_target = targetFileInfo.completeBaseName() + ".pdb";
|
||||
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
|
||||
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
|
||||
if(!ret.isEmpty())
|
||||
@ -252,15 +254,16 @@ void NmakeMakefileGenerator::init()
|
||||
project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC);
|
||||
}
|
||||
|
||||
ProString tgt = project->first("DESTDIR")
|
||||
+ project->first("TARGET") + project->first("TARGET_VERSION_EXT");
|
||||
if(project->isActiveConfig("shared")) {
|
||||
project->values("QMAKE_CLEAN").append(tgt + ".exp");
|
||||
project->values("QMAKE_DISTCLEAN").append(tgt + ".lib");
|
||||
const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
|
||||
+ project->first("TARGET_EXT");
|
||||
const ProString targetBase = targetFileInfo.path() + '/' + targetFileInfo.completeBaseName();
|
||||
if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("shared")) {
|
||||
project->values("QMAKE_CLEAN").append(targetBase + ".exp");
|
||||
project->values("QMAKE_DISTCLEAN").append(targetBase + ".lib");
|
||||
}
|
||||
if (project->isActiveConfig("debug_info")) {
|
||||
QString pdbfile;
|
||||
QString distPdbFile = tgt + ".pdb";
|
||||
QString distPdbFile = targetBase + ".pdb";
|
||||
if (project->isActiveConfig("staticlib")) {
|
||||
// For static libraries, the compiler's pdb file and the dist pdb file are the same.
|
||||
pdbfile = distPdbFile;
|
||||
@ -276,8 +279,8 @@ void NmakeMakefileGenerator::init()
|
||||
project->values("QMAKE_DISTCLEAN").append(distPdbFile);
|
||||
}
|
||||
if (project->isActiveConfig("debug")) {
|
||||
project->values("QMAKE_CLEAN").append(tgt + ".ilk");
|
||||
project->values("QMAKE_CLEAN").append(tgt + ".idb");
|
||||
project->values("QMAKE_CLEAN").append(targetBase + ".ilk");
|
||||
project->values("QMAKE_CLEAN").append(targetBase + ".idb");
|
||||
} else {
|
||||
ProStringList &defines = project->values("DEFINES");
|
||||
if (!defines.contains("NDEBUG"))
|
||||
|
@ -260,31 +260,25 @@ static int installFile(const QString &source, const QString &target, bool exe =
|
||||
return 3;
|
||||
}
|
||||
|
||||
QFileDevice::Permissions targetPermissions = QFileDevice::ReadOwner | QFileDevice::WriteOwner
|
||||
| QFileDevice::ReadUser | QFileDevice::WriteUser
|
||||
| QFileDevice::ReadGroup | QFileDevice::ReadOther;
|
||||
if (exe) {
|
||||
if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther)) {
|
||||
fprintf(stderr, "Error setting execute permissions on %s: %s\n",
|
||||
qPrintable(target), qPrintable(targetFile.errorString()));
|
||||
return 3;
|
||||
}
|
||||
targetPermissions |= QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther;
|
||||
}
|
||||
if (!targetFile.setPermissions(targetPermissions)) {
|
||||
fprintf(stderr, "Error setting permissions on %s: %s\n",
|
||||
qPrintable(target), qPrintable(targetFile.errorString()));
|
||||
return 3;
|
||||
}
|
||||
|
||||
// Copy file times
|
||||
QString error;
|
||||
#ifdef Q_OS_WIN
|
||||
const QFile::Permissions permissions = targetFile.permissions();
|
||||
const bool readOnly = !(permissions & QFile::WriteUser);
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions | QFile::WriteUser);
|
||||
#endif
|
||||
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
|
||||
fprintf(stderr, "%s", qPrintable(error));
|
||||
return 3;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -765,11 +765,19 @@ public class QtActivityDelegate
|
||||
}
|
||||
m_layout = new QtLayout(m_activity, startApplication);
|
||||
|
||||
int orientation = m_activity.getResources().getConfiguration().orientation;
|
||||
|
||||
try {
|
||||
ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA);
|
||||
if (info.metaData.containsKey("android.app.splash_screen_drawable")) {
|
||||
|
||||
String splashScreenKey = "android.app.splash_screen_drawable_"
|
||||
+ (orientation == Configuration.ORIENTATION_LANDSCAPE ? "landscape" : "portrait");
|
||||
if (!info.metaData.containsKey(splashScreenKey))
|
||||
splashScreenKey = "android.app.splash_screen_drawable";
|
||||
|
||||
if (info.metaData.containsKey(splashScreenKey)) {
|
||||
m_splashScreenSticky = info.metaData.containsKey("android.app.splash_screen_sticky") && info.metaData.getBoolean("android.app.splash_screen_sticky");
|
||||
int id = info.metaData.getInt("android.app.splash_screen_drawable");
|
||||
int id = info.metaData.getInt(splashScreenKey);
|
||||
m_splashScreen = new ImageView(m_activity);
|
||||
m_splashScreen.setImageDrawable(m_activity.getResources().getDrawable(id));
|
||||
m_splashScreen.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
@ -789,7 +797,6 @@ public class QtActivityDelegate
|
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
|
||||
int orientation = m_activity.getResources().getConfiguration().orientation;
|
||||
int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation();
|
||||
boolean rot90 = (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270);
|
||||
boolean currentlyLandscape = (orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
|
@ -52,6 +52,12 @@
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
|
||||
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
|
||||
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
|
||||
are done populating your window with content. -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||
<!-- Splash screen -->
|
||||
|
@ -321,10 +321,10 @@ function(QT5_ADD_BIG_RESOURCES outfiles )
|
||||
add_custom_command(OUTPUT ${tmpoutfile}
|
||||
COMMAND ${Qt5Core_RCC_EXECUTABLE} ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile}
|
||||
DEPENDS ${infile} ${_rc_depends} "${out_depends}" VERBATIM)
|
||||
set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOMOC ON)
|
||||
set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOUIC ON)
|
||||
add_custom_target(big_resources_${outfilename} ALL DEPENDS ${tmpoutfile})
|
||||
add_library(rcc_object_${outfilename} OBJECT ${tmpoutfile})
|
||||
set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOMOC OFF)
|
||||
set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOUIC OFF)
|
||||
add_dependencies(rcc_object_${outfilename} big_resources_${outfilename})
|
||||
add_custom_command(OUTPUT ${outfile}
|
||||
COMMAND ${Qt5Core_RCC_EXECUTABLE}
|
||||
|
@ -152,6 +152,7 @@
|
||||
#include <QtCore/qthreadstorage.h>
|
||||
#include <QtCore/qcoreevent.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtCore/qscopedvaluerollback.h>
|
||||
|
||||
#define DEFAULT_TIMER_INTERVAL 16
|
||||
#define PAUSE_TIMER_COARSE_THRESHOLD 2000
|
||||
@ -315,14 +316,13 @@ void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
|
||||
//* it might happen in some cases that the delta is negative because the animation driver
|
||||
// advances faster than time.elapsed()
|
||||
if (delta > 0) {
|
||||
insideTick = true;
|
||||
QScopedValueRollback<bool> guard(insideTick, true);
|
||||
if (profilerCallback)
|
||||
profilerCallback(delta);
|
||||
for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) {
|
||||
QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx);
|
||||
animation->updateAnimationsTime(delta);
|
||||
}
|
||||
insideTick = false;
|
||||
currentAnimationIdx = 0;
|
||||
}
|
||||
}
|
||||
@ -361,10 +361,11 @@ void QUnifiedTimer::localRestart()
|
||||
|
||||
void QUnifiedTimer::restart()
|
||||
{
|
||||
insideRestart = true;
|
||||
for (int i = 0; i < animationTimers.count(); ++i)
|
||||
animationTimers.at(i)->restartAnimationTimer();
|
||||
insideRestart = false;
|
||||
{
|
||||
QScopedValueRollback<bool> guard(insideRestart, true);
|
||||
for (int i = 0; i < animationTimers.count(); ++i)
|
||||
animationTimers.at(i)->restartAnimationTimer();
|
||||
}
|
||||
|
||||
localRestart();
|
||||
}
|
||||
@ -599,14 +600,13 @@ void QAnimationTimer::updateAnimationsTime(qint64 delta)
|
||||
//it might happen in some cases that the time doesn't change because events are delayed
|
||||
//when the CPU load is high
|
||||
if (delta) {
|
||||
insideTick = true;
|
||||
QScopedValueRollback<bool> guard(insideTick, true);
|
||||
for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
|
||||
QAbstractAnimation *animation = animations.at(currentAnimationIdx);
|
||||
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
|
||||
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
|
||||
animation->setCurrentTime(elapsed);
|
||||
}
|
||||
insideTick = false;
|
||||
currentAnimationIdx = 0;
|
||||
}
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ QAbstractAnimation::State QAbstractAnimation::state() const
|
||||
|
||||
/*!
|
||||
If this animation is part of a QAnimationGroup, this function returns a
|
||||
pointer to the group; otherwise, it returns 0.
|
||||
pointer to the group; otherwise, it returns \nullptr.
|
||||
|
||||
\sa QAnimationGroup::addAnimation()
|
||||
*/
|
||||
|
@ -1061,7 +1061,7 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
|
||||
}
|
||||
|
||||
// in qstring.cpp:
|
||||
void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW;
|
||||
void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept;
|
||||
|
||||
/*! \overload
|
||||
|
||||
@ -1242,7 +1242,7 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba)
|
||||
\obsolete
|
||||
|
||||
Returns the codec used by QObject::tr() on its argument. If this
|
||||
function returns 0 (the default), tr() assumes Latin-1.
|
||||
function returns \nullptr (the default), tr() assumes Latin-1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -54,7 +54,7 @@ static const uchar utf8bom[] = { 0xef, 0xbb, 0xbf };
|
||||
|
||||
#if (defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)) \
|
||||
|| (defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64))
|
||||
static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) Q_DECL_NOTHROW
|
||||
static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) noexcept
|
||||
{
|
||||
uint result = qCountLeadingZeroBits(v);
|
||||
// Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
|
||||
@ -504,7 +504,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len)
|
||||
This function never throws.
|
||||
*/
|
||||
|
||||
QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) Q_DECL_NOTHROW
|
||||
QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) noexcept
|
||||
{
|
||||
ushort *dst = reinterpret_cast<ushort *>(buffer);
|
||||
const uchar *src = reinterpret_cast<const uchar *>(chars);
|
||||
|
@ -291,7 +291,7 @@ enum DataEndianness
|
||||
|
||||
struct QUtf8
|
||||
{
|
||||
static QChar *convertToUnicode(QChar *, const char *, int) Q_DECL_NOTHROW;
|
||||
static QChar *convertToUnicode(QChar *, const char *, int) noexcept;
|
||||
static QString convertToUnicode(const char *, int);
|
||||
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *);
|
||||
static QByteArray convertFromUnicode(const QChar *, int);
|
||||
|
@ -11,6 +11,7 @@
|
||||
"icu": "boolean",
|
||||
"inotify": "boolean",
|
||||
"journald": "boolean",
|
||||
"mimetype-database": "boolean",
|
||||
"pcre": { "type": "enum", "values": [ "no", "qt", "system" ] },
|
||||
"posix-ipc": { "type": "boolean", "name": "ipc_posix" },
|
||||
"pps": { "type": "boolean", "name": "qqnx_pps" },
|
||||
@ -374,6 +375,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"glibc": {
|
||||
"label": "GNU libc",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "stdlib.h",
|
||||
"main": [
|
||||
"return __GLIBC__;"
|
||||
]
|
||||
}
|
||||
},
|
||||
"inotify": {
|
||||
"label": "inotify",
|
||||
"type": "compile",
|
||||
@ -593,6 +604,12 @@
|
||||
"condition": "libs.glib",
|
||||
"output": [ "privateFeature", "feature" ]
|
||||
},
|
||||
"glibc": {
|
||||
"label": "GNU libc",
|
||||
"autoDetect": "config.linux",
|
||||
"condition": "tests.glibc",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"iconv": {
|
||||
"label": "iconv",
|
||||
"purpose": "Provides internationalization on Unix.",
|
||||
@ -662,6 +679,11 @@
|
||||
"condition": "features.textcodec",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"mimetype-database": {
|
||||
"label": "Built-in copy of the MIME database",
|
||||
"condition": "features.mimetype",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"pcre2": {
|
||||
"label": "PCRE2",
|
||||
"disable": "input.pcre == 'no' || input.pcre == 'system'",
|
||||
@ -1036,6 +1058,7 @@ Please apply the patch corresponding to your Standard Library vendor, found in
|
||||
"glib",
|
||||
"iconv",
|
||||
"icu",
|
||||
"mimetype-database",
|
||||
{
|
||||
"message": "Tracing backend",
|
||||
"type": "firstAvailableFeature",
|
||||
|
@ -773,16 +773,16 @@ bool readConfiguration(const QFile &file)
|
||||
|
||||
//! [qdecloverride]
|
||||
// generate error if this doesn't actually override anything:
|
||||
virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
|
||||
virtual void MyWidget::paintEvent(QPaintEvent*) override;
|
||||
//! [qdecloverride]
|
||||
|
||||
//! [qdeclfinal-1]
|
||||
// more-derived classes no longer permitted to override this:
|
||||
virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_FINAL;
|
||||
virtual void MyWidget::paintEvent(QPaintEvent*) final;
|
||||
//! [qdeclfinal-1]
|
||||
|
||||
//! [qdeclfinal-2]
|
||||
class QRect Q_DECL_FINAL { // cannot be derived from
|
||||
class QRect final { // cannot be derived from
|
||||
// ...
|
||||
};
|
||||
//! [qdeclfinal-2]
|
||||
|
@ -28,357 +28,71 @@
|
||||
/*!
|
||||
\page datastreamformat.html
|
||||
\title Serializing Qt Data Types
|
||||
\brief Representations of data types that can be serialized by QDataStream.
|
||||
\brief List of data types that can be serialized by QDataStream.
|
||||
|
||||
The \l QDataStream allows you to serialize some of the Qt data types.
|
||||
The table below lists the data types that QDataStream can serialize
|
||||
and how they are represented. The format described below is
|
||||
\l{QDataStream::setVersion()}{version 13}.
|
||||
The \l QDataStream class allows you to serialize the Qt data types
|
||||
listed in this section as of \l{QDataStream::setVersion()}{version 18}.
|
||||
|
||||
It is always best to cast integers to a Qt integer type, such as
|
||||
qint16 or quint32, when reading and writing. This ensures that
|
||||
\l{qint16} or \l{quint32}, when reading and writing. This ensures that
|
||||
you always know exactly what size integers you are reading and
|
||||
writing, no matter what the underlying platform and architecture
|
||||
the application happens to be running on.
|
||||
|
||||
\table
|
||||
\row \li bool
|
||||
\li \list
|
||||
\li boolean
|
||||
\endlist
|
||||
\row \li qint8
|
||||
\li \list
|
||||
\li signed byte
|
||||
\endlist
|
||||
\row \li qint16
|
||||
\li \list
|
||||
\li signed 16-bit integer
|
||||
\endlist
|
||||
\row \li qint32
|
||||
\li \list
|
||||
\li signed 32-bit integer
|
||||
\endlist
|
||||
\row \li qint64
|
||||
\li \list
|
||||
\li signed 64-bit integer
|
||||
\endlist
|
||||
\row \li quint8
|
||||
\li \list
|
||||
\li unsigned byte
|
||||
\endlist
|
||||
\row \li quint16
|
||||
\li \list
|
||||
\li unsigned 16-bit integer
|
||||
\endlist
|
||||
\row \li quint32
|
||||
\li \list
|
||||
\li unsigned 32-bit integer
|
||||
\endlist
|
||||
\row \li quint64
|
||||
\li \list
|
||||
\li unsigned 64-bit integer
|
||||
\endlist
|
||||
\row \li \c float
|
||||
\li \list
|
||||
\li 32-bit floating point number using the standard IEEE 754 format
|
||||
\endlist
|
||||
\row \li \c double
|
||||
\li \list
|
||||
\li 64-bit floating point number using the standard IEEE 754 format
|
||||
\endlist
|
||||
\row \li \c {const char *}
|
||||
\li \list
|
||||
\li The string length (quint32)
|
||||
\li The string bytes, excluding the terminating 0
|
||||
\endlist
|
||||
\row \li QBitArray
|
||||
\li \list
|
||||
\li The array size (quint32)
|
||||
\li The array bits, i.e. (size + 7)/8 bytes
|
||||
\endlist
|
||||
\row \li QBrush
|
||||
\li \list
|
||||
\li The brush style (quint8)
|
||||
\li The brush color (QColor)
|
||||
\li If style is CustomPattern, the brush pixmap (QPixmap)
|
||||
\endlist
|
||||
\row \li QByteArray
|
||||
\li \list
|
||||
\li If the byte array is null: 0xFFFFFFFF (quint32)
|
||||
\li Otherwise: the array size (quint32) followed by the array bytes, i.e. size bytes
|
||||
\endlist
|
||||
\row \li \l QColor
|
||||
\li \list
|
||||
\li Color spec (qint8)
|
||||
\li Alpha value (quint16)
|
||||
\li Red value (quint16)
|
||||
\li Green value (quint16)
|
||||
\li Blue value (quint16)
|
||||
\li Pad value (quint16)
|
||||
\endlist
|
||||
\row \li QCursor
|
||||
\li \list
|
||||
\li Shape ID (qint16)
|
||||
\li If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap), and hot spot (QPoint)
|
||||
\endlist
|
||||
\row \li QDate
|
||||
\li \list
|
||||
\li Julian day (quint32)
|
||||
\endlist
|
||||
\row \li QDateTime
|
||||
\li \list
|
||||
\li Date (QDate)
|
||||
\li Time (QTime)
|
||||
\li The \l{Qt::TimeSpec}{time spec}
|
||||
offsetFromUtc (qint32) if Qt::TimeSpec is offsetFromUtc
|
||||
TimeZone(QTimeZone) if Qt::TimeSpec is TimeZone
|
||||
\endlist
|
||||
\row \li QEasingCurve
|
||||
\li \list
|
||||
\li type (quint8)
|
||||
\li func (quint64)
|
||||
\li hasConfig (bool)
|
||||
\li If hasConfig is true then these fields follow:
|
||||
\li list
|
||||
\li period (double)
|
||||
\li amplitude (double)
|
||||
\li overshoot (double)
|
||||
\endlist
|
||||
\row \li QFont
|
||||
\li \list
|
||||
\li The family (QString)
|
||||
\li The style name (QString)
|
||||
\li The point size (double)
|
||||
\li The pixel size (qint32)
|
||||
\li The style hint (quint8)
|
||||
\li The style strategy (quint16)
|
||||
\li The char set (quint8)
|
||||
\li The weight (quint8)
|
||||
\li The font bits (quint8)
|
||||
\li The font stretch (quint16)
|
||||
\li The extended font bits (quint8)
|
||||
\li The letter spacing (double)
|
||||
\li The word spacing (double)
|
||||
\li The hinting preference (quint8)
|
||||
\endlist
|
||||
\row \li QHash<Key, T>
|
||||
\li \list
|
||||
\li The number of items (quint32)
|
||||
\li For all items, the key (Key) and value (T)
|
||||
\endlist
|
||||
\row \li QIcon
|
||||
\li \list
|
||||
\li The number of pixmap entries (quint32)
|
||||
\li For all pixmap entries:
|
||||
\list
|
||||
\li The pixmap (QPixmap)
|
||||
\li The file name (QString)
|
||||
\li The pixmap size (QSize)
|
||||
\li The \l{QIcon::Mode}{mode} (quint32)
|
||||
\li The \l{QIcon::State}{state} (quint32)
|
||||
\endlist
|
||||
\endlist
|
||||
\row \li QImage
|
||||
\li \list
|
||||
\li If the image is null a "null image" marker is saved;
|
||||
otherwise the image is saved in PNG or BMP format (depending
|
||||
on the stream version). If you want control of the format,
|
||||
stream the image into a QBuffer (using QImageIOHandler/QImageIOPlugin) and stream
|
||||
that.
|
||||
\endlist
|
||||
\row \li QKeySequence
|
||||
\li \list
|
||||
\li A QList<int>, where each integer is a key in the key sequence
|
||||
\endlist
|
||||
\row \li QLinkedList<T>
|
||||
\li \list
|
||||
\li The number of items (quint32)
|
||||
\li The items (T)
|
||||
\endlist
|
||||
\row \li QList<T>
|
||||
\li \list
|
||||
\li The number of items (quint32)
|
||||
\li The items (T)
|
||||
\endlist
|
||||
\row \li QMap<Key, T>
|
||||
\li \list
|
||||
\li The number of items (quint32)
|
||||
\li For all items, the key (Key) and value (T)
|
||||
\endlist
|
||||
\row \li QMargins
|
||||
\li \list
|
||||
\li left (int)
|
||||
\li top (int)
|
||||
\li right (int)
|
||||
\li bottom (int)
|
||||
\endlist
|
||||
\row \li QMatrix
|
||||
\li \list
|
||||
\li m11 (double)
|
||||
\li m12 (double)
|
||||
\li m21 (double)
|
||||
\li m22 (double)
|
||||
\li dx (double)
|
||||
\li dy (double)
|
||||
\endlist
|
||||
\row \li QMatrix4x4
|
||||
\li \list
|
||||
\li m11 (float)
|
||||
\li m12 (float)
|
||||
\li m13 (float)
|
||||
\li m14 (float)
|
||||
\li m21 (float)
|
||||
\li m22 (float)
|
||||
\li m23 (float)
|
||||
\li m24 (float)
|
||||
\li m31 (float)
|
||||
\li m32 (float)
|
||||
\li m33 (float)
|
||||
\li m34 (float)
|
||||
\li m41 (float)
|
||||
\li m42 (float)
|
||||
\li m43 (float)
|
||||
\li m44 (float)
|
||||
\endlist
|
||||
\row \li QPair<T1, T2>
|
||||
\li \list
|
||||
\li first (T1)
|
||||
\li second (T2)
|
||||
\endlist
|
||||
\row \li QPalette
|
||||
\li The disabled, active, and inactive color groups, each of which consists
|
||||
of the following:
|
||||
\list
|
||||
\li foreground (QBrush)
|
||||
\li button (QBrush)
|
||||
\li light (QBrush)
|
||||
\li midlight (QBrush)
|
||||
\li dark (QBrush)
|
||||
\li mid (QBrush)
|
||||
\li text (QBrush)
|
||||
\li brightText (QBrush)
|
||||
\li buttonText (QBrush)
|
||||
\li base (QBrush)
|
||||
\li background (QBrush)
|
||||
\li shadow (QBrush)
|
||||
\li highlight (QBrush)
|
||||
\li highlightedText (QBrush)
|
||||
\li link (QBrush)
|
||||
\li linkVisited (QBrush)
|
||||
\endlist
|
||||
\row \li QPen
|
||||
\li \list
|
||||
\li The pen styles (quint8)
|
||||
\li The pen width (quint16)
|
||||
\li The pen color (QColor)
|
||||
\endlist
|
||||
\row \li QPicture
|
||||
\li \list
|
||||
\li The size of the picture data (quint32)
|
||||
\li The raw bytes of picture data (char)
|
||||
\endlist
|
||||
\row \li QPixmap
|
||||
\li \list
|
||||
\li Save it as a PNG image.
|
||||
\endlist
|
||||
\row \li QPoint
|
||||
\li \list
|
||||
\li The x coordinate (qint32)
|
||||
\li The y coordinate (qint32)
|
||||
\endlist
|
||||
\row \li QQuaternion
|
||||
\li \list
|
||||
\li The scalar component (float)
|
||||
\li The x coordinate (float)
|
||||
\li The y coordinate (float)
|
||||
\li The z coordinate (float)
|
||||
\endlist
|
||||
\row \li QRect
|
||||
\li \list
|
||||
\li left (qint32)
|
||||
\li top (qint32)
|
||||
\li right (qint32)
|
||||
\li bottom (qint32)
|
||||
\endlist
|
||||
\row \li QRegExp
|
||||
\li \list
|
||||
\li The regexp pattern (QString)
|
||||
\li Case sensitivity (quint8)
|
||||
\li Regular expression syntax (quint8)
|
||||
\li Minimal matching (quint8)
|
||||
\endlist
|
||||
\row \li QRegularExpression
|
||||
\li \list
|
||||
\li The regular expression pattern (QString)
|
||||
\li The pattern options (quint32)
|
||||
\endlist
|
||||
\row \li QRegion
|
||||
\li \list
|
||||
\li The size of the data, i.e. 8 + 16 * (number of rectangles) (quint32)
|
||||
\li 10 (qint32)
|
||||
\li The number of rectangles (quint32)
|
||||
\li The rectangles in sequential order (QRect)
|
||||
\endlist
|
||||
\row \li QSize
|
||||
\li \list
|
||||
\li width (qint32)
|
||||
\li height (qint32)
|
||||
\endlist
|
||||
\row \li QString
|
||||
\li \list
|
||||
\li If the string is null: 0xFFFFFFFF (quint32)
|
||||
\li Otherwise: The string length in bytes (quint32) followed by the data in UTF-16
|
||||
\endlist
|
||||
\row \li QTime
|
||||
\li \list
|
||||
\li Milliseconds since midnight (quint32)
|
||||
\endlist
|
||||
\row \li QTransform
|
||||
\li \list
|
||||
\li m11 (double)
|
||||
\li m12 (double)
|
||||
\li m13 (double)
|
||||
\li m21 (double)
|
||||
\li m22 (double)
|
||||
\li m23 (double)
|
||||
\li m31 (double)
|
||||
\li m32 (double)
|
||||
\li m33 (double)
|
||||
\endlist
|
||||
\row \li QUrl
|
||||
\li \list
|
||||
\li Holds an URL (QString)
|
||||
\endlist
|
||||
\row \li QVariant
|
||||
\li \list
|
||||
\li The type of the data (quint32)
|
||||
\li The null flag (qint8)
|
||||
\li The data of the specified type
|
||||
\endlist
|
||||
\row \li QVector2D
|
||||
\li \list
|
||||
\li the x coordinate (float)
|
||||
\li the y coordinate (float)
|
||||
\endlist
|
||||
\row \li QVector3D
|
||||
\li \list
|
||||
\li the x coordinate (float)
|
||||
\li the y coordinate (float)
|
||||
\li the z coordinate (float)
|
||||
\endlist
|
||||
\row \li QVector4D
|
||||
\li \list
|
||||
\li the x coordinate (float)
|
||||
\li the y coordinate (float)
|
||||
\li the z coordinate (float)
|
||||
\li the w coordinate (float)
|
||||
\endlist
|
||||
\row \li QVector<T>
|
||||
\li \list
|
||||
\li The number of items (quint32)
|
||||
\li The items (T)
|
||||
\endlist
|
||||
\endtable
|
||||
\list
|
||||
\li bool
|
||||
\li \l{qint8}
|
||||
\li \l{qint16}
|
||||
\li \l{qint32}
|
||||
\li \l{qint64}
|
||||
\li \l{quint8}
|
||||
\li \l{quint16}
|
||||
\li \l{quint32}
|
||||
\li \l{quint64}
|
||||
\li \c float
|
||||
\li \c double
|
||||
\li \c {const char *}
|
||||
\li QBitArray
|
||||
\li QBrush
|
||||
\li QByteArray
|
||||
\li QColor
|
||||
\li QCursor
|
||||
\li QDate
|
||||
\li QDateTime
|
||||
\li QEasingCurve
|
||||
\li QFont
|
||||
\li QGenericMatrix
|
||||
\li QHash<Key, T>
|
||||
\li QIcon
|
||||
\li QImage
|
||||
\li QKeySequence
|
||||
\li QLinkedList<T>
|
||||
\li QList<T>
|
||||
\li QMap<Key, T>
|
||||
\li QMargins
|
||||
\li QMatrix4x4
|
||||
\li QPair<T1, T2>
|
||||
\li QPalette
|
||||
\li QPen
|
||||
\li QPicture
|
||||
\li QPixmap
|
||||
\li QPoint
|
||||
\li QQuaternion
|
||||
\li QRect
|
||||
\li QRegExp
|
||||
\li QRegularExpression
|
||||
\li QRegion
|
||||
\li QSize
|
||||
\li QString
|
||||
\li QTime
|
||||
\li QTransform
|
||||
\li QUrl
|
||||
\li QVariant
|
||||
\li QVector2D
|
||||
\li QVector3D
|
||||
\li QVector4D
|
||||
\li QVector<T>
|
||||
\endlist
|
||||
|
||||
\sa {JSON Support in Qt}
|
||||
*/
|
||||
|
@ -12,7 +12,6 @@ HEADERS += \
|
||||
global/qendian_p.h \
|
||||
global/qnumeric_p.h \
|
||||
global/qnumeric.h \
|
||||
global/qfloat16_p.h \
|
||||
global/qfloat16.h \
|
||||
global/qglobalstatic.h \
|
||||
global/qlibraryinfo.h \
|
||||
|
@ -78,7 +78,11 @@ QT_BEGIN_NAMESPACE
|
||||
* - statx 4.11 QT_CONFIG(statx)
|
||||
*/
|
||||
|
||||
#if QT_CONFIG(statx)
|
||||
#if QT_CONFIG(statx) && !QT_CONFIG(glibc)
|
||||
// if using glibc, the statx() function in sysdeps/unix/sysv/linux/statx.c
|
||||
// falls back to stat() for us.
|
||||
// (Using QT_CONFIG(glibc) instead of __GLIBC__ because the macros aren't
|
||||
// defined in assembler mode)
|
||||
# define MINLINUX_MAJOR 4
|
||||
# define MINLINUX_MINOR 11
|
||||
# define MINLINUX_PATCH 0
|
||||
|
@ -110,12 +110,6 @@
|
||||
# define Q_CC_INTEL __INTEL_COMPILER
|
||||
# endif
|
||||
|
||||
/* only defined for MSVC since that's the only compiler that actually optimizes for this */
|
||||
/* might get overridden further down when Q_COMPILER_NOEXCEPT is detected */
|
||||
# ifdef __cplusplus
|
||||
# define Q_DECL_NOTHROW throw()
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) || defined(__TURBOC__)
|
||||
# define Q_CC_BOR
|
||||
# define Q_INLINE_TEMPLATE
|
||||
@ -1128,16 +1122,11 @@
|
||||
#ifdef Q_COMPILER_NOEXCEPT
|
||||
# define Q_DECL_NOEXCEPT noexcept
|
||||
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
|
||||
# ifdef Q_DECL_NOTHROW
|
||||
# undef Q_DECL_NOTHROW /* override with C++11 noexcept if available */
|
||||
# endif
|
||||
#else
|
||||
# define Q_DECL_NOEXCEPT
|
||||
# define Q_DECL_NOEXCEPT_EXPR(x)
|
||||
#endif
|
||||
#ifndef Q_DECL_NOTHROW
|
||||
# define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
|
||||
#endif
|
||||
#define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
|
||||
|
||||
#if defined(Q_COMPILER_ALIGNOF)
|
||||
# undef Q_ALIGNOF
|
||||
|
@ -54,21 +54,21 @@ class QFlag
|
||||
{
|
||||
int i;
|
||||
public:
|
||||
Q_DECL_CONSTEXPR inline QFlag(int value) Q_DECL_NOTHROW : i(value) {}
|
||||
Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; }
|
||||
Q_DECL_CONSTEXPR inline QFlag(int value) noexcept : i(value) {}
|
||||
Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
|
||||
|
||||
#if !defined(Q_CC_MSVC)
|
||||
// Microsoft Visual Studio has buggy behavior when it comes to
|
||||
// unsigned enums: even if the enum is unsigned, the enum tags are
|
||||
// always signed
|
||||
# if !defined(__LP64__) && !defined(Q_CLANG_QDOC)
|
||||
Q_DECL_CONSTEXPR inline QFlag(long value) Q_DECL_NOTHROW : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(ulong value) Q_DECL_NOTHROW : i(int(long(value))) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(long value) noexcept : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(ulong value) noexcept : i(int(long(value))) {}
|
||||
# endif
|
||||
Q_DECL_CONSTEXPR inline QFlag(uint value) Q_DECL_NOTHROW : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(short value) Q_DECL_NOTHROW : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(ushort value) Q_DECL_NOTHROW : i(int(uint(value))) {}
|
||||
Q_DECL_CONSTEXPR inline operator uint() const Q_DECL_NOTHROW { return uint(i); }
|
||||
Q_DECL_CONSTEXPR inline QFlag(uint value) noexcept : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(short value) noexcept : i(int(value)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlag(ushort value) noexcept : i(int(uint(value))) {}
|
||||
Q_DECL_CONSTEXPR inline operator uint() const noexcept { return uint(i); }
|
||||
#endif
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
|
||||
@ -77,12 +77,12 @@ class QIncompatibleFlag
|
||||
{
|
||||
int i;
|
||||
public:
|
||||
Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) Q_DECL_NOTHROW;
|
||||
Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; }
|
||||
Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) noexcept;
|
||||
Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE);
|
||||
|
||||
Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) Q_DECL_NOTHROW : i(value) {}
|
||||
Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {}
|
||||
|
||||
|
||||
#ifndef Q_NO_TYPESAFE_FLAGS
|
||||
@ -117,38 +117,38 @@ public:
|
||||
Q_DECL_CONSTEXPR inline QFlags(const QFlags &other);
|
||||
Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other);
|
||||
#endif
|
||||
Q_DECL_CONSTEXPR inline QFlags(Enum flags) Q_DECL_NOTHROW : i(Int(flags)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(QFlag flag) Q_DECL_NOTHROW : i(flag) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) noexcept : i(0) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) noexcept
|
||||
: i(initializer_list_helper(flags.begin(), flags.end())) {}
|
||||
#endif
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) Q_DECL_NOTHROW { i &= mask; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) Q_DECL_NOTHROW { i &= mask; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) Q_DECL_NOTHROW { i &= Int(mask); return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) Q_DECL_NOTHROW { i |= other.i; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) Q_DECL_NOTHROW { i |= Int(other); return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) Q_DECL_NOTHROW { i ^= other.i; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) Q_DECL_NOTHROW { i ^= Int(other); return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; }
|
||||
|
||||
Q_DECL_CONSTEXPR inline operator Int() const Q_DECL_NOTHROW { return i; }
|
||||
Q_DECL_CONSTEXPR inline operator Int() const noexcept { return i; }
|
||||
|
||||
Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | other.i)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ other.i)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i & Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator~() const Q_DECL_NOTHROW { return QFlags(QFlag(~i)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); }
|
||||
Q_DECL_CONSTEXPR inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); }
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator!() const Q_DECL_NOTHROW { return !i; }
|
||||
Q_DECL_CONSTEXPR inline bool operator!() const noexcept { return !i; }
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const Q_DECL_NOTHROW { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) noexcept
|
||||
{
|
||||
return on ? (*this |= flag) : (*this &= ~Int(flag));
|
||||
}
|
||||
@ -157,7 +157,7 @@ private:
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
|
||||
typename std::initializer_list<Enum>::const_iterator end)
|
||||
Q_DECL_NOTHROW
|
||||
noexcept
|
||||
{
|
||||
return (it == end ? Int(0) : (Int(*it) | initializer_list_helper(it + 1, end)));
|
||||
}
|
||||
@ -172,13 +172,13 @@ typedef QFlags<Enum> Flags;
|
||||
#endif
|
||||
|
||||
#define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
|
||||
Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW \
|
||||
Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
|
||||
{ return QIncompatibleFlag(int(f1) | f2); }
|
||||
|
||||
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
|
||||
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) Q_DECL_NOTHROW \
|
||||
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
|
||||
{ return QFlags<Flags::enum_type>(f1) | f2; } \
|
||||
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW \
|
||||
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
|
||||
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qfloat16_p.h"
|
||||
#include "qfloat16.h"
|
||||
#include "private/qsimd_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -65,28 +65,31 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns true if the \c qfloat16 \a {f} is equivalent to infinity.
|
||||
\fn bool qIsInf(qfloat16 f)
|
||||
\relates <QFloat16>
|
||||
|
||||
Returns true if the \c qfloat16 \a {f} is equivalent to infinity.
|
||||
|
||||
\sa qIsInf
|
||||
*/
|
||||
Q_REQUIRED_RESULT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW { return qt_is_inf(f); }
|
||||
|
||||
/*!
|
||||
Returns true if the \c qfloat16 \a {f} is not a number (NaN).
|
||||
\fn bool qIsNaN(qfloat16 f)
|
||||
\relates <QFloat16>
|
||||
|
||||
Returns true if the \c qfloat16 \a {f} is not a number (NaN).
|
||||
|
||||
\sa qIsNaN
|
||||
*/
|
||||
Q_REQUIRED_RESULT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW { return qt_is_nan(f); }
|
||||
|
||||
/*!
|
||||
Returns true if the \c qfloat16 \a {f} is a finite number.
|
||||
\fn bool qIsFinite(qfloat16 f)
|
||||
\relates <QFloat16>
|
||||
|
||||
Returns true if the \c qfloat16 \a {f} is a finite number.
|
||||
|
||||
\sa qIsFinite
|
||||
*/
|
||||
Q_REQUIRED_RESULT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW { return qt_is_finite(f); }
|
||||
|
||||
/*! \fn int qRound(qfloat16 value)
|
||||
\relates <QFloat16>
|
||||
@ -129,8 +132,8 @@ extern "C" {
|
||||
# define f16cextern extern
|
||||
#endif
|
||||
|
||||
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW;
|
||||
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW;
|
||||
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept;
|
||||
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept;
|
||||
|
||||
#undef f16cextern
|
||||
}
|
||||
@ -141,7 +144,7 @@ static inline bool hasFastF16()
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
|
||||
static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept
|
||||
{
|
||||
__fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
|
||||
qsizetype i = 0;
|
||||
@ -151,7 +154,7 @@ static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q
|
||||
out_f16[i] = __fp16(in[i]);
|
||||
}
|
||||
|
||||
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
|
||||
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept
|
||||
{
|
||||
const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in);
|
||||
qsizetype i = 0;
|
||||
@ -166,12 +169,12 @@ static inline bool hasFastF16()
|
||||
return false;
|
||||
}
|
||||
|
||||
static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW
|
||||
static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) noexcept
|
||||
{
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW
|
||||
static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) noexcept
|
||||
{
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
@ -183,7 +186,7 @@ static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_N
|
||||
Converts \a len floats from \a in to qfloat16 and stores them in \a out.
|
||||
Both \a in and \a out must have \a len allocated entries.
|
||||
*/
|
||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
|
||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) noexcept
|
||||
{
|
||||
if (hasFastF16())
|
||||
return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len);
|
||||
@ -199,7 +202,7 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len
|
||||
Converts \a len qfloat16 from \a in to floats and stores them in \a out.
|
||||
Both \a in and \a out must have \a len allocated entries.
|
||||
*/
|
||||
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW
|
||||
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) noexcept
|
||||
{
|
||||
if (hasFastF16())
|
||||
return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len);
|
||||
|
@ -67,10 +67,14 @@ QT_BEGIN_NAMESPACE
|
||||
class qfloat16
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR inline qfloat16() Q_DECL_NOTHROW : b16(0) { }
|
||||
inline qfloat16(float f) Q_DECL_NOTHROW;
|
||||
inline operator float() const Q_DECL_NOTHROW;
|
||||
constexpr inline qfloat16() noexcept : b16(0) {}
|
||||
inline qfloat16(float f) noexcept;
|
||||
inline operator float() const noexcept;
|
||||
|
||||
// Support for qIs{Inf,NaN,Finite}:
|
||||
bool isInf() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7c; }
|
||||
bool isNaN() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7e; }
|
||||
bool isFinite() const noexcept { return ((b16 >> 8) & 0x7c) != 0x7c; }
|
||||
private:
|
||||
quint16 b16;
|
||||
|
||||
@ -80,27 +84,29 @@ private:
|
||||
Q_CORE_EXPORT static const quint32 basetable[];
|
||||
Q_CORE_EXPORT static const quint32 shifttable[];
|
||||
|
||||
friend bool qIsNull(qfloat16 f) Q_DECL_NOTHROW;
|
||||
friend qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW;
|
||||
friend bool qIsNull(qfloat16 f) noexcept;
|
||||
friend qfloat16 operator-(qfloat16 a) noexcept;
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
|
||||
|
||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) noexcept;
|
||||
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept;
|
||||
|
||||
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
||||
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
||||
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
||||
// Complement qnumeric.h:
|
||||
Q_REQUIRED_RESULT inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); }
|
||||
Q_REQUIRED_RESULT inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); }
|
||||
Q_REQUIRED_RESULT inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); }
|
||||
// Q_REQUIRED_RESULT quint32 qFloatDistance(qfloat16 a, qfloat16 b);
|
||||
|
||||
// The remainder of these utility functions complement qglobal.h
|
||||
Q_REQUIRED_RESULT inline int qRound(qfloat16 d) Q_DECL_NOTHROW
|
||||
Q_REQUIRED_RESULT inline int qRound(qfloat16 d) noexcept
|
||||
{ return qRound(static_cast<float>(d)); }
|
||||
|
||||
Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
|
||||
Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) noexcept
|
||||
{ return qRound64(static_cast<float>(d)); }
|
||||
|
||||
Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
|
||||
Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
|
||||
{
|
||||
float f1 = static_cast<float>(p1);
|
||||
float f2 = static_cast<float>(p2);
|
||||
@ -113,19 +119,19 @@ Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOT
|
||||
return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
|
||||
}
|
||||
|
||||
Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
|
||||
Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) noexcept
|
||||
{
|
||||
return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
|
||||
}
|
||||
|
||||
inline int qIntCast(qfloat16 f) Q_DECL_NOTHROW
|
||||
inline int qIntCast(qfloat16 f) noexcept
|
||||
{ return int(static_cast<float>(f)); }
|
||||
|
||||
#ifndef Q_QDOC
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
|
||||
QT_WARNING_DISABLE_GCC("-Wold-style-cast")
|
||||
inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
|
||||
inline qfloat16::qfloat16(float f) noexcept
|
||||
{
|
||||
#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
|
||||
__m128 packsingle = _mm_set_ss(f);
|
||||
@ -143,7 +149,7 @@ inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
|
||||
}
|
||||
QT_WARNING_POP
|
||||
|
||||
inline qfloat16::operator float() const Q_DECL_NOTHROW
|
||||
inline qfloat16::operator float() const noexcept
|
||||
{
|
||||
#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
|
||||
__m128i packhalf = _mm_cvtsi32_si128(b16);
|
||||
@ -163,23 +169,23 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW
|
||||
}
|
||||
#endif
|
||||
|
||||
inline qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW
|
||||
inline qfloat16 operator-(qfloat16 a) noexcept
|
||||
{
|
||||
qfloat16 f;
|
||||
f.b16 = a.b16 ^ quint16(0x8000);
|
||||
return f;
|
||||
}
|
||||
|
||||
inline qfloat16 operator+(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); }
|
||||
inline qfloat16 operator-(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); }
|
||||
inline qfloat16 operator*(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); }
|
||||
inline qfloat16 operator/(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); }
|
||||
inline qfloat16 operator+(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); }
|
||||
inline qfloat16 operator-(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); }
|
||||
inline qfloat16 operator*(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); }
|
||||
inline qfloat16 operator/(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); }
|
||||
|
||||
#define QF16_MAKE_ARITH_OP_FP(FP, OP) \
|
||||
inline FP operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \
|
||||
inline FP operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); }
|
||||
inline FP operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \
|
||||
inline FP operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); }
|
||||
#define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \
|
||||
inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) Q_DECL_NOTHROW \
|
||||
inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) noexcept \
|
||||
{ lhs = qfloat16(float(static_cast<FP>(lhs) OP rhs)); return lhs; }
|
||||
#define QF16_MAKE_ARITH_OP(FP) \
|
||||
QF16_MAKE_ARITH_OP_FP(FP, +) \
|
||||
@ -197,8 +203,8 @@ QF16_MAKE_ARITH_OP(float)
|
||||
#undef QF16_MAKE_ARITH_OP_FP
|
||||
|
||||
#define QF16_MAKE_ARITH_OP_INT(OP) \
|
||||
inline double operator OP(qfloat16 lhs, int rhs) Q_DECL_NOTHROW { return static_cast<double>(lhs) OP rhs; } \
|
||||
inline double operator OP(int lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<double>(rhs); }
|
||||
inline double operator OP(qfloat16 lhs, int rhs) noexcept { return static_cast<double>(lhs) OP rhs; } \
|
||||
inline double operator OP(int lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<double>(rhs); }
|
||||
QF16_MAKE_ARITH_OP_INT(+)
|
||||
QF16_MAKE_ARITH_OP_INT(-)
|
||||
QF16_MAKE_ARITH_OP_INT(*)
|
||||
@ -209,16 +215,16 @@ QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
|
||||
QT_WARNING_DISABLE_GCC("-Wfloat-equal")
|
||||
|
||||
inline bool operator>(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) > static_cast<float>(b); }
|
||||
inline bool operator<(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) < static_cast<float>(b); }
|
||||
inline bool operator>=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) >= static_cast<float>(b); }
|
||||
inline bool operator<=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) <= static_cast<float>(b); }
|
||||
inline bool operator==(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) == static_cast<float>(b); }
|
||||
inline bool operator!=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) != static_cast<float>(b); }
|
||||
inline bool operator>(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) > static_cast<float>(b); }
|
||||
inline bool operator<(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) < static_cast<float>(b); }
|
||||
inline bool operator>=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) >= static_cast<float>(b); }
|
||||
inline bool operator<=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) <= static_cast<float>(b); }
|
||||
inline bool operator==(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) == static_cast<float>(b); }
|
||||
inline bool operator!=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) != static_cast<float>(b); }
|
||||
|
||||
#define QF16_MAKE_BOOL_OP_FP(FP, OP) \
|
||||
inline bool operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \
|
||||
inline bool operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); }
|
||||
inline bool operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \
|
||||
inline bool operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); }
|
||||
#define QF16_MAKE_BOOL_OP(FP) \
|
||||
QF16_MAKE_BOOL_OP_FP(FP, <) \
|
||||
QF16_MAKE_BOOL_OP_FP(FP, >) \
|
||||
@ -233,8 +239,8 @@ QF16_MAKE_BOOL_OP(float)
|
||||
#undef QF16_MAKE_BOOL_OP_FP
|
||||
|
||||
#define QF16_MAKE_BOOL_OP_INT(OP) \
|
||||
inline bool operator OP(qfloat16 a, int b) Q_DECL_NOTHROW { return static_cast<float>(a) OP b; } \
|
||||
inline bool operator OP(int a, qfloat16 b) Q_DECL_NOTHROW { return a OP static_cast<float>(b); }
|
||||
inline bool operator OP(qfloat16 a, int b) noexcept { return static_cast<float>(a) OP b; } \
|
||||
inline bool operator OP(int a, qfloat16 b) noexcept { return a OP static_cast<float>(b); }
|
||||
QF16_MAKE_BOOL_OP_INT(>)
|
||||
QF16_MAKE_BOOL_OP_INT(<)
|
||||
QF16_MAKE_BOOL_OP_INT(>=)
|
||||
@ -248,7 +254,7 @@ QT_WARNING_POP
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
|
||||
Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) noexcept
|
||||
{
|
||||
return qAbs(static_cast<float>(f)) <= 0.001f;
|
||||
}
|
||||
|
@ -1147,12 +1147,12 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
|
||||
\sa QT_VERSION_STR, QLibraryInfo::version()
|
||||
*/
|
||||
|
||||
const char *qVersion() Q_DECL_NOTHROW
|
||||
const char *qVersion() noexcept
|
||||
{
|
||||
return QT_VERSION_STR;
|
||||
}
|
||||
|
||||
bool qSharedBuild() Q_DECL_NOTHROW
|
||||
bool qSharedBuild() noexcept
|
||||
{
|
||||
#ifdef QT_SHARED
|
||||
return true;
|
||||
@ -3206,7 +3206,7 @@ QByteArray QSysInfo::bootUniqueId()
|
||||
The Q_CHECK_PTR macro calls this function if an allocation check
|
||||
fails.
|
||||
*/
|
||||
void qt_check_pointer(const char *n, int l) Q_DECL_NOTHROW
|
||||
void qt_check_pointer(const char *n, int l) noexcept
|
||||
{
|
||||
// make separate printing calls so that the first one may flush;
|
||||
// the second one could want to allocate memory (fputs prints a
|
||||
@ -3233,7 +3233,7 @@ void qBadAlloc()
|
||||
Allows you to call std::terminate() without including <exception>.
|
||||
Called internally from QT_TERMINATE_ON_EXCEPTION
|
||||
*/
|
||||
Q_NORETURN void qTerminate() Q_DECL_NOTHROW
|
||||
Q_NORETURN void qTerminate() noexcept
|
||||
{
|
||||
std::terminate();
|
||||
}
|
||||
@ -3242,7 +3242,7 @@ Q_NORETURN void qTerminate() Q_DECL_NOTHROW
|
||||
/*
|
||||
The Q_ASSERT macro calls this function when the test fails.
|
||||
*/
|
||||
void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW
|
||||
void qt_assert(const char *assertion, const char *file, int line) noexcept
|
||||
{
|
||||
QMessageLogger(file, line, nullptr).fatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line);
|
||||
}
|
||||
@ -3250,7 +3250,7 @@ void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW
|
||||
/*
|
||||
The Q_ASSERT_X macro calls this function when the test fails.
|
||||
*/
|
||||
void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW
|
||||
void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept
|
||||
{
|
||||
QMessageLogger(file, line, nullptr).fatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);
|
||||
}
|
||||
@ -3457,7 +3457,7 @@ QString qEnvironmentVariable(const char *varName)
|
||||
|
||||
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet()
|
||||
*/
|
||||
bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT
|
||||
bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
|
||||
{
|
||||
QMutexLocker locker(&environmentMutex);
|
||||
#ifdef Q_CC_MSVC
|
||||
@ -3492,7 +3492,7 @@ bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT
|
||||
|
||||
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet()
|
||||
*/
|
||||
int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
|
||||
int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept
|
||||
{
|
||||
static const int NumBinaryDigitsPerOctalDigit = 3;
|
||||
static const int MaxDigitsForOctalInt =
|
||||
@ -3561,7 +3561,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
|
||||
|
||||
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsEmpty()
|
||||
*/
|
||||
bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT
|
||||
bool qEnvironmentVariableIsSet(const char *varName) noexcept
|
||||
{
|
||||
QMutexLocker locker(&environmentMutex);
|
||||
#ifdef Q_CC_MSVC
|
||||
|
@ -411,7 +411,7 @@ typedef double qreal;
|
||||
#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC)
|
||||
extern "C"
|
||||
#endif
|
||||
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@ -730,7 +730,7 @@ inline void qt_noop(void) {}
|
||||
# define QT_CATCH(A) catch (A)
|
||||
# define QT_THROW(A) throw A
|
||||
# define QT_RETHROW throw
|
||||
Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
|
||||
Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept;
|
||||
# ifdef Q_COMPILER_NOEXCEPT
|
||||
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
|
||||
# else
|
||||
@ -738,7 +738,7 @@ Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept;
|
||||
|
||||
#ifndef Q_OUTOFLINE_TEMPLATE
|
||||
# define Q_OUTOFLINE_TEMPLATE
|
||||
@ -781,7 +781,7 @@ Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
|
||||
Q_NORETURN
|
||||
#endif
|
||||
Q_DECL_COLD_FUNCTION
|
||||
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) noexcept;
|
||||
|
||||
#if !defined(Q_ASSERT)
|
||||
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
|
||||
@ -799,7 +799,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line)
|
||||
Q_NORETURN
|
||||
#endif
|
||||
Q_DECL_COLD_FUNCTION
|
||||
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept;
|
||||
|
||||
#if !defined(Q_ASSERT_X)
|
||||
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
|
||||
@ -809,7 +809,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW;
|
||||
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) noexcept;
|
||||
Q_DECL_COLD_FUNCTION
|
||||
Q_CORE_EXPORT void qBadAlloc();
|
||||
|
||||
@ -968,7 +968,7 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
|
||||
|
||||
// this adds const to non-const objects (like std::as_const)
|
||||
template <typename T>
|
||||
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
|
||||
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
|
||||
// prevent rvalue arguments:
|
||||
template <typename T>
|
||||
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
|
||||
@ -1130,11 +1130,11 @@ template <typename... Args>
|
||||
struct QNonConstOverload
|
||||
{
|
||||
template <typename R, typename T>
|
||||
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr)
|
||||
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
|
||||
template <typename R, typename T>
|
||||
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr)
|
||||
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
};
|
||||
|
||||
@ -1142,11 +1142,11 @@ template <typename... Args>
|
||||
struct QConstOverload
|
||||
{
|
||||
template <typename R, typename T>
|
||||
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr)
|
||||
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
|
||||
template <typename R, typename T>
|
||||
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) Q_DECL_NOTHROW -> decltype(ptr)
|
||||
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
};
|
||||
|
||||
@ -1159,11 +1159,11 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
|
||||
using QNonConstOverload<Args...>::operator();
|
||||
|
||||
template <typename R>
|
||||
Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr)
|
||||
Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
|
||||
template <typename R>
|
||||
static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr)
|
||||
static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
|
||||
{ return ptr; }
|
||||
};
|
||||
|
||||
@ -1184,9 +1184,9 @@ Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName, const QString &d
|
||||
Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value);
|
||||
Q_CORE_EXPORT bool qunsetenv(const char *varName);
|
||||
|
||||
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT;
|
||||
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT;
|
||||
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT;
|
||||
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept;
|
||||
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept;
|
||||
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept;
|
||||
|
||||
inline int qIntCast(double f) { return int(f); }
|
||||
inline int qIntCast(float f) { return int(f); }
|
||||
|
@ -79,7 +79,7 @@ enum GuardValues {
|
||||
Q_GLOBAL_STATIC_INTERNAL_DECORATION Type *innerFunction() \
|
||||
{ \
|
||||
struct HolderBase { \
|
||||
~HolderBase() Q_DECL_NOTHROW \
|
||||
~HolderBase() noexcept \
|
||||
{ if (guard.load() == QtGlobalStatic::Initialized) \
|
||||
guard.store(QtGlobalStatic::Destroyed); } \
|
||||
}; \
|
||||
|
@ -350,7 +350,7 @@ QLibraryInfo::buildDate()
|
||||
\since 5.3
|
||||
*/
|
||||
|
||||
const char *QLibraryInfo::build() Q_DECL_NOTHROW
|
||||
const char *QLibraryInfo::build() noexcept
|
||||
{
|
||||
return QT_BUILD_STR;
|
||||
}
|
||||
@ -377,7 +377,7 @@ QLibraryInfo::isDebugBuild()
|
||||
|
||||
\sa qVersion()
|
||||
*/
|
||||
QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW
|
||||
QVersionNumber QLibraryInfo::version() noexcept
|
||||
{
|
||||
return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
|
||||
}
|
||||
|
@ -62,12 +62,12 @@ public:
|
||||
#endif // QT_DEPRECATED_SINCE(5, 5)
|
||||
#endif // datestring
|
||||
|
||||
static const char * build() Q_DECL_NOTHROW;
|
||||
static const char * build() noexcept;
|
||||
|
||||
static bool isDebugBuild();
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
|
||||
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION;
|
||||
#endif
|
||||
|
||||
enum LibraryLocation
|
||||
|
@ -346,7 +346,7 @@ using namespace QtPrivate;
|
||||
*/
|
||||
|
||||
#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
|
||||
static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) Q_DECL_NOEXCEPT
|
||||
static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) noexcept
|
||||
{
|
||||
size_t len = qstrlen(s);
|
||||
if (len + 1 > space) {
|
||||
@ -529,7 +529,7 @@ QDebug QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc) const
|
||||
|
||||
\sa QNoDebug, qDebug()
|
||||
*/
|
||||
QNoDebug QMessageLogger::noDebug() const Q_DECL_NOTHROW
|
||||
QNoDebug QMessageLogger::noDebug() const noexcept
|
||||
{
|
||||
return QNoDebug();
|
||||
}
|
||||
@ -875,7 +875,7 @@ QDebug QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc) const
|
||||
|
||||
\sa qFatal()
|
||||
*/
|
||||
void QMessageLogger::fatal(const char *msg, ...) const Q_DECL_NOTHROW
|
||||
void QMessageLogger::fatal(const char *msg, ...) const noexcept
|
||||
{
|
||||
QString message;
|
||||
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
Q_NORETURN
|
||||
#endif
|
||||
Q_DECL_COLD_FUNCTION
|
||||
void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
|
||||
void fatal(const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug debug() const;
|
||||
@ -137,7 +137,7 @@ public:
|
||||
QDebug critical(const QLoggingCategory &cat) const;
|
||||
QDebug critical(CategoryFunction catFunc) const;
|
||||
|
||||
QNoDebug noDebug() const Q_DECL_NOTHROW;
|
||||
QNoDebug noDebug() const noexcept;
|
||||
#endif // QT_NO_DEBUG_STREAM
|
||||
|
||||
private:
|
||||
|
@ -50,10 +50,10 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#if !defined(Q_QDOC) && !defined(Q_MOC_RUN)
|
||||
struct QMetaObject;
|
||||
const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; // defined in qobject.h (which can't be included here)
|
||||
const QMetaObject *qt_getQtMetaObject() noexcept; // defined in qobject.h (which can't be included here)
|
||||
#define QT_Q_ENUM(ENUM) \
|
||||
inline const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return qt_getQtMetaObject(); } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
|
||||
inline const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return qt_getQtMetaObject(); } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM)
|
||||
#else
|
||||
#define QT_Q_ENUM Q_ENUM
|
||||
|
@ -126,7 +126,7 @@ Q_DECL_CONST_FUNCTION static inline int fpclassify(float f) { return std::fpclas
|
||||
#endif
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEXCEPT
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_infinity,
|
||||
"platform has no definition for infinity for type double");
|
||||
@ -134,7 +134,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEX
|
||||
}
|
||||
|
||||
// Signaling NaN
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOEXCEPT
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_signaling_NaN,
|
||||
"platform has no definition for signaling NaN for type double");
|
||||
@ -142,7 +142,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOE
|
||||
}
|
||||
|
||||
// Quiet NaN
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() Q_DECL_NOEXCEPT
|
||||
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_quiet_NaN,
|
||||
"platform has no definition for quiet NaN for type double");
|
||||
|
@ -91,7 +91,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
|
||||
static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
|
||||
static qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept;
|
||||
|
||||
# ifdef Q_PROCESSOR_X86_64
|
||||
# define _rdrandXX_step _rdrand64_step
|
||||
@ -99,7 +99,7 @@ static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
|
||||
# define _rdrandXX_step _rdrand32_step
|
||||
# endif
|
||||
|
||||
static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW
|
||||
static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept
|
||||
{
|
||||
unsigned *ptr = reinterpret_cast<unsigned *>(buffer);
|
||||
unsigned *end = ptr + count;
|
||||
@ -134,7 +134,7 @@ enum {
|
||||
struct QRandomGenerator::SystemGenerator
|
||||
{
|
||||
#if QT_CONFIG(getentropy)
|
||||
static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
|
||||
static qsizetype fillBuffer(void *buffer, qsizetype count) noexcept
|
||||
{
|
||||
// getentropy can read at most 256 bytes, so break the reading
|
||||
qsizetype read = 0;
|
||||
@ -204,13 +204,13 @@ struct QRandomGenerator::SystemGenerator
|
||||
}
|
||||
|
||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
|
||||
qsizetype fillBuffer(void *buffer, qsizetype count) noexcept
|
||||
{
|
||||
auto RtlGenRandom = SystemFunction036;
|
||||
return RtlGenRandom(buffer, ULONG(count)) ? count: 0;
|
||||
}
|
||||
#elif defined(Q_OS_WINRT)
|
||||
qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW
|
||||
qsizetype fillBuffer(void *, qsizetype) noexcept
|
||||
{
|
||||
// always use the fallback
|
||||
return 0;
|
||||
@ -242,7 +242,7 @@ struct QRandomGenerator::SystemGenerator
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
static void fallback_update_seed(unsigned) {}
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
|
||||
{
|
||||
// on Windows, rand_s is a high-quality random number generator
|
||||
// and it requires no seeding
|
||||
@ -254,14 +254,14 @@ static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
|
||||
}
|
||||
#elif QT_CONFIG(getentropy)
|
||||
static void fallback_update_seed(unsigned) {}
|
||||
static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW
|
||||
static void fallback_fill(quint32 *, qsizetype) noexcept
|
||||
{
|
||||
// no fallback necessary, getentropy cannot fail under normal circumstances
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
#elif defined(Q_OS_BSD4) && !defined(__GLIBC__)
|
||||
static void fallback_update_seed(unsigned) {}
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
|
||||
{
|
||||
// BSDs have arc4random(4) and these work even in chroot(2)
|
||||
arc4random_buf(ptr, left * sizeof(*ptr));
|
||||
@ -280,7 +280,7 @@ Q_NEVER_INLINE
|
||||
#ifdef Q_CC_GNU
|
||||
__attribute__((cold)) // this function is pretty big, so optimize for size
|
||||
#endif
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
|
||||
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
|
||||
{
|
||||
quint32 scratch[12]; // see element count below
|
||||
quint32 *end = scratch;
|
||||
@ -930,7 +930,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn quint32 QRandomGenerator::bounded(int highest)
|
||||
\fn int QRandomGenerator::bounded(int highest)
|
||||
\overload
|
||||
|
||||
Generates one random 32-bit quantity in the range between 0 (inclusive) and
|
||||
@ -957,7 +957,6 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
|
||||
|
||||
\snippet code/src_corelib_global_qrandom.cpp 14
|
||||
|
||||
|
||||
Note that this function cannot be used to obtain values in the full 32-bit
|
||||
range of quint32. Instead, use generate().
|
||||
|
||||
@ -965,7 +964,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn quint32 QRandomGenerator::bounded(int lowest, int highest)
|
||||
\fn int QRandomGenerator::bounded(int lowest, int highest)
|
||||
\overload
|
||||
|
||||
Generates one random 32-bit quantity in the range between \a lowest
|
||||
@ -1168,7 +1167,7 @@ QRandomGenerator &QRandomGenerator::operator=(const QRandomGenerator &other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW
|
||||
QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) noexcept
|
||||
: type(MersenneTwister)
|
||||
{
|
||||
Q_ASSERT(this != system());
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
|
||||
: QRandomGenerator(seedBuffer, seedBuffer + len)
|
||||
{}
|
||||
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) noexcept;
|
||||
Q_CORE_EXPORT QRandomGenerator(const quint32 *begin, const quint32 *end);
|
||||
|
||||
// copy constructor & assignment operator (move unnecessary)
|
||||
@ -165,7 +165,7 @@ public:
|
||||
typedef quint32 result_type;
|
||||
result_type operator()() { return generate(); }
|
||||
void seed(quint32 s = 1) { *this = { s }; }
|
||||
void seed(std::seed_seq &sseq) Q_DECL_NOTHROW { *this = { sseq }; }
|
||||
void seed(std::seed_seq &sseq) noexcept { *this = { sseq }; }
|
||||
Q_CORE_EXPORT void discard(unsigned long long z);
|
||||
static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits<result_type>::min(); }
|
||||
static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits<result_type>::max(); }
|
||||
@ -228,7 +228,7 @@ public:
|
||||
QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)
|
||||
: QRandomGenerator(seedBuffer, len)
|
||||
{}
|
||||
QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW
|
||||
QRandomGenerator64(std::seed_seq &sseq) noexcept
|
||||
: QRandomGenerator(sseq)
|
||||
{}
|
||||
QRandomGenerator64(const quint32 *begin, const quint32 *end)
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; }
|
||||
inline QDebug &operator=(const QDebug &other);
|
||||
~QDebug();
|
||||
inline void swap(QDebug &other) Q_DECL_NOTHROW { qSwap(stream, other.stream); }
|
||||
inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); }
|
||||
|
||||
QDebug &resetFormat();
|
||||
|
||||
|
@ -110,10 +110,10 @@ public:
|
||||
QDir &operator=(const QString &path);
|
||||
#endif
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QDir &operator=(QDir &&other) Q_DECL_NOTHROW { swap(other); return *this; }
|
||||
QDir &operator=(QDir &&other) noexcept { swap(other); return *this; }
|
||||
#endif
|
||||
|
||||
void swap(QDir &other) Q_DECL_NOTHROW
|
||||
void swap(QDir &other) noexcept
|
||||
{ qSwap(d_ptr, other.d_ptr); }
|
||||
|
||||
void setPath(const QString &path);
|
||||
@ -190,7 +190,7 @@ public:
|
||||
|
||||
static QFileInfoList drives();
|
||||
|
||||
Q_DECL_CONSTEXPR static inline QChar listSeparator() Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR static inline QChar listSeparator() noexcept
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return QLatin1Char(';');
|
||||
|
@ -68,10 +68,10 @@ public:
|
||||
|
||||
QFileInfo &operator=(const QFileInfo &fileinfo);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QFileInfo &operator=(QFileInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; }
|
||||
QFileInfo &operator=(QFileInfo &&other) noexcept { swap(other); return *this; }
|
||||
#endif
|
||||
|
||||
void swap(QFileInfo &other) Q_DECL_NOTHROW
|
||||
void swap(QFileInfo &other) noexcept
|
||||
{ qSwap(d_ptr, other.d_ptr); }
|
||||
|
||||
bool operator==(const QFileInfo &fileinfo) const;
|
||||
|
@ -555,7 +555,7 @@ typedef struct _FILE_ID_INFO {
|
||||
|
||||
#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
|
||||
|
||||
// File ID for Windows up to version 7.
|
||||
// File ID for Windows up to version 7 and FAT32 drives
|
||||
static inline QByteArray fileId(HANDLE handle)
|
||||
{
|
||||
#ifndef Q_OS_WINRT
|
||||
@ -588,6 +588,8 @@ QByteArray fileIdWin8(HANDLE handle)
|
||||
result += ':';
|
||||
// Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
|
||||
result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex();
|
||||
} else {
|
||||
result = fileId(handle); // GetFileInformationByHandleEx() is observed to fail for FAT32, QTBUG-74759
|
||||
}
|
||||
return result;
|
||||
#else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <qdebug.h>
|
||||
#include <qdir.h>
|
||||
#include <qscopedvaluerollback.h>
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <qtimer.h>
|
||||
#endif
|
||||
@ -1062,9 +1063,8 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel)
|
||||
if (currentReadChannel == channelIdx) {
|
||||
didRead = true;
|
||||
if (!emittedReadyRead) {
|
||||
emittedReadyRead = true;
|
||||
QScopedValueRollback<bool> guard(emittedReadyRead, true);
|
||||
emit q->readyRead();
|
||||
emittedReadyRead = false;
|
||||
}
|
||||
}
|
||||
emit q->channelReadyRead(int(channelIdx));
|
||||
|
@ -73,11 +73,11 @@ public:
|
||||
QProcessEnvironment(const QProcessEnvironment &other);
|
||||
~QProcessEnvironment();
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QProcessEnvironment &operator=(QProcessEnvironment && other) Q_DECL_NOTHROW { swap(other); return *this; }
|
||||
QProcessEnvironment &operator=(QProcessEnvironment && other) noexcept { swap(other); return *this; }
|
||||
#endif
|
||||
QProcessEnvironment &operator=(const QProcessEnvironment &other);
|
||||
|
||||
void swap(QProcessEnvironment &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
|
||||
void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); }
|
||||
|
||||
bool operator==(const QProcessEnvironment &other) const;
|
||||
inline bool operator!=(const QProcessEnvironment &other) const
|
||||
|
@ -134,7 +134,9 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
#ifndef Q_OS_WASM
|
||||
qWarning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", qPrintable(xdgRuntimeDir));
|
||||
#endif
|
||||
} else {
|
||||
fileInfo.setFile(xdgRuntimeDir);
|
||||
if (!fileInfo.exists()) {
|
||||
|
@ -63,10 +63,10 @@ public:
|
||||
|
||||
QStorageInfo &operator=(const QStorageInfo &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QStorageInfo &operator=(QStorageInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; }
|
||||
QStorageInfo &operator=(QStorageInfo &&other) noexcept { swap(other); return *this; }
|
||||
#endif
|
||||
|
||||
inline void swap(QStorageInfo &other) Q_DECL_NOTHROW
|
||||
inline void swap(QStorageInfo &other) noexcept
|
||||
{ qSwap(d, other.d); }
|
||||
|
||||
void setPath(const QString &path);
|
||||
|
@ -908,8 +908,8 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file)
|
||||
qint64 old_off = 0;
|
||||
if(wasOpen)
|
||||
old_off = file.pos();
|
||||
else
|
||||
file.open(QIODevice::ReadOnly);
|
||||
else if (!file.open(QIODevice::ReadOnly))
|
||||
return nullptr;
|
||||
//dump data
|
||||
QTemporaryFile *ret = new QTemporaryFile;
|
||||
if (ret->open()) {
|
||||
|
@ -4159,7 +4159,7 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)
|
||||
\relates QHash
|
||||
\since 5.0
|
||||
*/
|
||||
uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW
|
||||
uint qHash(const QUrl &url, uint seed) noexcept
|
||||
{
|
||||
if (!url.d)
|
||||
return qHash(-1, seed); // the hash of an unset port (-1)
|
||||
|
@ -119,7 +119,7 @@ class QTypeInfo<QUrlTwoFlags<E1, E2> > : public QTypeInfoMerger<QUrlTwoFlags<E1,
|
||||
|
||||
class QUrl;
|
||||
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
|
||||
Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) noexcept;
|
||||
|
||||
class Q_CORE_EXPORT QUrl
|
||||
{
|
||||
@ -183,14 +183,14 @@ public:
|
||||
QUrl &operator=(const QString &url);
|
||||
#endif
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d)
|
||||
QUrl(QUrl &&other) noexcept : d(other.d)
|
||||
{ other.d = nullptr; }
|
||||
inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW
|
||||
inline QUrl &operator=(QUrl &&other) noexcept
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
#endif
|
||||
~QUrl();
|
||||
|
||||
inline void swap(QUrl &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
|
||||
inline void swap(QUrl &other) noexcept { qSwap(d, other.d); }
|
||||
|
||||
void setUrl(const QString &url, ParsingMode mode = TolerantMode);
|
||||
QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
|
||||
@ -361,7 +361,7 @@ public:
|
||||
static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode);
|
||||
|
||||
static void setIdnWhitelist(const QStringList &);
|
||||
friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW;
|
||||
friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) noexcept;
|
||||
|
||||
private:
|
||||
QUrlPrivate *d;
|
||||
|
@ -434,7 +434,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const
|
||||
Returns the hash value for \a key,
|
||||
using \a seed to seed the calculation.
|
||||
*/
|
||||
uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW
|
||||
uint qHash(const QUrlQuery &key, uint seed) noexcept
|
||||
{
|
||||
if (const QUrlQueryPrivate *d = key.d) {
|
||||
QtPrivate::QHashCombine hash;
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) Q_DECL_NOTHROW;
|
||||
Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) noexcept;
|
||||
|
||||
class QUrlQueryPrivate;
|
||||
class Q_CORE_EXPORT QUrlQuery
|
||||
@ -71,7 +71,7 @@ public:
|
||||
QUrlQuery(const QUrlQuery &other);
|
||||
QUrlQuery &operator=(const QUrlQuery &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QUrlQuery &operator=(QUrlQuery &&other) Q_DECL_NOTHROW { swap(other); return *this; }
|
||||
QUrlQuery &operator=(QUrlQuery &&other) noexcept { swap(other); return *this; }
|
||||
#endif
|
||||
~QUrlQuery();
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
bool operator!=(const QUrlQuery &other) const
|
||||
{ return !(*this == other); }
|
||||
|
||||
void swap(QUrlQuery &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
|
||||
void swap(QUrlQuery &other) noexcept { qSwap(d, other.d); }
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isDetached() const;
|
||||
@ -111,7 +111,7 @@ public:
|
||||
|
||||
private:
|
||||
friend class QUrl;
|
||||
friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW;
|
||||
friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) noexcept;
|
||||
QSharedDataPointer<QUrlQueryPrivate> d;
|
||||
public:
|
||||
typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;
|
||||
|
@ -692,7 +692,7 @@ qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end,
|
||||
}
|
||||
|
||||
// qstring.cpp
|
||||
bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW;
|
||||
bool qt_is_ascii(const char *&ptr, const char *end) noexcept;
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qwindowspipereader_p.h"
|
||||
#include "qiodevice_p.h"
|
||||
#include <qelapsedtimer.h>
|
||||
#include <qscopedvaluerollback.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -301,9 +302,8 @@ void QWindowsPipeReader::emitPendingReadyRead()
|
||||
{
|
||||
if (readyReadPending) {
|
||||
readyReadPending = false;
|
||||
inReadyRead = true;
|
||||
QScopedValueRollback<bool> guard(inReadyRead, true);
|
||||
emit readyRead();
|
||||
inReadyRead = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "qwindowspipewriter_p.h"
|
||||
#include "qiodevice_p.h"
|
||||
#include <qscopedvaluerollback.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -111,9 +112,8 @@ void QWindowsPipeWriter::emitPendingBytesWrittenValue()
|
||||
|
||||
emit canWrite();
|
||||
if (!inBytesWritten) {
|
||||
inBytesWritten = true;
|
||||
QScopedValueRollback<bool> guard(inBytesWritten, true);
|
||||
emit bytesWritten(bytes);
|
||||
inBytesWritten = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2355,6 +2355,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||
bool wrap = flags & Qt::MatchWrap;
|
||||
bool allHits = (hits == -1);
|
||||
QString text; // only convert to a string if it is needed
|
||||
const int column = start.column();
|
||||
QModelIndex p = parent(start);
|
||||
int from = start.row();
|
||||
int to = rowCount(p);
|
||||
@ -2362,7 +2363,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||
// iterates twice if wrapping
|
||||
for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) {
|
||||
for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) {
|
||||
QModelIndex idx = index(r, start.column(), p);
|
||||
QModelIndex idx = index(r, column, p);
|
||||
if (!idx.isValid())
|
||||
continue;
|
||||
QVariant v = data(idx, role);
|
||||
@ -2401,10 +2402,13 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||
result.append(idx);
|
||||
}
|
||||
}
|
||||
if (recurse && hasChildren(idx)) { // search the hierarchy
|
||||
result += match(index(0, idx.column(), idx), role,
|
||||
(text.isEmpty() ? value : text),
|
||||
(allHits ? -1 : hits - result.count()), flags);
|
||||
if (recurse) {
|
||||
const auto parent = column != 0 ? idx.sibling(idx.row(), 0) : idx;
|
||||
if (hasChildren(parent)) { // search the hierarchy
|
||||
result += match(index(0, column, parent), role,
|
||||
(text.isEmpty() ? value : text),
|
||||
(allHits ? -1 : hits - result.count()), flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
// prepare for the next iteration
|
||||
|
@ -57,12 +57,12 @@ class Q_CORE_EXPORT QModelIndex
|
||||
{
|
||||
friend class QAbstractItemModel;
|
||||
public:
|
||||
Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(nullptr) {}
|
||||
Q_DECL_CONSTEXPR inline QModelIndex() noexcept : r(-1), c(-1), i(0), m(nullptr) {}
|
||||
// compiler-generated copy/move ctors/assignment operators are fine!
|
||||
Q_DECL_CONSTEXPR inline int row() const Q_DECL_NOTHROW { return r; }
|
||||
Q_DECL_CONSTEXPR inline int column() const Q_DECL_NOTHROW { return c; }
|
||||
Q_DECL_CONSTEXPR inline quintptr internalId() const Q_DECL_NOTHROW { return i; }
|
||||
inline void *internalPointer() const Q_DECL_NOTHROW { return reinterpret_cast<void*>(i); }
|
||||
Q_DECL_CONSTEXPR inline int row() const noexcept { return r; }
|
||||
Q_DECL_CONSTEXPR inline int column() const noexcept { return c; }
|
||||
Q_DECL_CONSTEXPR inline quintptr internalId() const noexcept { return i; }
|
||||
inline void *internalPointer() const noexcept { return reinterpret_cast<void*>(i); }
|
||||
inline QModelIndex parent() const;
|
||||
inline QModelIndex sibling(int row, int column) const;
|
||||
inline QModelIndex siblingAtColumn(int column) const;
|
||||
@ -72,13 +72,13 @@ public:
|
||||
#endif
|
||||
inline QVariant data(int role = Qt::DisplayRole) const;
|
||||
inline Qt::ItemFlags flags() const;
|
||||
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; }
|
||||
Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != nullptr); }
|
||||
Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const noexcept { return m; }
|
||||
Q_DECL_CONSTEXPR inline bool isValid() const noexcept { return (r >= 0) && (c >= 0) && (m != nullptr); }
|
||||
Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const noexcept
|
||||
{ return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const noexcept
|
||||
{ return !(*this == other); }
|
||||
Q_DECL_CONSTEXPR inline bool operator<(const QModelIndex &other) const Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline bool operator<(const QModelIndex &other) const noexcept
|
||||
{
|
||||
return r < other.r
|
||||
|| (r == other.r && (c < other.c
|
||||
@ -86,9 +86,9 @@ public:
|
||||
|| (i == other.i && std::less<const QAbstractItemModel *>()(m, other.m))))));
|
||||
}
|
||||
private:
|
||||
inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW
|
||||
inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) noexcept
|
||||
: r(arow), c(acolumn), i(reinterpret_cast<quintptr>(ptr)), m(amodel) {}
|
||||
Q_DECL_CONSTEXPR inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) noexcept
|
||||
: r(arow), c(acolumn), i(id), m(amodel) {}
|
||||
int r, c;
|
||||
quintptr i;
|
||||
@ -103,7 +103,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
|
||||
class QPersistentModelIndexData;
|
||||
|
||||
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
|
||||
uint qHash(const QPersistentModelIndex &index, uint seed = 0) Q_DECL_NOTHROW;
|
||||
uint qHash(const QPersistentModelIndex &index, uint seed = 0) noexcept;
|
||||
|
||||
class Q_CORE_EXPORT QPersistentModelIndex
|
||||
{
|
||||
@ -118,12 +118,12 @@ public:
|
||||
{ return !operator==(other); }
|
||||
QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW
|
||||
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
|
||||
: d(other.d) { other.d = nullptr; }
|
||||
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW
|
||||
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) noexcept
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
#endif
|
||||
inline void swap(QPersistentModelIndex &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
|
||||
inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); }
|
||||
bool operator==(const QModelIndex &other) const;
|
||||
bool operator!=(const QModelIndex &other) const;
|
||||
QPersistentModelIndex &operator=(const QModelIndex &other);
|
||||
@ -143,14 +143,14 @@ public:
|
||||
bool isValid() const;
|
||||
private:
|
||||
QPersistentModelIndexData *d;
|
||||
friend uint qHash(const QPersistentModelIndex &, uint seed) Q_DECL_NOTHROW;
|
||||
friend uint qHash(const QPersistentModelIndex &, uint seed) noexcept;
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
|
||||
#endif
|
||||
};
|
||||
Q_DECLARE_SHARED(QPersistentModelIndex)
|
||||
|
||||
inline uint qHash(const QPersistentModelIndex &index, uint seed) Q_DECL_NOTHROW
|
||||
inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept
|
||||
{ return qHash(index.d, seed); }
|
||||
|
||||
|
||||
@ -464,7 +464,7 @@ inline QVariant QModelIndex::data(int arole) const
|
||||
inline Qt::ItemFlags QModelIndex::flags() const
|
||||
{ return m ? m->flags(*this) : Qt::ItemFlags(); }
|
||||
|
||||
inline uint qHash(const QModelIndex &index) Q_DECL_NOTHROW
|
||||
inline uint qHash(const QModelIndex &index) noexcept
|
||||
{ return uint((uint(index.row()) << 4) + index.column() + index.internalId()); }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
struct SourceModelForRowResult
|
||||
{
|
||||
SourceModelForRowResult() : sourceModel(Q_NULLPTR), sourceRow(-1) {}
|
||||
SourceModelForRowResult() : sourceModel(nullptr), sourceRow(-1) {}
|
||||
QAbstractItemModel *sourceModel;
|
||||
int sourceRow;
|
||||
};
|
||||
|
@ -61,9 +61,9 @@ public:
|
||||
inline QItemSelectionRange(const QItemSelectionRange &other)
|
||||
: tl(other.tl), br(other.br) {}
|
||||
# ifdef Q_COMPILER_RVALUE_REFS
|
||||
QItemSelectionRange(QItemSelectionRange &&other) Q_DECL_NOTHROW
|
||||
QItemSelectionRange(QItemSelectionRange &&other) noexcept
|
||||
: tl(std::move(other.tl)), br(std::move(other.br)) {}
|
||||
QItemSelectionRange &operator=(QItemSelectionRange &&other) Q_DECL_NOTHROW
|
||||
QItemSelectionRange &operator=(QItemSelectionRange &&other) noexcept
|
||||
{ tl = std::move(other.tl); br = std::move(other.br); return *this; }
|
||||
# endif
|
||||
QItemSelectionRange &operator=(const QItemSelectionRange &other)
|
||||
@ -72,7 +72,7 @@ public:
|
||||
QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {}
|
||||
explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {}
|
||||
|
||||
void swap(QItemSelectionRange &other) Q_DECL_NOTHROW
|
||||
void swap(QItemSelectionRange &other) noexcept
|
||||
{
|
||||
qSwap(tl, other.tl);
|
||||
qSwap(br, other.br);
|
||||
@ -249,7 +249,7 @@ Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QList<QItemSelectionRange>;
|
||||
class Q_CORE_EXPORT QItemSelection : public QList<QItemSelectionRange>
|
||||
{
|
||||
public:
|
||||
QItemSelection() Q_DECL_NOTHROW : QList<QItemSelectionRange>() {}
|
||||
QItemSelection() noexcept : QList<QItemSelectionRange>() {}
|
||||
QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
|
||||
// reusing QList::swap() here is OK!
|
||||
|
@ -162,7 +162,7 @@ QAbstractEventDispatcher::~QAbstractEventDispatcher()
|
||||
Returns a pointer to the event dispatcher object for the specified
|
||||
\a thread. If \a thread is zero, the current thread is used. If no
|
||||
event dispatcher exists for the specified thread, this function
|
||||
returns 0.
|
||||
returns \nullptr.
|
||||
|
||||
\b{Note:} If Qt is built without thread support, the \a thread
|
||||
argument is ignored.
|
||||
|
@ -347,7 +347,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
|
||||
#endif
|
||||
|
||||
// in qelapsedtimer_mac.cpp or qtimestamp_unix.cpp
|
||||
timespec qt_gettime() Q_DECL_NOTHROW;
|
||||
timespec qt_gettime() noexcept;
|
||||
void qt_nanosleep(timespec amount);
|
||||
QByteArray qt_readlink(const char *path);
|
||||
|
||||
|
@ -369,7 +369,7 @@ uint QCoreApplicationPrivate::attribs =
|
||||
(1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents);
|
||||
|
||||
struct QCoreApplicationData {
|
||||
QCoreApplicationData() Q_DECL_NOTHROW {
|
||||
QCoreApplicationData() noexcept {
|
||||
applicationNameSet = false;
|
||||
applicationVersionSet = false;
|
||||
}
|
||||
@ -2917,7 +2917,7 @@ bool QCoreApplication::hasPendingEvents()
|
||||
|
||||
/*!
|
||||
Returns a pointer to the event dispatcher object for the main thread. If no
|
||||
event dispatcher exists for the thread, this function returns 0.
|
||||
event dispatcher exists for the thread, this function returns \nullptr.
|
||||
*/
|
||||
QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
|
||||
{
|
||||
|
@ -421,7 +421,7 @@ struct QBasicAtomicBitField {
|
||||
QBasicAtomicInteger<uint> next;
|
||||
QBasicAtomicInteger<uint> data[NumInts];
|
||||
|
||||
bool allocateSpecific(int which) Q_DECL_NOTHROW
|
||||
bool allocateSpecific(int which) noexcept
|
||||
{
|
||||
QBasicAtomicInteger<uint> &entry = data[which / BitsPerInt];
|
||||
const uint old = entry.load();
|
||||
@ -437,7 +437,7 @@ struct QBasicAtomicBitField {
|
||||
// loop.
|
||||
}
|
||||
|
||||
int allocateNext() Q_DECL_NOTHROW
|
||||
int allocateNext() noexcept
|
||||
{
|
||||
// Unroll loop to iterate over ints, then bits? Would save
|
||||
// potentially a lot of cmpxchgs, because we can scan the
|
||||
@ -463,7 +463,7 @@ typedef QBasicAtomicBitField<QEvent::MaxUser - QEvent::User + 1> UserEventTypeRe
|
||||
|
||||
static UserEventTypeRegistry userEventTypeRegistry;
|
||||
|
||||
static inline int registerEventTypeZeroBased(int id) Q_DECL_NOTHROW
|
||||
static inline int registerEventTypeZeroBased(int id) noexcept
|
||||
{
|
||||
// if the type hint hasn't been registered yet, take it:
|
||||
if (id < UserEventTypeRegistry::NumBits && id >= 0 && userEventTypeRegistry.allocateSpecific(id))
|
||||
@ -486,7 +486,7 @@ static inline int registerEventTypeZeroBased(int id) Q_DECL_NOTHROW
|
||||
Returns -1 if all available values are already taken or the
|
||||
program is shutting down.
|
||||
*/
|
||||
int QEvent::registerEventType(int hint) Q_DECL_NOTHROW
|
||||
int QEvent::registerEventType(int hint) noexcept
|
||||
{
|
||||
const int result = registerEventTypeZeroBased(QEvent::MaxUser - hint);
|
||||
return result < 0 ? -1 : QEvent::MaxUser - result ;
|
||||
|
@ -307,7 +307,7 @@ public:
|
||||
inline void accept() { m_accept = true; }
|
||||
inline void ignore() { m_accept = false; }
|
||||
|
||||
static int registerEventType(int hint = -1) Q_DECL_NOTHROW;
|
||||
static int registerEventType(int hint = -1) noexcept;
|
||||
|
||||
protected:
|
||||
QEventPrivate *d;
|
||||
|
@ -188,7 +188,7 @@ Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64
|
||||
|
||||
\sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
|
||||
*/
|
||||
QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
|
||||
QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) noexcept
|
||||
: t2(0)
|
||||
{
|
||||
setRemainingTime(msecs, type);
|
||||
@ -260,7 +260,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
|
||||
|
||||
\sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime()
|
||||
*/
|
||||
void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) noexcept
|
||||
{
|
||||
if (msecs == -1)
|
||||
*this = QDeadlineTimer(Forever, timerType);
|
||||
@ -279,7 +279,7 @@ void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_D
|
||||
|
||||
\sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
|
||||
*/
|
||||
void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) noexcept
|
||||
{
|
||||
if (secs == -1) {
|
||||
*this = QDeadlineTimer(Forever, timerType);
|
||||
@ -342,7 +342,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
|
||||
|
||||
\sa isForever(), remainingTime()
|
||||
*/
|
||||
bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
|
||||
bool QDeadlineTimer::hasExpired() const noexcept
|
||||
{
|
||||
if (isForever())
|
||||
return false;
|
||||
@ -389,7 +389,7 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
|
||||
|
||||
\sa remainingTimeNSecs(), isForever(), hasExpired()
|
||||
*/
|
||||
qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
|
||||
qint64 QDeadlineTimer::remainingTime() const noexcept
|
||||
{
|
||||
qint64 ns = remainingTimeNSecs();
|
||||
return ns <= 0 ? ns : (ns + 999999) / (1000 * 1000);
|
||||
@ -403,7 +403,7 @@ qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
|
||||
|
||||
\sa remainingTime(), isForever(), hasExpired()
|
||||
*/
|
||||
qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
|
||||
qint64 QDeadlineTimer::remainingTimeNSecs() const noexcept
|
||||
{
|
||||
if (isForever())
|
||||
return -1;
|
||||
@ -416,7 +416,7 @@ qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
|
||||
Same as remainingTimeNSecs, but may return negative remaining times. Does
|
||||
not deal with Forever.
|
||||
*/
|
||||
qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
|
||||
qint64 QDeadlineTimer::rawRemainingTimeNSecs() const noexcept
|
||||
{
|
||||
QDeadlineTimer now = current(timerType());
|
||||
if (QDeadlineTimerNanosecondsInT2)
|
||||
@ -444,7 +444,7 @@ qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
|
||||
|
||||
\sa remainingTime(), deadlineNSecs(), setDeadline()
|
||||
*/
|
||||
qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
|
||||
qint64 QDeadlineTimer::deadline() const noexcept
|
||||
{
|
||||
if (isForever())
|
||||
return t1;
|
||||
@ -471,7 +471,7 @@ qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
|
||||
|
||||
\sa remainingTime(), deadlineNSecs()
|
||||
*/
|
||||
qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
|
||||
qint64 QDeadlineTimer::deadlineNSecs() const noexcept
|
||||
{
|
||||
if (isForever())
|
||||
return t1;
|
||||
@ -492,7 +492,7 @@ qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
|
||||
|
||||
\sa setPreciseDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
|
||||
*/
|
||||
void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) noexcept
|
||||
{
|
||||
if (msecs == (std::numeric_limits<qint64>::max)()) {
|
||||
setPreciseDeadline(msecs, 0, timerType); // msecs == MAX implies Forever
|
||||
@ -513,7 +513,7 @@ void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_N
|
||||
|
||||
\sa setDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
|
||||
*/
|
||||
void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) noexcept
|
||||
{
|
||||
type = timerType;
|
||||
if (secs == (std::numeric_limits<qint64>::max)() || nsecs == (std::numeric_limits<qint64>::max)()) {
|
||||
@ -534,7 +534,7 @@ void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType
|
||||
\note if \a dt was created as expired, its deadline is indeterminate and
|
||||
adding an amount of time may or may not cause it to become unexpired.
|
||||
*/
|
||||
QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW
|
||||
QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) noexcept
|
||||
{
|
||||
if (dt.isForever() || nsecs == (std::numeric_limits<qint64>::max)()) {
|
||||
dt = QDeadlineTimer(Forever, dt.timerType());
|
||||
|
@ -63,49 +63,49 @@ class Q_CORE_EXPORT QDeadlineTimer
|
||||
public:
|
||||
enum ForeverConstant { Forever };
|
||||
|
||||
Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept
|
||||
: t1(0), t2(0), type(type_) {}
|
||||
Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept
|
||||
: t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
|
||||
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
|
||||
|
||||
void swap(QDeadlineTimer &other) Q_DECL_NOTHROW
|
||||
void swap(QDeadlineTimer &other) noexcept
|
||||
{ qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
|
||||
|
||||
Q_DECL_CONSTEXPR bool isForever() const Q_DECL_NOTHROW
|
||||
Q_DECL_CONSTEXPR bool isForever() const noexcept
|
||||
{ return t1 == (std::numeric_limits<qint64>::max)(); }
|
||||
bool hasExpired() const Q_DECL_NOTHROW;
|
||||
bool hasExpired() const noexcept;
|
||||
|
||||
Qt::TimerType timerType() const Q_DECL_NOTHROW
|
||||
Qt::TimerType timerType() const noexcept
|
||||
{ return Qt::TimerType(type & 0xff); }
|
||||
void setTimerType(Qt::TimerType type);
|
||||
|
||||
qint64 remainingTime() const Q_DECL_NOTHROW;
|
||||
qint64 remainingTimeNSecs() const Q_DECL_NOTHROW;
|
||||
void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
qint64 remainingTime() const noexcept;
|
||||
qint64 remainingTimeNSecs() const noexcept;
|
||||
void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
|
||||
void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0,
|
||||
Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
Qt::TimerType type = Qt::CoarseTimer) noexcept;
|
||||
|
||||
qint64 deadline() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
qint64 deadlineNSecs() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
qint64 deadline() const noexcept Q_DECL_PURE_FUNCTION;
|
||||
qint64 deadlineNSecs() const noexcept Q_DECL_PURE_FUNCTION;
|
||||
void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) noexcept;
|
||||
void setPreciseDeadline(qint64 secs, qint64 nsecs = 0,
|
||||
Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
Qt::TimerType type = Qt::CoarseTimer) noexcept;
|
||||
|
||||
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
|
||||
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) noexcept Q_DECL_PURE_FUNCTION;
|
||||
static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) noexcept;
|
||||
|
||||
friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return d1.t1 == d2.t1 && d1.t2 == d2.t2; }
|
||||
friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return !(d1 == d2); }
|
||||
friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); }
|
||||
friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return d1 == d2 || d1 < d2; }
|
||||
friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return d2 < d1; }
|
||||
friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
|
||||
friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
|
||||
{ return !(d1 < d2); }
|
||||
|
||||
friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
|
||||
@ -160,7 +160,7 @@ public:
|
||||
setPreciseRemainingTime(0, std::chrono::nanoseconds(remaining).count(), type_);
|
||||
}
|
||||
|
||||
std::chrono::nanoseconds remainingTimeAsDuration() const Q_DECL_NOTHROW
|
||||
std::chrono::nanoseconds remainingTimeAsDuration() const noexcept
|
||||
{
|
||||
if (isForever())
|
||||
return std::chrono::nanoseconds::max();
|
||||
@ -186,7 +186,7 @@ private:
|
||||
unsigned t2;
|
||||
unsigned type;
|
||||
|
||||
qint64 rawRemainingTimeNSecs() const Q_DECL_NOTHROW;
|
||||
qint64 rawRemainingTimeNSecs() const noexcept;
|
||||
|
||||
public:
|
||||
// This is not a public function, it's here only for Qt's internal convenience...
|
||||
|
@ -236,7 +236,7 @@ static const qint64 invalidData = Q_INT64_C(0x8000000000000000);
|
||||
|
||||
\sa isValid(), start(), restart()
|
||||
*/
|
||||
void QElapsedTimer::invalidate() Q_DECL_NOTHROW
|
||||
void QElapsedTimer::invalidate() noexcept
|
||||
{
|
||||
t1 = t2 = invalidData;
|
||||
}
|
||||
@ -247,7 +247,7 @@ void QElapsedTimer::invalidate() Q_DECL_NOTHROW
|
||||
|
||||
\sa invalidate(), start(), restart()
|
||||
*/
|
||||
bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::isValid() const noexcept
|
||||
{
|
||||
return t1 != invalidData && t2 != invalidData;
|
||||
}
|
||||
@ -260,7 +260,7 @@ bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
|
||||
|
||||
\sa elapsed(), QDeadlineTimer
|
||||
*/
|
||||
bool QElapsedTimer::hasExpired(qint64 timeout) const Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::hasExpired(qint64 timeout) const noexcept
|
||||
{
|
||||
// if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be
|
||||
// considered as never expired
|
||||
|
@ -62,28 +62,28 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
static ClockType clockType() Q_DECL_NOTHROW;
|
||||
static bool isMonotonic() Q_DECL_NOTHROW;
|
||||
static ClockType clockType() noexcept;
|
||||
static bool isMonotonic() noexcept;
|
||||
|
||||
void start() Q_DECL_NOTHROW;
|
||||
qint64 restart() Q_DECL_NOTHROW;
|
||||
void invalidate() Q_DECL_NOTHROW;
|
||||
bool isValid() const Q_DECL_NOTHROW;
|
||||
void start() noexcept;
|
||||
qint64 restart() noexcept;
|
||||
void invalidate() noexcept;
|
||||
bool isValid() const noexcept;
|
||||
|
||||
qint64 nsecsElapsed() const Q_DECL_NOTHROW;
|
||||
qint64 elapsed() const Q_DECL_NOTHROW;
|
||||
bool hasExpired(qint64 timeout) const Q_DECL_NOTHROW;
|
||||
qint64 nsecsElapsed() const noexcept;
|
||||
qint64 elapsed() const noexcept;
|
||||
bool hasExpired(qint64 timeout) const noexcept;
|
||||
|
||||
qint64 msecsSinceReference() const Q_DECL_NOTHROW;
|
||||
qint64 msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW;
|
||||
qint64 secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW;
|
||||
qint64 msecsSinceReference() const noexcept;
|
||||
qint64 msecsTo(const QElapsedTimer &other) const noexcept;
|
||||
qint64 secsTo(const QElapsedTimer &other) const noexcept;
|
||||
|
||||
bool operator==(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
bool operator==(const QElapsedTimer &other) const noexcept
|
||||
{ return t1 == other.t1 && t2 == other.t2; }
|
||||
bool operator!=(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
bool operator!=(const QElapsedTimer &other) const noexcept
|
||||
{ return !(*this == other); }
|
||||
|
||||
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW;
|
||||
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept;
|
||||
|
||||
private:
|
||||
qint64 t1;
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
\sa isMonotonic()
|
||||
*/
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
|
||||
{
|
||||
return SystemTime;
|
||||
}
|
||||
@ -60,7 +60,7 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
|
||||
\sa clockType(), QElapsedTimer::ClockType
|
||||
*/
|
||||
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::isMonotonic() noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -75,7 +75,7 @@ bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||
|
||||
\sa restart(), invalidate(), elapsed()
|
||||
*/
|
||||
void QElapsedTimer::start() Q_DECL_NOTHROW
|
||||
void QElapsedTimer::start() noexcept
|
||||
{
|
||||
restart();
|
||||
}
|
||||
@ -97,7 +97,7 @@ void QElapsedTimer::start() Q_DECL_NOTHROW
|
||||
|
||||
\sa start(), invalidate(), elapsed(), isValid()
|
||||
*/
|
||||
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::restart() noexcept
|
||||
{
|
||||
qint64 old = t1;
|
||||
t1 = QDateTime::currentMSecsSinceEpoch();
|
||||
@ -118,7 +118,7 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
|
||||
\sa start(), restart(), hasExpired(), invalidate()
|
||||
*/
|
||||
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::nsecsElapsed() const noexcept
|
||||
{
|
||||
return elapsed() * 1000000;
|
||||
}
|
||||
@ -132,7 +132,7 @@ qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
|
||||
\sa start(), restart(), hasExpired(), isValid(), invalidate()
|
||||
*/
|
||||
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::elapsed() const noexcept
|
||||
{
|
||||
return QDateTime::currentMSecsSinceEpoch() - t1;
|
||||
}
|
||||
@ -152,7 +152,7 @@ qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
|
||||
|
||||
\sa clockType(), elapsed()
|
||||
*/
|
||||
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsSinceReference() const noexcept
|
||||
{
|
||||
return t1;
|
||||
}
|
||||
@ -167,7 +167,7 @@ qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
|
||||
|
||||
\sa secsTo(), elapsed()
|
||||
*/
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
qint64 diff = other.t1 - t1;
|
||||
return diff;
|
||||
@ -183,7 +183,7 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
|
||||
\sa msecsTo(), elapsed()
|
||||
*/
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
return msecsTo(other) / 1000;
|
||||
}
|
||||
@ -197,12 +197,12 @@ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
and the other isn't. However, two invalid timers are equal and thus this
|
||||
function will return false.
|
||||
*/
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
|
||||
{
|
||||
return v1.t1 < v2.t1;
|
||||
}
|
||||
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
|
||||
{
|
||||
QDeadlineTimer result;
|
||||
result.t1 = QDateTime::currentMSecsSinceEpoch() * 1000 * 1000;
|
||||
|
@ -58,12 +58,12 @@ typedef __int128_t LargeInt;
|
||||
typedef qint64 LargeInt;
|
||||
#endif
|
||||
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
|
||||
{
|
||||
return MachAbsoluteTime;
|
||||
}
|
||||
|
||||
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::isMonotonic() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -87,7 +87,7 @@ static qint64 absoluteToMSecs(qint64 cpuTime)
|
||||
return absoluteToNSecs(cpuTime) / 1000000;
|
||||
}
|
||||
|
||||
timespec qt_gettime() Q_DECL_NOTHROW
|
||||
timespec qt_gettime() noexcept
|
||||
{
|
||||
timespec tv;
|
||||
|
||||
@ -107,13 +107,13 @@ void qt_nanosleep(timespec amount)
|
||||
EINTR_LOOP(r, nanosleep(&amount, &amount));
|
||||
}
|
||||
|
||||
void QElapsedTimer::start() Q_DECL_NOTHROW
|
||||
void QElapsedTimer::start() noexcept
|
||||
{
|
||||
t1 = mach_absolute_time();
|
||||
t2 = 0;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::restart() noexcept
|
||||
{
|
||||
qint64 old = t1;
|
||||
t1 = mach_absolute_time();
|
||||
@ -122,39 +122,39 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
return absoluteToMSecs(t1 - old);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::nsecsElapsed() const noexcept
|
||||
{
|
||||
uint64_t cpu_time = mach_absolute_time();
|
||||
return absoluteToNSecs(cpu_time - t1);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::elapsed() const noexcept
|
||||
{
|
||||
uint64_t cpu_time = mach_absolute_time();
|
||||
return absoluteToMSecs(cpu_time - t1);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsSinceReference() const noexcept
|
||||
{
|
||||
return absoluteToMSecs(t1);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
return absoluteToMSecs(other.t1 - t1);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
return msecsTo(other) / 1000;
|
||||
}
|
||||
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
|
||||
{
|
||||
return v1.t1 < v2.t1;
|
||||
}
|
||||
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
|
||||
QDeadlineTimer result;
|
||||
|
@ -150,12 +150,12 @@ static int unixCheckClockType()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::isMonotonic() noexcept
|
||||
{
|
||||
return clockType() == MonotonicClock;
|
||||
}
|
||||
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
|
||||
{
|
||||
return unixCheckClockType() == CLOCK_REALTIME ? SystemTime : MonotonicClock;
|
||||
}
|
||||
@ -169,7 +169,7 @@ static inline void do_gettime(qint64 *sec, qint64 *frac)
|
||||
}
|
||||
|
||||
// used in qcore_unix.cpp and qeventdispatcher_unix.cpp
|
||||
struct timespec qt_gettime() Q_DECL_NOTHROW
|
||||
struct timespec qt_gettime() noexcept
|
||||
{
|
||||
qint64 sec, frac;
|
||||
do_gettime(&sec, &frac);
|
||||
@ -204,17 +204,17 @@ static qint64 elapsedAndRestart(qint64 sec, qint64 frac,
|
||||
return (sec * Q_INT64_C(1000000000) + frac) / Q_INT64_C(1000000);
|
||||
}
|
||||
|
||||
void QElapsedTimer::start() Q_DECL_NOTHROW
|
||||
void QElapsedTimer::start() noexcept
|
||||
{
|
||||
do_gettime(&t1, &t2);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::restart() noexcept
|
||||
{
|
||||
return elapsedAndRestart(t1, t2, &t1, &t2);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::nsecsElapsed() const noexcept
|
||||
{
|
||||
qint64 sec, frac;
|
||||
do_gettime(&sec, &frac);
|
||||
@ -223,34 +223,34 @@ qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
return sec * Q_INT64_C(1000000000) + frac;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::elapsed() const noexcept
|
||||
{
|
||||
return nsecsElapsed() / Q_INT64_C(1000000);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsSinceReference() const noexcept
|
||||
{
|
||||
return t1 * Q_INT64_C(1000) + t2 / Q_INT64_C(1000000);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
qint64 secs = other.t1 - t1;
|
||||
qint64 fraction = other.t2 - t2;
|
||||
return (secs * Q_INT64_C(1000000000) + fraction) / Q_INT64_C(1000000);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
return other.t1 - t1;
|
||||
}
|
||||
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
|
||||
{
|
||||
return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2);
|
||||
}
|
||||
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT(QDeadlineTimerNanosecondsInT2);
|
||||
QDeadlineTimer result;
|
||||
|
@ -110,25 +110,25 @@ quint64 qt_msectime()
|
||||
return ticksToNanoseconds(getTickCount()) / 1000000;
|
||||
}
|
||||
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
|
||||
{
|
||||
resolveCounterFrequency();
|
||||
|
||||
return counterFrequency > 0 ? PerformanceCounter : TickCounter;
|
||||
}
|
||||
|
||||
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||
bool QElapsedTimer::isMonotonic() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QElapsedTimer::start() Q_DECL_NOTHROW
|
||||
void QElapsedTimer::start() noexcept
|
||||
{
|
||||
t1 = getTickCount();
|
||||
t2 = 0;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::restart() noexcept
|
||||
{
|
||||
qint64 oldt1 = t1;
|
||||
t1 = getTickCount();
|
||||
@ -136,40 +136,40 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
|
||||
return ticksToNanoseconds(t1 - oldt1) / 1000000;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::nsecsElapsed() const noexcept
|
||||
{
|
||||
qint64 elapsed = getTickCount() - t1;
|
||||
return ticksToNanoseconds(elapsed);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::elapsed() const noexcept
|
||||
{
|
||||
qint64 elapsed = getTickCount() - t1;
|
||||
return ticksToNanoseconds(elapsed) / 1000000;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsSinceReference() const noexcept
|
||||
{
|
||||
return ticksToNanoseconds(t1) / 1000000;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
qint64 difference = other.t1 - t1;
|
||||
return ticksToNanoseconds(difference) / 1000000;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
|
||||
{
|
||||
return msecsTo(other) / 1000;
|
||||
}
|
||||
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
|
||||
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
|
||||
{
|
||||
return (v1.t1 - v2.t1) < 0;
|
||||
}
|
||||
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
|
||||
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
|
||||
{
|
||||
Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
|
||||
QDeadlineTimer result;
|
||||
|
@ -64,10 +64,10 @@ class QEventDispatcherUNIXPrivate;
|
||||
|
||||
struct Q_CORE_EXPORT QSocketNotifierSetUNIX final
|
||||
{
|
||||
inline QSocketNotifierSetUNIX() Q_DECL_NOTHROW;
|
||||
inline QSocketNotifierSetUNIX() noexcept;
|
||||
|
||||
inline bool isEmpty() const Q_DECL_NOTHROW;
|
||||
inline short events() const Q_DECL_NOTHROW;
|
||||
inline bool isEmpty() const noexcept;
|
||||
inline short events() const noexcept;
|
||||
|
||||
QSocketNotifier *notifiers[3];
|
||||
};
|
||||
@ -150,19 +150,19 @@ public:
|
||||
QAtomicInt interrupt; // bool
|
||||
};
|
||||
|
||||
inline QSocketNotifierSetUNIX::QSocketNotifierSetUNIX() Q_DECL_NOTHROW
|
||||
inline QSocketNotifierSetUNIX::QSocketNotifierSetUNIX() noexcept
|
||||
{
|
||||
notifiers[0] = nullptr;
|
||||
notifiers[1] = nullptr;
|
||||
notifiers[2] = nullptr;
|
||||
}
|
||||
|
||||
inline bool QSocketNotifierSetUNIX::isEmpty() const Q_DECL_NOTHROW
|
||||
inline bool QSocketNotifierSetUNIX::isEmpty() const noexcept
|
||||
{
|
||||
return !notifiers[0] && !notifiers[1] && !notifiers[2];
|
||||
}
|
||||
|
||||
inline short QSocketNotifierSetUNIX::events() const Q_DECL_NOTHROW
|
||||
inline short QSocketNotifierSetUNIX::events() const noexcept
|
||||
{
|
||||
short result = 0;
|
||||
|
||||
|
@ -72,8 +72,8 @@ Q_DECLARE_TYPEINFO(Variable, Q_MOVABLE_TYPE);
|
||||
struct NameEquals {
|
||||
typedef bool result_type;
|
||||
const char *name;
|
||||
explicit NameEquals(const char *name) Q_DECL_NOTHROW : name(name) {}
|
||||
result_type operator()(const Variable &other) const Q_DECL_NOTHROW
|
||||
explicit NameEquals(const char *name) noexcept : name(name) {}
|
||||
result_type operator()(const Variable &other) const noexcept
|
||||
{ return qstrcmp(other.name, name) == 0; }
|
||||
};
|
||||
|
||||
|
@ -335,7 +335,7 @@ const char *QMetaObject::className() const
|
||||
|
||||
\since 5.7
|
||||
*/
|
||||
bool QMetaObject::inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT
|
||||
bool QMetaObject::inherits(const QMetaObject *metaObject) const noexcept
|
||||
{
|
||||
const QMetaObject *m = this;
|
||||
do {
|
||||
@ -349,7 +349,7 @@ bool QMetaObject::inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT
|
||||
\internal
|
||||
|
||||
Returns \a obj if object \a obj inherits from this
|
||||
meta-object; otherwise returns 0.
|
||||
meta-object; otherwise returns \nullptr.
|
||||
*/
|
||||
QObject *QMetaObject::cast(QObject *obj) const
|
||||
{
|
||||
@ -361,7 +361,7 @@ QObject *QMetaObject::cast(QObject *obj) const
|
||||
\internal
|
||||
|
||||
Returns \a obj if object \a obj inherits from this
|
||||
meta-object; otherwise returns 0.
|
||||
meta-object; otherwise returns \nullptr.
|
||||
*/
|
||||
const QObject *QMetaObject::cast(const QObject *obj) const
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ struct QMetaObjectPrivate
|
||||
const QMetaObject *smeta,
|
||||
const QObject *receiver, int method_index, void **slot,
|
||||
DisconnectType = DisconnectAll);
|
||||
static inline bool disconnectHelper(QObjectPrivate::Connection *c,
|
||||
static inline bool disconnectHelper(QObjectPrivate::ConnectionData *connections, int signalIndex,
|
||||
const QObject *receiver, int method_index, void **slot,
|
||||
QBasicMutex *senderMutex, DisconnectType = DisconnectAll);
|
||||
#endif
|
||||
|
@ -915,7 +915,7 @@ template <int... TypeIds> struct MetaTypeOffsets<QtPrivate::IndexesList<TypeIds.
|
||||
short offsets[sizeof...(TypeIds)];
|
||||
constexpr MetaTypeOffsets() : offsets{calculateOffsetForTypeId(TypeIds)...} {}
|
||||
|
||||
const char *operator[](int typeId) const Q_DECL_NOTHROW
|
||||
const char *operator[](int typeId) const noexcept
|
||||
{
|
||||
short o = offsets[typeId];
|
||||
return o < 0 ? nullptr : metaTypeStrings + o;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
@ -265,13 +265,13 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
|
||||
if (signal_index < 0 || !cd)
|
||||
return false;
|
||||
QBasicMutexLocker locker(signalSlotLock(q));
|
||||
if (signal_index < cd->signalVector.count()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.at(signal_index).first;
|
||||
if (signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
|
||||
while (c) {
|
||||
if (c->receiver == receiver)
|
||||
if (c->receiver.load() == receiver)
|
||||
return true;
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -280,20 +280,19 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
|
||||
// Used by QAccessibleWidget
|
||||
QObjectList QObjectPrivate::receiverList(const char *signal) const
|
||||
{
|
||||
Q_Q(const QObject);
|
||||
QObjectList returnValue;
|
||||
int signal_index = signalIndex(signal);
|
||||
ConnectionData *cd = connections.load();
|
||||
if (signal_index < 0 || !cd)
|
||||
return returnValue;
|
||||
QBasicMutexLocker locker(signalSlotLock(q));
|
||||
if (signal_index < cd->signalVector.count()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.at(signal_index).first;
|
||||
if (signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
|
||||
while (c) {
|
||||
if (c->receiver)
|
||||
returnValue << c->receiver;
|
||||
c = c->nextConnectionList;
|
||||
QObject *r = c->receiver.load();
|
||||
if (r)
|
||||
returnValue << r;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
@ -327,20 +326,20 @@ void QObjectPrivate::addConnection(int signal, Connection *c)
|
||||
Q_ASSERT(c->sender == q_ptr);
|
||||
ensureConnectionData();
|
||||
ConnectionData *cd = connections.load();
|
||||
if (signal >= cd->signalVector.count())
|
||||
cd->signalVector.resize(signal + 1);
|
||||
cd->resizeSignalVector(signal + 1);
|
||||
|
||||
ConnectionList &connectionList = cd->connectionsForSignal(signal);
|
||||
if (connectionList.last) {
|
||||
connectionList.last->nextConnectionList = c;
|
||||
if (connectionList.last.load()) {
|
||||
Q_ASSERT(connectionList.last.load()->receiver.load());
|
||||
connectionList.last.load()->nextConnectionList.store(c);
|
||||
} else {
|
||||
connectionList.first = c;
|
||||
connectionList.first.store(c);
|
||||
}
|
||||
connectionList.last = c;
|
||||
c->id = ++cd->currentConnectionId;
|
||||
c->prevConnectionList = connectionList.last.load();
|
||||
connectionList.last.store(c);
|
||||
|
||||
cleanConnectionLists();
|
||||
|
||||
QObjectPrivate *rd = QObjectPrivate::get(c->receiver);
|
||||
QObjectPrivate *rd = QObjectPrivate::get(c->receiver.load());
|
||||
rd->ensureConnectionData();
|
||||
|
||||
c->prev = &(rd->connections.load()->senders);
|
||||
@ -350,39 +349,99 @@ void QObjectPrivate::addConnection(int signal, Connection *c)
|
||||
c->next->prev = &c->next;
|
||||
}
|
||||
|
||||
void QObjectPrivate::cleanConnectionLists()
|
||||
void QObjectPrivate::ConnectionData::removeConnection(QObjectPrivate::Connection *c)
|
||||
{
|
||||
ConnectionData *cd = connections.load();
|
||||
if (cd->dirty && cd->ref == 1) {
|
||||
// remove broken connections
|
||||
for (int signal = -1; signal < cd->signalVector.count(); ++signal) {
|
||||
ConnectionList &connectionList = cd->connectionsForSignal(signal);
|
||||
Q_ASSERT(c->receiver.load());
|
||||
ConnectionList &connections = signalVector.load()->at(c->signal_index);
|
||||
c->receiver.store(nullptr);
|
||||
QThreadData *td = c->receiverThreadData.load();
|
||||
if (td)
|
||||
td->deref();
|
||||
c->receiverThreadData.store(nullptr);
|
||||
|
||||
// Set to the last entry in the connection list that was *not*
|
||||
// deleted. This is needed to update the list's last pointer
|
||||
// at the end of the cleanup.
|
||||
QObjectPrivate::Connection *last = 0;
|
||||
|
||||
QObjectPrivate::Connection **prev = &connectionList.first;
|
||||
QObjectPrivate::Connection *c = *prev;
|
||||
while (c) {
|
||||
if (c->receiver) {
|
||||
last = c;
|
||||
prev = &c->nextConnectionList;
|
||||
c = *prev;
|
||||
} else {
|
||||
QObjectPrivate::Connection *next = c->nextConnectionList;
|
||||
*prev = next;
|
||||
c->deref();
|
||||
c = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Correct the connection list's last pointer.
|
||||
// As conectionList.last could equal last, this could be a noop
|
||||
connectionList.last = last;
|
||||
#ifndef QT_NO_DEBUG
|
||||
bool found = false;
|
||||
for (Connection *cc = connections.first.load(); cc; cc = cc->nextConnectionList.load()) {
|
||||
if (cc == c) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
cd->dirty = false;
|
||||
}
|
||||
Q_ASSERT(found);
|
||||
#endif
|
||||
|
||||
// remove from the senders linked list
|
||||
*c->prev = c->next;
|
||||
if (c->next)
|
||||
c->next->prev = c->prev;
|
||||
c->prev = nullptr;
|
||||
|
||||
if (connections.first.load() == c)
|
||||
connections.first.store(c->nextConnectionList.load());
|
||||
if (connections.last.load() == c)
|
||||
connections.last.store(c->prevConnectionList);
|
||||
Q_ASSERT(signalVector.load()->at(c->signal_index).first.load() != c);
|
||||
Q_ASSERT(signalVector.load()->at(c->signal_index).last.load() != c);
|
||||
|
||||
// keep c->nextConnectionList intact, as it might still get accessed by activate
|
||||
Connection *n = c->nextConnectionList.load();
|
||||
if (n)
|
||||
n->prevConnectionList = c->prevConnectionList;
|
||||
if (c->prevConnectionList)
|
||||
c->prevConnectionList->nextConnectionList.store(n);
|
||||
c->prevConnectionList = nullptr;
|
||||
|
||||
Q_ASSERT(c != orphaned.load());
|
||||
// add c to orphanedConnections
|
||||
c->nextInOrphanList = orphaned.load();
|
||||
orphaned.store(c);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
found = false;
|
||||
for (Connection *cc = connections.first.load(); cc; cc = cc->nextConnectionList.load()) {
|
||||
if (cc == c) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Q_ASSERT(!found);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void QObjectPrivate::ConnectionData::cleanOrphanedConnectionsImpl(QObject *sender)
|
||||
{
|
||||
ConnectionOrSignalVector *c = nullptr;
|
||||
{
|
||||
QBasicMutexLocker l(signalSlotLock(sender));
|
||||
if (ref > 1)
|
||||
return;
|
||||
|
||||
// Since ref == 1, no activate() is in process since we locked the mutex. That implies,
|
||||
// that nothing can reference the orphaned connection objects anymore and they can
|
||||
// be safely deleted
|
||||
c = orphaned.load();
|
||||
orphaned.store(nullptr);
|
||||
}
|
||||
deleteOrphaned(c);
|
||||
}
|
||||
|
||||
void QObjectPrivate::ConnectionData::deleteOrphaned(QObjectPrivate::ConnectionOrSignalVector *o)
|
||||
{
|
||||
while (o) {
|
||||
QObjectPrivate::ConnectionOrSignalVector *next = nullptr;
|
||||
if (SignalVector *v = ConnectionOrSignalVector::asSignalVector(o)) {
|
||||
next = v->nextInOrphanList;
|
||||
free(v);
|
||||
} else {
|
||||
QObjectPrivate::Connection *c = static_cast<Connection *>(o);
|
||||
next = c->nextInOrphanList;
|
||||
Q_ASSERT(!c->receiver.load());
|
||||
Q_ASSERT(!c->prev);
|
||||
c->freeSlotObject();
|
||||
c->deref();
|
||||
}
|
||||
o = next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,16 +459,19 @@ bool QObjectPrivate::isSignalConnected(uint signalIndex, bool checkDeclarative)
|
||||
ConnectionData *cd = connections.load();
|
||||
if (!cd)
|
||||
return false;
|
||||
SignalVector *signalVector = cd->signalVector.load();
|
||||
if (!signalVector)
|
||||
return false;
|
||||
|
||||
if (cd->allsignals.first)
|
||||
if (signalVector->at(-1).first.load())
|
||||
return true;
|
||||
|
||||
if (signalIndex < uint(cd->signalVector.count())) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.at(signalIndex).first;
|
||||
if (signalIndex < uint(cd->signalVectorCount())) {
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first.load();
|
||||
while (c) {
|
||||
if (c->receiver)
|
||||
if (c->receiver.load())
|
||||
return true;
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -420,17 +482,30 @@ bool QObjectPrivate::maybeSignalConnected(uint signalIndex) const
|
||||
ConnectionData *cd = connections.load();
|
||||
if (!cd)
|
||||
return false;
|
||||
SignalVector *signalVector = cd->signalVector.load();
|
||||
if (!signalVector)
|
||||
return false;
|
||||
|
||||
if (cd->allsignals.first)
|
||||
if (signalVector->at(-1).first)
|
||||
return true;
|
||||
|
||||
if (signalIndex < uint(cd->signalVector.count())) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.at(signalIndex).first;
|
||||
if (signalIndex < uint(cd->signalVectorCount())) {
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first;
|
||||
return c != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QAbstractMetaCallEvent::~QAbstractMetaCallEvent()
|
||||
{
|
||||
#if QT_CONFIG(thread)
|
||||
if (semaphore_)
|
||||
semaphore_->release();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
@ -438,8 +513,8 @@ bool QObjectPrivate::maybeSignalConnected(uint signalIndex) const
|
||||
QMetaCallEvent::QMetaCallEvent(ushort method_offset, ushort method_relative, QObjectPrivate::StaticMetaCallFunction callFunction,
|
||||
const QObject *sender, int signalId,
|
||||
int nargs, int *types, void **args, QSemaphore *semaphore)
|
||||
: QEvent(MetaCall), slotObj_(0), sender_(sender), signalId_(signalId),
|
||||
nargs_(nargs), types_(types), args_(args), semaphore_(semaphore),
|
||||
: QAbstractMetaCallEvent(sender, signalId, semaphore),
|
||||
slotObj_(nullptr), nargs_(nargs), types_(types), args_(args),
|
||||
callFunction_(callFunction), method_offset_(method_offset), method_relative_(method_relative)
|
||||
{ }
|
||||
|
||||
@ -448,9 +523,9 @@ QMetaCallEvent::QMetaCallEvent(ushort method_offset, ushort method_relative, QOb
|
||||
*/
|
||||
QMetaCallEvent::QMetaCallEvent(QtPrivate::QSlotObjectBase *slotO, const QObject *sender, int signalId,
|
||||
int nargs, int *types, void **args, QSemaphore *semaphore)
|
||||
: QEvent(MetaCall), slotObj_(slotO), sender_(sender), signalId_(signalId),
|
||||
nargs_(nargs), types_(types), args_(args), semaphore_(semaphore),
|
||||
callFunction_(0), method_offset_(0), method_relative_(ushort(-1))
|
||||
: QAbstractMetaCallEvent(sender, signalId, semaphore),
|
||||
slotObj_(slotO), nargs_(nargs), types_(types), args_(args),
|
||||
callFunction_(nullptr), method_offset_(0), method_relative_(ushort(-1))
|
||||
{
|
||||
if (slotObj_)
|
||||
slotObj_->ref();
|
||||
@ -469,10 +544,6 @@ QMetaCallEvent::~QMetaCallEvent()
|
||||
free(types_);
|
||||
free(args_);
|
||||
}
|
||||
#if QT_CONFIG(thread)
|
||||
if (semaphore_)
|
||||
semaphore_->release();
|
||||
#endif
|
||||
if (slotObj_)
|
||||
slotObj_->destroyIfLastRef();
|
||||
}
|
||||
@ -900,52 +971,27 @@ QObject::~QObject()
|
||||
QBasicMutexLocker locker(signalSlotMutex);
|
||||
|
||||
// disconnect all receivers
|
||||
int receiverCount = cd->signalVector.count();
|
||||
int receiverCount = cd->signalVectorCount();
|
||||
for (int signal = -1; signal < receiverCount; ++signal) {
|
||||
QObjectPrivate::ConnectionList &connectionList = cd->connectionsForSignal(signal);
|
||||
|
||||
while (QObjectPrivate::Connection *c = connectionList.first) {
|
||||
if (!c->receiver) {
|
||||
connectionList.first = c->nextConnectionList;
|
||||
c->deref();
|
||||
continue;
|
||||
}
|
||||
while (QObjectPrivate::Connection *c = connectionList.first.load()) {
|
||||
Q_ASSERT(c->receiver);
|
||||
|
||||
QBasicMutex *m = signalSlotLock(c->receiver);
|
||||
QBasicMutex *m = signalSlotLock(c->receiver.load());
|
||||
bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
|
||||
|
||||
if (c->receiver) {
|
||||
*c->prev = c->next;
|
||||
if (c->next) c->next->prev = c->prev;
|
||||
cd->removeConnection(c);
|
||||
Q_ASSERT(connectionList.first.load() != c);
|
||||
}
|
||||
c->receiver = 0;
|
||||
if (needToUnlock)
|
||||
m->unlock();
|
||||
|
||||
connectionList.first = c->nextConnectionList;
|
||||
|
||||
// The destroy operation must happen outside the lock
|
||||
if (c->isSlotObject) {
|
||||
c->isSlotObject = false;
|
||||
locker.unlock();
|
||||
c->slotObj->destroyIfLastRef();
|
||||
locker.relock();
|
||||
}
|
||||
c->deref();
|
||||
}
|
||||
}
|
||||
|
||||
/* Disconnect all senders:
|
||||
* This loop basically just does
|
||||
* for (node = d->senders; node; node = node->next) { ... }
|
||||
*
|
||||
* We need to temporarily unlock the receiver mutex to destroy the functors or to lock the
|
||||
* sender's mutex. And when the mutex is released, node->next might be destroyed by another
|
||||
* thread. That's why we set node->prev to &node, that way, if node is destroyed, node will
|
||||
* be updated.
|
||||
*/
|
||||
QObjectPrivate::Connection *node = cd->senders;
|
||||
while (node) {
|
||||
while (QObjectPrivate::Connection *node = cd->senders) {
|
||||
Q_ASSERT(node->receiver);
|
||||
QObject *sender = node->sender;
|
||||
// Send disconnectNotify before removing the connection from sender's connection list.
|
||||
@ -953,19 +999,17 @@ QObject::~QObject()
|
||||
// and not finish until we release it.
|
||||
sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), node->signal_index));
|
||||
QBasicMutex *m = signalSlotLock(sender);
|
||||
node->prev = &node;
|
||||
bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
|
||||
//the node has maybe been removed while the mutex was unlocked in relock?
|
||||
if (!node || node->sender != sender) {
|
||||
if (node != cd->senders) {
|
||||
// We hold the wrong mutex
|
||||
Q_ASSERT(needToUnlock);
|
||||
m->unlock();
|
||||
continue;
|
||||
}
|
||||
node->receiver = 0;
|
||||
|
||||
QObjectPrivate::ConnectionData *senderData = sender->d_func()->connections.load();
|
||||
if (senderData)
|
||||
senderData->dirty = true;
|
||||
Q_ASSERT(senderData);
|
||||
|
||||
QtPrivate::QSlotObjectBase *slotObj = nullptr;
|
||||
if (node->isSlotObject) {
|
||||
@ -973,20 +1017,20 @@ QObject::~QObject()
|
||||
node->isSlotObject = false;
|
||||
}
|
||||
|
||||
node = node->next;
|
||||
senderData->removeConnection(node);
|
||||
if (needToUnlock)
|
||||
m->unlock();
|
||||
|
||||
if (slotObj) {
|
||||
if (node)
|
||||
node->prev = &node;
|
||||
locker.unlock();
|
||||
slotObj->destroyIfLastRef();
|
||||
locker.relock();
|
||||
}
|
||||
}
|
||||
|
||||
cd->objectDeleted = true;
|
||||
// invalidate all connections on the object and make sure
|
||||
// activate() will skip them
|
||||
cd->currentConnectionId.store(0);
|
||||
}
|
||||
if (cd && !cd->ref.deref())
|
||||
delete cd;
|
||||
@ -1217,7 +1261,7 @@ bool QObject::event(QEvent *e)
|
||||
|
||||
case QEvent::MetaCall:
|
||||
{
|
||||
QMetaCallEvent *mce = static_cast<QMetaCallEvent*>(e);
|
||||
QAbstractMetaCallEvent *mce = static_cast<QAbstractMetaCallEvent*>(e);
|
||||
|
||||
if (!d_func()->connections.load()) {
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
@ -1383,7 +1427,7 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */)
|
||||
\sa signalsBlocked(), QSignalBlocker
|
||||
*/
|
||||
|
||||
bool QObject::blockSignals(bool block) Q_DECL_NOTHROW
|
||||
bool QObject::blockSignals(bool block) noexcept
|
||||
{
|
||||
Q_D(QObject);
|
||||
bool previous = d->blockSig;
|
||||
@ -1478,6 +1522,9 @@ void QObject::moveToThread(QThread *targetThread)
|
||||
if (!targetData)
|
||||
targetData = new QThreadData(0);
|
||||
|
||||
// make sure nobody adds/removes connections to this object while we're moving it
|
||||
QMutexLocker l(signalSlotLock(this));
|
||||
|
||||
QOrderedMutexLocker locker(¤tData->postEventList.mutex,
|
||||
&targetData->postEventList.mutex);
|
||||
|
||||
@ -1528,9 +1575,29 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
|
||||
|
||||
// the current emitting thread shouldn't restore currentSender after calling moveToThread()
|
||||
ConnectionData *cd = connections.load();
|
||||
if (cd && cd->currentSender) {
|
||||
cd->currentSender->receiverDeleted();
|
||||
cd->currentSender = nullptr;
|
||||
if (cd) {
|
||||
if (cd->currentSender) {
|
||||
cd->currentSender->receiverDeleted();
|
||||
cd->currentSender = nullptr;
|
||||
}
|
||||
|
||||
// adjust the receiverThreadId values in the Connections
|
||||
if (cd) {
|
||||
auto *c = cd->senders;
|
||||
while (c) {
|
||||
QObject *r = c->receiver.load();
|
||||
if (r) {
|
||||
Q_ASSERT(r == q);
|
||||
targetData->ref();
|
||||
QThreadData *old = c->receiverThreadData.load();
|
||||
if (old)
|
||||
old->deref();
|
||||
c->receiverThreadData.store(targetData);
|
||||
}
|
||||
c = c->next;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// set new thread data
|
||||
@ -2316,7 +2383,7 @@ static void err_info_about_objects(const char * func,
|
||||
|
||||
/*!
|
||||
Returns a pointer to the object that sent the signal, if called in
|
||||
a slot activated by a signal; otherwise it returns 0. The pointer
|
||||
a slot activated by a signal; otherwise it returns \nullptr. The pointer
|
||||
is valid only during the execution of the slot that calls this
|
||||
function from this object's thread context.
|
||||
|
||||
@ -2448,12 +2515,11 @@ int QObject::receivers(const char *signal) const
|
||||
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
if (cd && signal_index < cd->signalVector.count()) {
|
||||
const QObjectPrivate::Connection *c =
|
||||
cd->signalVector.at(signal_index).first;
|
||||
if (cd && signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
while (c) {
|
||||
receivers += c->receiver ? 1 : 0;
|
||||
c = c->nextConnectionList;
|
||||
receivers += c->receiver.load() ? 1 : 0;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3264,15 +3330,15 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
|
||||
|
||||
QObjectPrivate::ConnectionData *scd = QObjectPrivate::get(s)->connections.load();
|
||||
if (type & Qt::UniqueConnection && scd) {
|
||||
if (scd->signalVector.count() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = scd->signalVector.at(signal_index).first;
|
||||
if (scd->signalVectorCount() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = scd->signalVector.load()->at(signal_index).first.load();
|
||||
|
||||
int method_index_absolute = method_index + method_offset;
|
||||
|
||||
while (c2) {
|
||||
if (!c2->isSlotObject && c2->receiver == receiver && c2->method() == method_index_absolute)
|
||||
if (!c2->isSlotObject && c2->receiver.load() == receiver && c2->method() == method_index_absolute)
|
||||
return nullptr;
|
||||
c2 = c2->nextConnectionList;
|
||||
c2 = c2->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
type &= Qt::UniqueConnection - 1;
|
||||
@ -3281,13 +3347,15 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
|
||||
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
|
||||
c->sender = s;
|
||||
c->signal_index = signal_index;
|
||||
c->receiver = r;
|
||||
c->receiver.store(r);
|
||||
QThreadData *td = r->d_func()->threadData;
|
||||
td->ref();
|
||||
c->receiverThreadData.store(td);
|
||||
c->method_relative = method_index;
|
||||
c->method_offset = method_offset;
|
||||
c->connectionType = type;
|
||||
c->isSlotObject = false;
|
||||
c->argumentTypes.store(types);
|
||||
c->nextConnectionList = 0;
|
||||
c->callFunction = callFunction;
|
||||
|
||||
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
|
||||
@ -3333,47 +3401,38 @@ bool QMetaObject::disconnectOne(const QObject *sender, int signal_index,
|
||||
\internal
|
||||
Helper function to remove the connection from the senders list and setting the receivers to 0
|
||||
*/
|
||||
bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
|
||||
bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::ConnectionData *connections, int signalIndex,
|
||||
const QObject *receiver, int method_index, void **slot,
|
||||
QBasicMutex *senderMutex, DisconnectType disconnectType)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
auto &connectionList = connections->connectionsForSignal(signalIndex);
|
||||
auto *c = connectionList.first.load();
|
||||
while (c) {
|
||||
if (c->receiver
|
||||
&& (receiver == 0 || (c->receiver == receiver
|
||||
QObject *r = c->receiver.load();
|
||||
if (r && (receiver == nullptr || (r == receiver
|
||||
&& (method_index < 0 || (!c->isSlotObject && c->method() == method_index))
|
||||
&& (slot == 0 || (c->isSlotObject && c->slotObj->compare(slot)))))) {
|
||||
&& (slot == nullptr || (c->isSlotObject && c->slotObj->compare(slot)))))) {
|
||||
bool needToUnlock = false;
|
||||
QBasicMutex *receiverMutex = nullptr;
|
||||
if (c->receiver) {
|
||||
receiverMutex = signalSlotLock(c->receiver);
|
||||
if (r) {
|
||||
receiverMutex = signalSlotLock(r);
|
||||
// need to relock this receiver and sender in the correct order
|
||||
needToUnlock = QOrderedMutexLocker::relock(senderMutex, receiverMutex);
|
||||
}
|
||||
if (c->receiver) {
|
||||
*c->prev = c->next;
|
||||
if (c->next)
|
||||
c->next->prev = c->prev;
|
||||
}
|
||||
if (c->receiver.load())
|
||||
connections->removeConnection(c);
|
||||
|
||||
if (needToUnlock)
|
||||
receiverMutex->unlock();
|
||||
|
||||
c->receiver = 0;
|
||||
|
||||
if (c->isSlotObject) {
|
||||
c->isSlotObject = false;
|
||||
senderMutex->unlock();
|
||||
c->slotObj->destroyIfLastRef();
|
||||
senderMutex->lock();
|
||||
}
|
||||
|
||||
success = true;
|
||||
|
||||
if (disconnectType == DisconnectOne)
|
||||
return success;
|
||||
}
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -3406,24 +3465,20 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender,
|
||||
|
||||
if (signal_index < 0) {
|
||||
// remove from all connection lists
|
||||
for (int sig_index = -1; sig_index < scd->signalVector.count(); ++sig_index) {
|
||||
QObjectPrivate::Connection *c = scd->connectionsForSignal(sig_index).first;
|
||||
if (disconnectHelper(c, receiver, method_index, slot, senderMutex, disconnectType)) {
|
||||
for (int sig_index = -1; sig_index < scd->signalVectorCount(); ++sig_index) {
|
||||
if (disconnectHelper(connections.data(), sig_index, receiver, method_index, slot, senderMutex, disconnectType))
|
||||
success = true;
|
||||
scd->dirty = true;
|
||||
}
|
||||
}
|
||||
} else if (signal_index < scd->signalVector.count()) {
|
||||
QObjectPrivate::Connection *c = scd->signalVector.at(signal_index).first;
|
||||
if (disconnectHelper(c, receiver, method_index, slot, senderMutex, disconnectType)) {
|
||||
} else if (signal_index < scd->signalVectorCount()) {
|
||||
if (disconnectHelper(connections.data(), signal_index, receiver, method_index, slot, senderMutex, disconnectType))
|
||||
success = true;
|
||||
scd->dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locker.unlock();
|
||||
if (success) {
|
||||
scd->cleanOrphanedConnections(s);
|
||||
|
||||
QMetaMethod smethod = QMetaObjectPrivate::signal(smeta, signal_index);
|
||||
if (smethod.isValid())
|
||||
s->disconnectNotify(smethod);
|
||||
@ -3539,8 +3594,7 @@ void QMetaObject::connectSlotsByName(QObject *o)
|
||||
|
||||
\a signal must be in the signal index range (see QObjectPrivate::signalIndex()).
|
||||
*/
|
||||
static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv,
|
||||
QBasicMutexLocker &locker)
|
||||
static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv)
|
||||
{
|
||||
const int *argumentTypes = c->argumentTypes.load();
|
||||
if (!argumentTypes) {
|
||||
@ -3570,27 +3624,25 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
|
||||
for (int n = 1; n < nargs; ++n)
|
||||
types[n] = argumentTypes[n-1];
|
||||
|
||||
locker.unlock();
|
||||
for (int n = 1; n < nargs; ++n)
|
||||
args[n] = QMetaType::create(types[n], argv[n]);
|
||||
locker.relock();
|
||||
}
|
||||
|
||||
if (!c->receiver) {
|
||||
locker.unlock();
|
||||
// we have been disconnected while the mutex was unlocked
|
||||
for (int n = 1; n < nargs; ++n)
|
||||
QMetaType::destroy(types[n], args[n]);
|
||||
free(types);
|
||||
free(args);
|
||||
locker.relock();
|
||||
return;
|
||||
}
|
||||
QBasicMutexLocker locker(signalSlotLock(c->receiver.load()));
|
||||
if (!c->receiver.load()) {
|
||||
// the connection has been disconnected before we got the lock
|
||||
locker.unlock();
|
||||
for (int n = 1; n < nargs; ++n)
|
||||
QMetaType::destroy(types[n], args[n]);
|
||||
free(types);
|
||||
free(args);
|
||||
return;
|
||||
}
|
||||
|
||||
QMetaCallEvent *ev = c->isSlotObject ?
|
||||
new QMetaCallEvent(c->slotObj, sender, signal, nargs, types, args) :
|
||||
new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal, nargs, types, args);
|
||||
QCoreApplication::postEvent(c->receiver, ev);
|
||||
QCoreApplication::postEvent(c->receiver.load(), ev);
|
||||
}
|
||||
|
||||
template <bool callbacks_enabled>
|
||||
@ -3630,38 +3682,53 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
signal_spy_set->signal_begin_callback(sender, signal_index, argv);
|
||||
Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
|
||||
|
||||
bool senderDeleted = false;
|
||||
{
|
||||
QBasicMutexLocker locker(signalSlotLock(sender));
|
||||
Q_ASSERT(sp->connections);
|
||||
QObjectPrivate::ConnectionDataPointer connections(sp->connections.load());
|
||||
QObjectPrivate::SignalVector *signalVector = connections->signalVector.load();
|
||||
|
||||
const QObjectPrivate::ConnectionList *list;
|
||||
if (signal_index < connections->signalVector.count())
|
||||
list = &connections->signalVector.at(signal_index);
|
||||
if (signal_index < signalVector->count())
|
||||
list = &signalVector->at(signal_index);
|
||||
else
|
||||
list = &connections->allsignals;
|
||||
list = &signalVector->at(-1);
|
||||
|
||||
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
||||
bool inSenderThread = currentThreadId == QObjectPrivate::get(sender)->threadData->threadId.load();
|
||||
|
||||
// We need to check against the highest connection id to ensure that signals added
|
||||
// during the signal emission are not emitted in this emission.
|
||||
uint highestConnectionId = connections->currentConnectionId.load();
|
||||
do {
|
||||
QObjectPrivate::Connection *c = list->first;
|
||||
if (!c) continue;
|
||||
// We need to check against last here to ensure that signals added
|
||||
// during the signal emission are not emitted in this emission.
|
||||
QObjectPrivate::Connection *last = list->last;
|
||||
QObjectPrivate::Connection *c = list->first.load();
|
||||
if (!c)
|
||||
continue;
|
||||
|
||||
do {
|
||||
if (!c->receiver)
|
||||
QObject * const receiver = c->receiver.load();
|
||||
if (!receiver)
|
||||
continue;
|
||||
|
||||
QObject * const receiver = c->receiver;
|
||||
const bool receiverInSameThread = currentThreadId == QObjectPrivate::get(receiver)->threadData->threadId.load();
|
||||
QThreadData *td = c->receiverThreadData.load();
|
||||
if (!td)
|
||||
continue;
|
||||
|
||||
bool receiverInSameThread;
|
||||
if (inSenderThread) {
|
||||
receiverInSameThread = currentThreadId == td->threadId.load();
|
||||
} else {
|
||||
// need to lock before reading the threadId, because moveToThread() could interfere
|
||||
QMutexLocker lock(signalSlotLock(receiver));
|
||||
receiverInSameThread = currentThreadId == td->threadId.load();
|
||||
}
|
||||
|
||||
|
||||
// determine if this connection should be sent immediately or
|
||||
// put into the event queue
|
||||
if ((c->connectionType == Qt::AutoConnection && !receiverInSameThread)
|
||||
|| (c->connectionType == Qt::QueuedConnection)) {
|
||||
queued_activate(sender, signal_index, c, argv, locker);
|
||||
queued_activate(sender, signal_index, c, argv);
|
||||
continue;
|
||||
#if QT_CONFIG(thread)
|
||||
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
|
||||
@ -3672,13 +3739,16 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
receiver->metaObject()->className(), receiver);
|
||||
}
|
||||
QSemaphore semaphore;
|
||||
QMetaCallEvent *ev = c->isSlotObject ?
|
||||
new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv, &semaphore) :
|
||||
new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal_index, 0, 0, argv, &semaphore);
|
||||
QCoreApplication::postEvent(receiver, ev);
|
||||
locker.unlock();
|
||||
{
|
||||
QBasicMutexLocker locker(signalSlotLock(sender));
|
||||
if (!c->receiver)
|
||||
continue;
|
||||
QMetaCallEvent *ev = c->isSlotObject ?
|
||||
new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv, &semaphore) :
|
||||
new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal_index, 0, 0, argv, &semaphore);
|
||||
QCoreApplication::postEvent(receiver, ev);
|
||||
}
|
||||
semaphore.acquire();
|
||||
locker.relock();
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
@ -3688,22 +3758,13 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
if (c->isSlotObject) {
|
||||
c->slotObj->ref();
|
||||
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
|
||||
locker.unlock();
|
||||
Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
|
||||
obj->call(receiver, argv);
|
||||
Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
|
||||
|
||||
// Make sure the slot object gets destroyed before the mutex is locked again, as the
|
||||
// destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool,
|
||||
// and that would deadlock if the pool happens to return the same mutex.
|
||||
obj.reset();
|
||||
|
||||
locker.relock();
|
||||
} else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
|
||||
//we compare the vtable to make sure we are not in the destructor of the object.
|
||||
const int method_relative = c->method_relative;
|
||||
const auto callFunction = c->callFunction;
|
||||
locker.unlock();
|
||||
const int methodIndex = (Q_HAS_TRACEPOINTS || callbacks_enabled) ? c->method() : 0;
|
||||
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr)
|
||||
signal_spy_set->slot_begin_callback(receiver, methodIndex, argv);
|
||||
@ -3714,10 +3775,8 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
|
||||
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
|
||||
signal_spy_set->slot_end_callback(receiver, methodIndex);
|
||||
locker.relock();
|
||||
} else {
|
||||
const int method = c->method_relative + c->method_offset;
|
||||
locker.unlock();
|
||||
|
||||
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr) {
|
||||
signal_spy_set->slot_begin_callback(receiver, method, argv);
|
||||
@ -3729,21 +3788,18 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
|
||||
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
|
||||
signal_spy_set->slot_end_callback(receiver, method);
|
||||
|
||||
locker.relock();
|
||||
}
|
||||
} while ((c = c->nextConnectionList.load()) != nullptr && c->id <= highestConnectionId);
|
||||
|
||||
if (connections->objectDeleted)
|
||||
break;
|
||||
} while (c != last && (c = c->nextConnectionList) != 0);
|
||||
|
||||
if (connections->objectDeleted)
|
||||
break;
|
||||
} while (list != &connections->allsignals &&
|
||||
} while (list != &signalVector->at(-1) &&
|
||||
//start over for all signals;
|
||||
((list = &connections->allsignals), true));
|
||||
((list = &signalVector->at(-1)), true));
|
||||
|
||||
if (connections->currentConnectionId.load() == 0)
|
||||
senderDeleted = true;
|
||||
}
|
||||
if (!senderDeleted)
|
||||
sp->connections.load()->cleanOrphanedConnections(sender);
|
||||
|
||||
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
|
||||
signal_spy_set->signal_end_callback(sender, signal_index);
|
||||
@ -4038,31 +4094,34 @@ void QObject::dumpObjectInfo() const
|
||||
qDebug(" SIGNALS OUT");
|
||||
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
if (cd && cd->signalVector.count()) {
|
||||
for (int signal_index = 0; signal_index < cd->signalVector.count(); ++signal_index) {
|
||||
if (cd && cd->signalVectorCount()) {
|
||||
QObjectPrivate::SignalVector *signalVector = cd->signalVector.load();
|
||||
for (int signal_index = 0; signal_index < signalVector->count(); ++signal_index) {
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signal_index).first.load();
|
||||
if (!c)
|
||||
continue;
|
||||
const QMetaMethod signal = QMetaObjectPrivate::signal(metaObject(), signal_index);
|
||||
qDebug(" signal: %s", signal.methodSignature().constData());
|
||||
|
||||
// receivers
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.at(signal_index).first;
|
||||
while (c) {
|
||||
if (!c->receiver) {
|
||||
if (!c->receiver.load()) {
|
||||
qDebug(" <Disconnected receiver>");
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
continue;
|
||||
}
|
||||
if (c->isSlotObject) {
|
||||
qDebug(" <functor or function pointer>");
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
continue;
|
||||
}
|
||||
const QMetaObject *receiverMetaObject = c->receiver->metaObject();
|
||||
const QMetaObject *receiverMetaObject = c->receiver.load()->metaObject();
|
||||
const QMetaMethod method = receiverMetaObject->method(c->method());
|
||||
qDebug(" --> %s::%s %s",
|
||||
receiverMetaObject->className(),
|
||||
c->receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver->objectName()),
|
||||
c->receiver.load()->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver.load()->objectName()),
|
||||
method.methodSignature().constData());
|
||||
c = c->nextConnectionList;
|
||||
c = c->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -4810,15 +4869,15 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
|
||||
|
||||
if (type & Qt::UniqueConnection && slot && QObjectPrivate::get(s)->connections.load()) {
|
||||
QObjectPrivate::ConnectionData *connections = QObjectPrivate::get(s)->connections.load();
|
||||
if (connections->signalVector.count() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = connections->signalVector.at(signal_index).first;
|
||||
if (connections->signalVectorCount() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = connections->signalVector.load()->at(signal_index).first.load();
|
||||
|
||||
while (c2) {
|
||||
if (c2->receiver == receiver && c2->isSlotObject && c2->slotObj->compare(slot)) {
|
||||
if (c2->receiver.load() == receiver && c2->isSlotObject && c2->slotObj->compare(slot)) {
|
||||
slotObj->destroyIfLastRef();
|
||||
return QMetaObject::Connection();
|
||||
}
|
||||
c2 = c2->nextConnectionList;
|
||||
c2 = c2->nextConnectionList.load();
|
||||
}
|
||||
}
|
||||
type = static_cast<Qt::ConnectionType>(type ^ Qt::UniqueConnection);
|
||||
@ -4827,7 +4886,10 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
|
||||
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
|
||||
c->sender = s;
|
||||
c->signal_index = signal_index;
|
||||
c->receiver = r;
|
||||
QThreadData *td = r->d_func()->threadData;
|
||||
td->ref();
|
||||
c->receiverThreadData.store(td);
|
||||
c->receiver.store(r);
|
||||
c->slotObj = slotObj;
|
||||
c->connectionType = type;
|
||||
c->isSlotObject = true;
|
||||
@ -4859,30 +4921,30 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
|
||||
{
|
||||
QObjectPrivate::Connection *c = static_cast<QObjectPrivate::Connection *>(connection.d_ptr);
|
||||
|
||||
if (!c || !c->receiver)
|
||||
if (!c)
|
||||
return false;
|
||||
QObject *receiver = c->receiver.load();
|
||||
if (!receiver)
|
||||
return false;
|
||||
|
||||
QBasicMutex *senderMutex = signalSlotLock(c->sender);
|
||||
QBasicMutex *receiverMutex = signalSlotLock(c->receiver);
|
||||
QBasicMutex *receiverMutex = signalSlotLock(receiver);
|
||||
|
||||
QObjectPrivate::ConnectionData *connections;
|
||||
{
|
||||
QOrderedMutexLocker locker(senderMutex, receiverMutex);
|
||||
|
||||
QObjectPrivate::ConnectionData *connections = QObjectPrivate::get(c->sender)->connections.load();
|
||||
// load receiver once again and recheck to ensure nobody else has removed the connection in the meantime
|
||||
receiver = c->receiver.load();
|
||||
if (!receiver)
|
||||
return false;
|
||||
|
||||
connections = QObjectPrivate::get(c->sender)->connections.load();
|
||||
Q_ASSERT(connections);
|
||||
connections->dirty = true;
|
||||
|
||||
*c->prev = c->next;
|
||||
if (c->next)
|
||||
c->next->prev = c->prev;
|
||||
c->receiver = nullptr;
|
||||
connections->removeConnection(c);
|
||||
}
|
||||
|
||||
// destroy the QSlotObject, if possible
|
||||
if (c->isSlotObject) {
|
||||
c->slotObj->destroyIfLastRef();
|
||||
c->isSlotObject = false;
|
||||
}
|
||||
connections->cleanOrphanedConnections(c->sender);
|
||||
|
||||
c->sender->disconnectNotify(QMetaObjectPrivate::signal(c->sender->metaObject(),
|
||||
c->signal_index));
|
||||
@ -5069,7 +5131,7 @@ bool QMetaObject::Connection::isConnected_helper() const
|
||||
Q_ASSERT(d_ptr); // we're only called from operator RestrictedBool() const
|
||||
QObjectPrivate::Connection *c = static_cast<QObjectPrivate::Connection *>(d_ptr);
|
||||
|
||||
return c->receiver;
|
||||
return c->receiver.load();
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,8 +142,8 @@ public:
|
||||
inline bool isWidgetType() const { return d_ptr->isWidget; }
|
||||
inline bool isWindowType() const { return d_ptr->isWindow; }
|
||||
|
||||
inline bool signalsBlocked() const Q_DECL_NOTHROW { return d_ptr->blockSig; }
|
||||
bool blockSignals(bool b) Q_DECL_NOTHROW;
|
||||
inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; }
|
||||
bool blockSignals(bool b) noexcept;
|
||||
|
||||
QThread *thread() const;
|
||||
void moveToThread(QThread *thread);
|
||||
@ -436,7 +436,7 @@ protected:
|
||||
QScopedPointer<QObjectData> d_ptr;
|
||||
|
||||
static const QMetaObject staticQtMetaObject;
|
||||
friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT;
|
||||
friend inline const QMetaObject *qt_getQtMetaObject() noexcept;
|
||||
|
||||
friend struct QMetaObject;
|
||||
friend struct QMetaObjectPrivate;
|
||||
@ -467,7 +467,7 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
|
||||
const char *amember, Qt::ConnectionType atype) const
|
||||
{ return connect(asender, asignal, this, amember, atype); }
|
||||
|
||||
inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT
|
||||
inline const QMetaObject *qt_getQtMetaObject() noexcept
|
||||
{ return &QObject::staticQtMetaObject; }
|
||||
|
||||
#ifndef QT_NO_USERDATA
|
||||
@ -540,17 +540,17 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
|
||||
class QSignalBlocker
|
||||
{
|
||||
public:
|
||||
inline explicit QSignalBlocker(QObject *o) Q_DECL_NOTHROW;
|
||||
inline explicit QSignalBlocker(QObject &o) Q_DECL_NOTHROW;
|
||||
inline explicit QSignalBlocker(QObject *o) noexcept;
|
||||
inline explicit QSignalBlocker(QObject &o) noexcept;
|
||||
inline ~QSignalBlocker();
|
||||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW;
|
||||
inline QSignalBlocker &operator=(QSignalBlocker &&other) Q_DECL_NOTHROW;
|
||||
inline QSignalBlocker(QSignalBlocker &&other) noexcept;
|
||||
inline QSignalBlocker &operator=(QSignalBlocker &&other) noexcept;
|
||||
#endif
|
||||
|
||||
inline void reblock() Q_DECL_NOTHROW;
|
||||
inline void unblock() Q_DECL_NOTHROW;
|
||||
inline void reblock() noexcept;
|
||||
inline void unblock() noexcept;
|
||||
private:
|
||||
Q_DISABLE_COPY(QSignalBlocker)
|
||||
QObject * m_o;
|
||||
@ -558,20 +558,20 @@ private:
|
||||
bool m_inhibited;
|
||||
};
|
||||
|
||||
QSignalBlocker::QSignalBlocker(QObject *o) Q_DECL_NOTHROW
|
||||
QSignalBlocker::QSignalBlocker(QObject *o) noexcept
|
||||
: m_o(o),
|
||||
m_blocked(o && o->blockSignals(true)),
|
||||
m_inhibited(false)
|
||||
{}
|
||||
|
||||
QSignalBlocker::QSignalBlocker(QObject &o) Q_DECL_NOTHROW
|
||||
QSignalBlocker::QSignalBlocker(QObject &o) noexcept
|
||||
: m_o(&o),
|
||||
m_blocked(o.blockSignals(true)),
|
||||
m_inhibited(false)
|
||||
{}
|
||||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW
|
||||
QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) noexcept
|
||||
: m_o(other.m_o),
|
||||
m_blocked(other.m_blocked),
|
||||
m_inhibited(other.m_inhibited)
|
||||
@ -579,7 +579,7 @@ QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW
|
||||
other.m_o = nullptr;
|
||||
}
|
||||
|
||||
QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW
|
||||
QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
// if both *this and other block the same object's signals:
|
||||
@ -602,13 +602,13 @@ QSignalBlocker::~QSignalBlocker()
|
||||
m_o->blockSignals(m_blocked);
|
||||
}
|
||||
|
||||
void QSignalBlocker::reblock() Q_DECL_NOTHROW
|
||||
void QSignalBlocker::reblock() noexcept
|
||||
{
|
||||
if (m_o) m_o->blockSignals(true);
|
||||
m_inhibited = false;
|
||||
}
|
||||
|
||||
void QSignalBlocker::unblock() Q_DECL_NOTHROW
|
||||
void QSignalBlocker::unblock() noexcept
|
||||
{
|
||||
if (m_o) m_o->blockSignals(m_blocked);
|
||||
m_inhibited = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
@ -124,45 +124,76 @@ public:
|
||||
};
|
||||
|
||||
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
|
||||
struct Connection
|
||||
struct Connection;
|
||||
struct SignalVector;
|
||||
|
||||
struct ConnectionOrSignalVector {
|
||||
union {
|
||||
// linked list of orphaned connections that need cleaning up
|
||||
ConnectionOrSignalVector *nextInOrphanList;
|
||||
// linked list of connections connected to slots in this object
|
||||
Connection *next;
|
||||
};
|
||||
|
||||
static SignalVector *asSignalVector(ConnectionOrSignalVector *c) {
|
||||
if (reinterpret_cast<quintptr>(c) & 1)
|
||||
return reinterpret_cast<SignalVector *>(reinterpret_cast<quintptr>(c) & ~quintptr(1u));
|
||||
return nullptr;
|
||||
}
|
||||
static Connection *fromSignalVector(SignalVector *v) {
|
||||
return reinterpret_cast<Connection *>(reinterpret_cast<quintptr>(v) | quintptr(1u));
|
||||
}
|
||||
};
|
||||
|
||||
struct Connection : public ConnectionOrSignalVector
|
||||
{
|
||||
// linked list of connections connected to slots in this object, next is in base class
|
||||
Connection **prev;
|
||||
// linked list of connections connected to signals in this object
|
||||
QAtomicPointer<Connection> nextConnectionList;
|
||||
Connection *prevConnectionList;
|
||||
|
||||
QObject *sender;
|
||||
QObject *receiver;
|
||||
QAtomicPointer<QObject> receiver;
|
||||
QAtomicPointer<QThreadData> receiverThreadData;
|
||||
union {
|
||||
StaticMetaCallFunction callFunction;
|
||||
QtPrivate::QSlotObjectBase *slotObj;
|
||||
};
|
||||
// The next pointer for the singly-linked ConnectionList
|
||||
Connection *nextConnectionList;
|
||||
//senders linked list
|
||||
Connection *next;
|
||||
Connection **prev;
|
||||
QAtomicPointer<const int> argumentTypes;
|
||||
QAtomicInt ref_;
|
||||
uint id = 0;
|
||||
ushort method_offset;
|
||||
ushort method_relative;
|
||||
uint signal_index : 27; // In signal range (see QObjectPrivate::signalIndex())
|
||||
int signal_index : 27; // In signal range (see QObjectPrivate::signalIndex())
|
||||
ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
|
||||
ushort isSlotObject : 1;
|
||||
ushort ownArgumentTypes : 1;
|
||||
Connection() : nextConnectionList(nullptr), ref_(2), ownArgumentTypes(true) {
|
||||
Connection() : ref_(2), ownArgumentTypes(true) {
|
||||
//ref_ is 2 for the use in the internal lists, and for the use in QMetaObject::Connection
|
||||
}
|
||||
~Connection();
|
||||
int method() const { Q_ASSERT(!isSlotObject); return method_offset + method_relative; }
|
||||
void ref() { ref_.ref(); }
|
||||
void freeSlotObject()
|
||||
{
|
||||
if (isSlotObject) {
|
||||
slotObj->destroyIfLastRef();
|
||||
isSlotObject = false;
|
||||
}
|
||||
}
|
||||
void deref() {
|
||||
if (!ref_.deref()) {
|
||||
Q_ASSERT(!receiver);
|
||||
Q_ASSERT(!receiver.load());
|
||||
Q_ASSERT(!isSlotObject);
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
};
|
||||
// ConnectionList is a singly-linked list
|
||||
struct ConnectionList {
|
||||
ConnectionList() : first(nullptr), last(nullptr) {}
|
||||
Connection *first;
|
||||
Connection *last;
|
||||
QAtomicPointer<Connection> first;
|
||||
QAtomicPointer<Connection> last;
|
||||
};
|
||||
|
||||
struct Sender
|
||||
@ -195,6 +226,22 @@ public:
|
||||
int signal;
|
||||
};
|
||||
|
||||
struct SignalVector : public ConnectionOrSignalVector {
|
||||
quintptr allocated;
|
||||
// ConnectionList signals[]
|
||||
ConnectionList &at(int i)
|
||||
{
|
||||
return reinterpret_cast<ConnectionList *>(this + 1)[i + 1];
|
||||
}
|
||||
const ConnectionList &at(int i) const
|
||||
{
|
||||
return reinterpret_cast<const ConnectionList *>(this + 1)[i + 1];
|
||||
}
|
||||
int count() { return static_cast<int>(allocated); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
This contains the all connections from and to an object.
|
||||
|
||||
@ -210,25 +257,65 @@ public:
|
||||
linked list.
|
||||
*/
|
||||
struct ConnectionData {
|
||||
bool objectDeleted = false; //the QObject owner of this vector has been destroyed while the vector was inUse
|
||||
struct Ref {
|
||||
int _ref = 0;
|
||||
void ref() { ++_ref; }
|
||||
int deref() { return --_ref; }
|
||||
operator int() const { return _ref; }
|
||||
};
|
||||
|
||||
Ref ref;
|
||||
bool dirty = false; //some Connection have been disconnected (their receiver is 0) but not removed from the list yet
|
||||
ConnectionList allsignals;
|
||||
QVector<ConnectionList> signalVector;
|
||||
// the id below is used to avoid activating new connections. When the object gets
|
||||
// deleted it's set to 0, so that signal emission stops
|
||||
QAtomicInteger<uint> currentConnectionId;
|
||||
QAtomicInt ref;
|
||||
QAtomicPointer<SignalVector> signalVector;
|
||||
Connection *senders = nullptr;
|
||||
Sender *currentSender = nullptr; // object currently activating the object
|
||||
QAtomicPointer<Connection> orphaned;
|
||||
|
||||
~ConnectionData()
|
||||
{
|
||||
deleteOrphaned(orphaned.load());
|
||||
SignalVector *v = signalVector.load();
|
||||
if (v)
|
||||
free(v);
|
||||
}
|
||||
|
||||
// must be called on the senders connection data
|
||||
// assumes the senders and receivers lock are held
|
||||
void removeConnection(Connection *c);
|
||||
void cleanOrphanedConnections(QObject *sender)
|
||||
{
|
||||
if (orphaned.load() && ref == 1)
|
||||
cleanOrphanedConnectionsImpl(sender);
|
||||
}
|
||||
void cleanOrphanedConnectionsImpl(QObject *sender);
|
||||
|
||||
ConnectionList &connectionsForSignal(int signal)
|
||||
{
|
||||
return signal < 0 ? allsignals : signalVector[signal];
|
||||
return signalVector.load()->at(signal);
|
||||
}
|
||||
|
||||
void resizeSignalVector(uint size) {
|
||||
SignalVector *vector = this->signalVector.load();
|
||||
if (vector && vector->allocated > size)
|
||||
return;
|
||||
size = (size + 7) & ~7;
|
||||
SignalVector *newVector = reinterpret_cast<SignalVector *>(malloc(sizeof(SignalVector) + (size + 1) * sizeof(ConnectionList)));
|
||||
int start = -1;
|
||||
if (vector) {
|
||||
memcpy(newVector, vector, sizeof(SignalVector) + (vector->allocated + 1) * sizeof(ConnectionList));
|
||||
start = vector->count();
|
||||
}
|
||||
for (int i = start; i < int(size); ++i)
|
||||
newVector->at(i) = ConnectionList();
|
||||
newVector->next = nullptr;
|
||||
newVector->allocated = size;
|
||||
|
||||
signalVector.store(newVector);
|
||||
if (vector) {
|
||||
vector->nextInOrphanList = orphaned.load();
|
||||
orphaned.store(ConnectionOrSignalVector::fromSignalVector(vector));
|
||||
}
|
||||
}
|
||||
int signalVectorCount() const {
|
||||
return signalVector ? signalVector.load()->count() : -1;
|
||||
}
|
||||
|
||||
static void deleteOrphaned(ConnectionOrSignalVector *c);
|
||||
};
|
||||
|
||||
QObjectPrivate(int version = QObjectPrivateVersion);
|
||||
@ -245,7 +332,6 @@ public:
|
||||
QObjectList senderList() const;
|
||||
|
||||
void addConnection(int signal, Connection *c);
|
||||
void cleanConnectionLists();
|
||||
|
||||
static QObjectPrivate *get(QObject *o) {
|
||||
return o->d_func();
|
||||
@ -396,7 +482,26 @@ Q_DECLARE_TYPEINFO(QObjectPrivate::Connection, Q_MOVABLE_TYPE);
|
||||
Q_DECLARE_TYPEINFO(QObjectPrivate::Sender, Q_MOVABLE_TYPE);
|
||||
|
||||
class QSemaphore;
|
||||
class Q_CORE_EXPORT QMetaCallEvent : public QEvent
|
||||
class Q_CORE_EXPORT QAbstractMetaCallEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
QAbstractMetaCallEvent(const QObject *sender, int signalId, QSemaphore *semaphore = nullptr)
|
||||
: QEvent(MetaCall), signalId_(signalId), sender_(sender), semaphore_(semaphore)
|
||||
{}
|
||||
~QAbstractMetaCallEvent();
|
||||
|
||||
virtual void placeMetaCall(QObject *object) = 0;
|
||||
|
||||
inline const QObject *sender() const { return sender_; }
|
||||
inline int signalId() const { return signalId_; }
|
||||
|
||||
private:
|
||||
int signalId_;
|
||||
const QObject *sender_;
|
||||
QSemaphore *semaphore_;
|
||||
};
|
||||
|
||||
class Q_CORE_EXPORT QMetaCallEvent : public QAbstractMetaCallEvent
|
||||
{
|
||||
public:
|
||||
QMetaCallEvent(ushort method_offset, ushort method_relative, QObjectPrivate::StaticMetaCallFunction callFunction , const QObject *sender, int signalId,
|
||||
@ -407,23 +512,18 @@ public:
|
||||
QMetaCallEvent(QtPrivate::QSlotObjectBase *slotObj, const QObject *sender, int signalId,
|
||||
int nargs = 0, int *types = nullptr, void **args = nullptr, QSemaphore *semaphore = nullptr);
|
||||
|
||||
~QMetaCallEvent();
|
||||
~QMetaCallEvent() override;
|
||||
|
||||
inline int id() const { return method_offset_ + method_relative_; }
|
||||
inline const QObject *sender() const { return sender_; }
|
||||
inline int signalId() const { return signalId_; }
|
||||
inline void **args() const { return args_; }
|
||||
|
||||
virtual void placeMetaCall(QObject *object);
|
||||
virtual void placeMetaCall(QObject *object) override;
|
||||
|
||||
private:
|
||||
QtPrivate::QSlotObjectBase *slotObj_;
|
||||
const QObject *sender_;
|
||||
int signalId_;
|
||||
int nargs_;
|
||||
int *types_;
|
||||
void **args_;
|
||||
QSemaphore *semaphore_;
|
||||
QObjectPrivate::StaticMetaCallFunction callFunction_;
|
||||
ushort method_offset_;
|
||||
ushort method_relative_;
|
||||
|
@ -119,13 +119,13 @@ class QString;
|
||||
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_ENUM_IMPL(ENUM) \
|
||||
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
|
||||
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
|
||||
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_ENUM_NS_IMPL(ENUM) \
|
||||
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
|
||||
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
|
||||
@ -340,7 +340,7 @@ struct Q_CORE_EXPORT QMetaObject
|
||||
const char *className() const;
|
||||
const QMetaObject *superClass() const;
|
||||
|
||||
bool inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT;
|
||||
bool inherits(const QMetaObject *metaObject) const noexcept;
|
||||
QObject *cast(QObject *obj) const;
|
||||
const QObject *cast(const QObject *obj) const;
|
||||
|
||||
@ -605,8 +605,8 @@ public:
|
||||
operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; }
|
||||
#endif
|
||||
|
||||
Connection(Connection &&o) Q_DECL_NOTHROW : d_ptr(o.d_ptr) { o.d_ptr = nullptr; }
|
||||
Connection &operator=(Connection &&other) Q_DECL_NOTHROW
|
||||
Connection(Connection &&o) noexcept : d_ptr(o.d_ptr) { o.d_ptr = nullptr; }
|
||||
Connection &operator=(Connection &&other) noexcept
|
||||
{ qSwap(d_ptr, other.d_ptr); return *this; }
|
||||
};
|
||||
|
||||
|
@ -386,8 +386,8 @@ namespace QtPrivate {
|
||||
public:
|
||||
explicit QSlotObjectBase(ImplFn fn) : m_ref(1), m_impl(fn) {}
|
||||
|
||||
inline int ref() Q_DECL_NOTHROW { return m_ref.ref(); }
|
||||
inline void destroyIfLastRef() Q_DECL_NOTHROW
|
||||
inline int ref() noexcept { return m_ref.ref(); }
|
||||
inline void destroyIfLastRef() noexcept
|
||||
{ if (!m_ref.deref()) m_impl(Destroy, this, nullptr, nullptr, nullptr); }
|
||||
|
||||
inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, nullptr, a, &ret); return ret; }
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
/*!
|
||||
\class QSignalMapper
|
||||
\inmodule QtCore
|
||||
\obsolete
|
||||
\obsolete The recommended solution is connecting the signal to a lambda.
|
||||
\brief The QSignalMapper class bundles signals from identifiable senders.
|
||||
|
||||
\ingroup objectmodel
|
||||
|
@ -102,7 +102,7 @@ Q_CORE_EXPORT void QTest::qWait(int ms)
|
||||
int remaining = ms;
|
||||
do {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
|
||||
QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete);
|
||||
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
||||
remaining = timer.remainingTime();
|
||||
if (remaining <= 0)
|
||||
break;
|
||||
|
@ -218,7 +218,7 @@ private:
|
||||
inline int startTimer(int){ return -1;}
|
||||
inline void killTimer(int){}
|
||||
|
||||
static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) Q_DECL_NOTHROW
|
||||
static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) noexcept
|
||||
{ return msecs >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer; }
|
||||
static void singleShotImpl(int msec, Qt::TimerType timerType,
|
||||
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);
|
||||
|
@ -66,6 +66,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
#include "qobject_p.h"
|
||||
|
||||
@ -585,7 +586,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
|
||||
#endif // QT_USE_MMAP
|
||||
|
||||
if (!ok) {
|
||||
d->unmapPointer = new char[d->unmapLength];
|
||||
d->unmapPointer = new (std::nothrow) char[d->unmapLength];
|
||||
if (d->unmapPointer) {
|
||||
file.seek(0);
|
||||
qint64 readResult = file.read(d->unmapPointer, d->unmapLength);
|
||||
|
@ -4282,6 +4282,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p)
|
||||
\sa fromValue()
|
||||
*/
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
/*!
|
||||
\fn template<typename T> QVariant qVariantFromValue(const T &value)
|
||||
\relates QVariant
|
||||
@ -4319,6 +4320,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p)
|
||||
|
||||
\sa QVariant::setValue()
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn template<typename T> T qvariant_cast(const QVariant &value)
|
||||
|
@ -92,9 +92,6 @@ class QUrl;
|
||||
class QVariant;
|
||||
class QVariantComparisonHelper;
|
||||
|
||||
template <typename T>
|
||||
inline QVariant qVariantFromValue(const T &);
|
||||
|
||||
template<typename T>
|
||||
inline T qvariant_cast(const QVariant &);
|
||||
|
||||
@ -204,7 +201,7 @@ class Q_CORE_EXPORT QVariant
|
||||
LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
|
||||
};
|
||||
|
||||
QVariant() Q_DECL_NOTHROW : d() {}
|
||||
QVariant() noexcept : d() {}
|
||||
~QVariant();
|
||||
QVariant(Type type);
|
||||
QVariant(int typeId, const void *copy);
|
||||
@ -271,13 +268,13 @@ class Q_CORE_EXPORT QVariant
|
||||
|
||||
QVariant& operator=(const QVariant &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QVariant(QVariant &&other) Q_DECL_NOTHROW : d(other.d)
|
||||
inline QVariant(QVariant &&other) noexcept : d(other.d)
|
||||
{ other.d = Private(); }
|
||||
inline QVariant &operator=(QVariant &&other) Q_DECL_NOTHROW
|
||||
inline QVariant &operator=(QVariant &&other) noexcept
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
#endif
|
||||
|
||||
inline void swap(QVariant &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
|
||||
inline void swap(QVariant &other) noexcept { qSwap(d, other.d); }
|
||||
|
||||
Type type() const;
|
||||
int userType() const;
|
||||
@ -365,7 +362,7 @@ class Q_CORE_EXPORT QVariant
|
||||
|
||||
template<typename T>
|
||||
static inline QVariant fromValue(const T &value)
|
||||
{ return qVariantFromValue(value); }
|
||||
{ return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); }
|
||||
|
||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
||||
template<typename... Types>
|
||||
@ -390,15 +387,15 @@ class Q_CORE_EXPORT QVariant
|
||||
};
|
||||
struct Private
|
||||
{
|
||||
inline Private() Q_DECL_NOTHROW : type(Invalid), is_shared(false), is_null(true)
|
||||
inline Private() noexcept : type(Invalid), is_shared(false), is_null(true)
|
||||
{ data.ptr = nullptr; }
|
||||
|
||||
// Internal constructor for initialized variants.
|
||||
explicit inline Private(uint variantType) Q_DECL_NOTHROW
|
||||
explicit inline Private(uint variantType) noexcept
|
||||
: type(variantType), is_shared(false), is_null(false)
|
||||
{}
|
||||
|
||||
inline Private(const Private &other) Q_DECL_NOTHROW
|
||||
inline Private(const Private &other) noexcept
|
||||
: data(other.data), type(other.type),
|
||||
is_shared(other.is_shared), is_null(other.is_null)
|
||||
{}
|
||||
@ -516,49 +513,60 @@ public:
|
||||
inline const DataPtr &data_ptr() const { return d; }
|
||||
};
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
template <typename T>
|
||||
QT_DEPRECATED_X("Use QVariant::fromValue() instead.")
|
||||
inline QVariant qVariantFromValue(const T &t)
|
||||
{
|
||||
return QVariant(qMetaTypeId<T>(), &t, QTypeInfo<T>::isPointer);
|
||||
return QVariant::fromValue(t);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline QVariant qVariantFromValue(const QVariant &t) { return t; }
|
||||
|
||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
||||
template <>
|
||||
inline QVariant qVariantFromValue(const std::monostate &) { return QVariant(); }
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
QT_DEPRECATED_X("Use QVariant::setValue() instead.")
|
||||
inline void qVariantSetValue(QVariant &v, const T &t)
|
||||
{
|
||||
//if possible we reuse the current QVariant private
|
||||
const uint type = qMetaTypeId<T>();
|
||||
QVariant::Private &d = v.data_ptr();
|
||||
if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
|
||||
d.type = type;
|
||||
d.is_null = false;
|
||||
T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
|
||||
if (QTypeInfo<T>::isComplex)
|
||||
old->~T();
|
||||
new (old) T(t); //call the copy constructor
|
||||
} else {
|
||||
v = QVariant(type, &t, QTypeInfo<T>::isPointer);
|
||||
}
|
||||
v.setValue(t);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<>
|
||||
inline QVariant QVariant::fromValue(const QVariant &value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void qVariantSetValue<QVariant>(QVariant &v, const QVariant &t)
|
||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
||||
template<>
|
||||
inline QVariant QVariant::fromValue(const std::monostate &)
|
||||
{
|
||||
v = t;
|
||||
return QVariant();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline bool QVariant::isValid() const { return d.type != Invalid; }
|
||||
|
||||
template<typename T>
|
||||
inline void QVariant::setValue(const T &avalue)
|
||||
{ qVariantSetValue(*this, avalue); }
|
||||
{
|
||||
// If possible we reuse the current QVariant private.
|
||||
const uint type = qMetaTypeId<T>();
|
||||
if (isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
|
||||
d.type = type;
|
||||
d.is_null = false;
|
||||
T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
|
||||
if (QTypeInfo<T>::isComplex)
|
||||
old->~T();
|
||||
new (old) T(avalue); // call the copy constructor
|
||||
} else {
|
||||
*this = QVariant(type, &avalue, QTypeInfo<T>::isPointer);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void QVariant::setValue(const QVariant &avalue)
|
||||
{
|
||||
*this = avalue;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant& p);
|
||||
|
@ -21,5 +21,5 @@ qtConfig(mimetype) {
|
||||
mimetypes/qmimeglobpattern.cpp \
|
||||
mimetypes/qmimeprovider.cpp
|
||||
|
||||
RESOURCES += mimetypes/mimetypes.qrc
|
||||
qtConfig(mimetype-database): RESOURCES += mimetypes/mimetypes.qrc
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void swap(QMimeGlobPattern &other) Q_DECL_NOTHROW
|
||||
void swap(QMimeGlobPattern &other) noexcept
|
||||
{
|
||||
qSwap(m_pattern, other.m_pattern);
|
||||
qSwap(m_mimeType, other.m_mimeType);
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
QMimeMagicRule(const QString &typeStr, const QByteArray &value, const QString &offsets,
|
||||
const QByteArray &mask, QString *errorString);
|
||||
|
||||
void swap(QMimeMagicRule &other) Q_DECL_NOTHROW
|
||||
void swap(QMimeMagicRule &other) noexcept
|
||||
{
|
||||
qSwap(m_type, other.m_type);
|
||||
qSwap(m_value, other.m_value);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user