Merge "Merge remote-tracking branch 'origin/5.15' into dev"
This commit is contained in:
commit
deee560954
@ -281,6 +281,7 @@ Gui, printing, widget options:
|
||||
es2 (default on Windows), desktop (default on Unix),
|
||||
dynamic (Windows only)
|
||||
-opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto]
|
||||
-egl ................. Enable EGL support [auto]
|
||||
-angle ............... Use bundled ANGLE to support OpenGL ES 2.0 [auto]
|
||||
(Windows only)
|
||||
-combined-angle-lib .. Merge LibEGL and LibGLESv2 into LibANGLE (Windows only)
|
||||
|
@ -843,9 +843,6 @@ defineTest(qtConfOutput_preparePaths) {
|
||||
addConfStr($$[QMAKE_SPEC])
|
||||
|
||||
$${currentConfig}.output.qconfigSource = \
|
||||
"/* Installation date */" \
|
||||
"static const char qt_configure_installation [12+11] = \"qt_instdate=2012-12-20\";" \
|
||||
"" \
|
||||
"/* Installation Info */" \
|
||||
"static const char qt_configure_prefix_path_str [12+256] = \"qt_prfxpath=$$config.input.prefix\";" \
|
||||
"$${LITERAL_HASH}ifdef QT_BUILD_QMAKE" \
|
||||
|
@ -176,16 +176,16 @@
|
||||
|
||||
\snippet draganddrop/dropsite/dropsitewindow.cpp constructor part3
|
||||
|
||||
Two QPushButton objects, \c clearButton and \c quitButton, are instantiated
|
||||
and added to \c buttonBox - a QDialogButtonBox object. We use
|
||||
QDialogButtonBox here to ensure that the push buttons are presented in a
|
||||
Three QPushButton objects, \c clearButton, \c copyButton, and \c quitButton,
|
||||
are instantiated and added to \c buttonBox - a QDialogButtonBox object. We
|
||||
use QDialogButtonBox here to ensure that the push buttons are presented in a
|
||||
layout that conforms to the platform's style.
|
||||
|
||||
\snippet draganddrop/dropsite/dropsitewindow.cpp constructor part4
|
||||
|
||||
The \l{QPushButton::clicked()}{clicked()} signals for \c quitButton and
|
||||
\c clearButton are connected to \l{QWidget::close()}{close()} and
|
||||
\c clear(), respectively.
|
||||
The \l{QPushButton::clicked()}{clicked()} signals for \c copyButton,
|
||||
\c clearButton, and \c quitButton are connected to \c copy(),
|
||||
\c clear() and \l{QWidget::close()}{close()}, respectively.
|
||||
|
||||
For the layout, we use a QVBoxLayout, \c mainLayout, to arrange our widgets
|
||||
vertically. We also set the window title to "Drop Site" and the minimum
|
||||
|
@ -82,14 +82,21 @@ DropSiteWindow::DropSiteWindow()
|
||||
|
||||
//! [constructor part4]
|
||||
clearButton = new QPushButton(tr("Clear"));
|
||||
copyButton = new QPushButton(tr("Copy"));
|
||||
quitButton = new QPushButton(tr("Quit"));
|
||||
|
||||
buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
|
||||
buttonBox->addButton(copyButton, QDialogButtonBox::ActionRole);
|
||||
#if !QT_CONFIG(clipboard)
|
||||
copyButton->setVisible(false);
|
||||
#endif
|
||||
|
||||
buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
|
||||
|
||||
connect(quitButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||
connect(clearButton, &QAbstractButton::clicked, dropArea, &DropArea::clear);
|
||||
connect(copyButton, &QAbstractButton::clicked, this, &DropSiteWindow::copy);
|
||||
//! [constructor part4]
|
||||
|
||||
//! [constructor part5]
|
||||
@ -108,6 +115,7 @@ DropSiteWindow::DropSiteWindow()
|
||||
void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
|
||||
{
|
||||
formatsTable->setRowCount(0);
|
||||
copyButton->setEnabled(false);
|
||||
if (!mimeData)
|
||||
return;
|
||||
//! [updateFormatsTable() part1]
|
||||
@ -145,5 +153,18 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
|
||||
}
|
||||
|
||||
formatsTable->resizeColumnToContents(0);
|
||||
#if QT_CONFIG(clipboard)
|
||||
copyButton->setEnabled(formatsTable->rowCount() > 0);
|
||||
#endif
|
||||
}
|
||||
//! [updateFormatsTable() part4]
|
||||
|
||||
void DropSiteWindow::copy()
|
||||
{
|
||||
#if QT_CONFIG(clipboard)
|
||||
QString text;
|
||||
for (int row = 0, rowCount = formatsTable->rowCount(); row < rowCount; ++row)
|
||||
text += formatsTable->item(row, 0)->text() + ": " + formatsTable->item(row, 1)->text() + '\n';
|
||||
QGuiApplication::clipboard()->setText(text);
|
||||
#endif
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void updateFormatsTable(const QMimeData *mimeData);
|
||||
void copy();
|
||||
|
||||
private:
|
||||
DropArea *dropArea;
|
||||
@ -79,6 +80,7 @@ private:
|
||||
QTableWidget *formatsTable;
|
||||
|
||||
QPushButton *clearButton;
|
||||
QPushButton *copyButton;
|
||||
QPushButton *quitButton;
|
||||
QDialogButtonBox *buttonBox;
|
||||
};
|
||||
|
@ -270,7 +270,7 @@ xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identif
|
||||
QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
|
||||
|
||||
!macx-xcode {
|
||||
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) $$QMAKE_ARGS
|
||||
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
|
||||
generate_xcode_project.target = xcodeproj
|
||||
QMAKE_EXTRA_VARIABLES += _PRO_FILE_
|
||||
QMAKE_EXTRA_TARGETS += generate_xcode_project
|
||||
|
@ -1,2 +1,6 @@
|
||||
# bitcode (release mode) is incompatible with splitting sections.
|
||||
!bitcode|!release: load(gc_binaries)
|
||||
# We have to explicitly exclude Xcode, as that supports both debug
|
||||
# and release builds in the same project. Xcode already has a settting
|
||||
# for dead code stripping which is enabled by default, so we'll still
|
||||
# strip any libraries build with split sections.
|
||||
!bitcode|if(!macx-xcode:!release): load(gc_binaries)
|
||||
|
@ -6,16 +6,6 @@ exists($$QMAKE_QT_CONFIG) {
|
||||
qtConfig(thread) {
|
||||
|
||||
EMCC_THREAD_LFLAGS += -s USE_PTHREADS=1
|
||||
# Hardcode wasm memory size. Emscripten does not currently support memory growth
|
||||
# (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size
|
||||
# at build time. Further, browsers limit the maximum initial memory size to 1GB.
|
||||
TOTAL_MEMORY = 1GB
|
||||
!isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
||||
TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY
|
||||
}
|
||||
|
||||
message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY)
|
||||
EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY
|
||||
|
||||
# Create worker threads at startup. This is supposed to be an optimization,
|
||||
# however exceeding the pool size has been obesverved to hang the application.
|
||||
@ -29,6 +19,20 @@ exists($$QMAKE_QT_CONFIG) {
|
||||
} else {
|
||||
EMCC_THREAD_LFLAGS += -s ALLOW_MEMORY_GROWTH=1
|
||||
}
|
||||
|
||||
qtConfig(thread) | !isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
||||
|
||||
# Hardcode wasm memory size. Emscripten does not currently support memory growth
|
||||
# (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size
|
||||
# at build time. Further, browsers limit the maximum initial memory size to 1GB.
|
||||
# QMAKE_WASM_TOTAL_MEMORY must be a multiple of 64KB
|
||||
TOTAL_MEMORY = 1GB
|
||||
!isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
||||
TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY
|
||||
}
|
||||
message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY)
|
||||
EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY
|
||||
}
|
||||
QMAKE_LFLAGS += $$EMCC_THREAD_LFLAGS
|
||||
QMAKE_LFLAGS_DEBUG += $$EMCC_THREAD_LFLAGS
|
||||
QMAKE_CFLAGS += $$EMCC_THREAD_LFLAGS
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QString project_builtin_regx() //calculate the builtin regular expression..
|
||||
static QString project_builtin_regx() //calculate the builtin regular expression..
|
||||
{
|
||||
QString ret;
|
||||
QStringList builtin_exts;
|
||||
|
@ -1568,21 +1568,12 @@ bool VCLinkerTool::parseOption(const char* option)
|
||||
const char* str = option+6;
|
||||
if (*str == 'S')
|
||||
ShowProgress = linkProgressAll;
|
||||
#ifndef Q_OS_WIN
|
||||
else if (strncasecmp(str, "pginstrument", 12))
|
||||
else if (qstricmp(str, "pginstrument") == 0)
|
||||
LinkTimeCodeGeneration = optLTCGInstrument;
|
||||
else if (strncasecmp(str, "pgoptimize", 10))
|
||||
else if (qstricmp(str, "pgoptimize") == 0)
|
||||
LinkTimeCodeGeneration = optLTCGOptimize;
|
||||
else if (strncasecmp(str, "pgupdate", 8 ))
|
||||
else if (qstricmp(str, "pgupdate") == 0)
|
||||
LinkTimeCodeGeneration = optLTCGUpdate;
|
||||
#else
|
||||
else if (_stricmp(str, "pginstrument"))
|
||||
LinkTimeCodeGeneration = optLTCGInstrument;
|
||||
else if (_stricmp(str, "pgoptimize"))
|
||||
LinkTimeCodeGeneration = optLTCGOptimize;
|
||||
else if (_stricmp(str, "pgupdate"))
|
||||
LinkTimeCodeGeneration = optLTCGUpdate;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
AdditionalOptions.append(option);
|
||||
|
@ -242,6 +242,39 @@ static int doLink(int argc, char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
static bool setFilePermissions(QFile &file, QFileDevice::Permissions permissions)
|
||||
{
|
||||
if (file.setPermissions(permissions))
|
||||
return true;
|
||||
fprintf(stderr, "Error setting permissions on %s: %s\n",
|
||||
qPrintable(file.fileName()), qPrintable(file.errorString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool copyFileTimes(QFile &targetFile, const QString &sourceFilePath,
|
||||
bool mustEnsureWritability, QString *errorString)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
bool mustRestorePermissions = false;
|
||||
QFileDevice::Permissions targetPermissions;
|
||||
if (mustEnsureWritability) {
|
||||
targetPermissions = targetFile.permissions();
|
||||
if (!targetPermissions.testFlag(QFileDevice::WriteUser)) {
|
||||
mustRestorePermissions = true;
|
||||
if (!setFilePermissions(targetFile, targetPermissions | QFileDevice::WriteUser))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!IoUtils::touchFile(targetFile.fileName(), sourceFilePath, errorString))
|
||||
return false;
|
||||
#ifdef Q_OS_WIN
|
||||
if (mustRestorePermissions && !setFilePermissions(targetFile, targetPermissions))
|
||||
return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static int installFile(const QString &source, const QString &target, bool exe = false,
|
||||
bool preservePermissions = false)
|
||||
{
|
||||
@ -270,18 +303,15 @@ static int installFile(const QString &source, const QString &target, bool exe =
|
||||
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()));
|
||||
if (!setFilePermissions(targetFile, targetPermissions))
|
||||
return 3;
|
||||
}
|
||||
|
||||
// Copy file times
|
||||
QString error;
|
||||
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
|
||||
if (!copyFileTimes(targetFile, sourceFile.fileName(), preservePermissions, &error)) {
|
||||
fprintf(stderr, "%s", qPrintable(error));
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,6 @@ static QString detectProjectFile(const QString &path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString project_builtin_regx();
|
||||
bool usage(const char *a0)
|
||||
{
|
||||
fprintf(stdout, "Usage: %s [mode] [options] [files]\n"
|
||||
@ -133,9 +132,9 @@ bool usage(const char *a0)
|
||||
"\n"
|
||||
"Mode:\n"
|
||||
" -project Put qmake into project file generation mode%s\n"
|
||||
" In this mode qmake interprets files as files to\n"
|
||||
" be built,\n"
|
||||
" defaults to %s\n"
|
||||
" In this mode qmake interprets [files] as files to\n"
|
||||
" be added to the .pro file. By default, all files with\n"
|
||||
" known source extensions are added.\n"
|
||||
" Note: The created .pro file probably will \n"
|
||||
" need to be edited. For example add the QT variable to \n"
|
||||
" specify what modules are required.\n"
|
||||
@ -183,7 +182,7 @@ bool usage(const char *a0)
|
||||
" -nomoc Don't generate moc targets [makefile mode only]\n"
|
||||
" -nopwd Don't look for files in pwd [project mode only]\n"
|
||||
,a0,
|
||||
default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", project_builtin_regx().toLatin1().constData(),
|
||||
default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "",
|
||||
default_mode(a0) == Option::QMAKE_GENERATE_MAKEFILE ? " (default)" : ""
|
||||
);
|
||||
return false;
|
||||
|
@ -42,16 +42,17 @@
|
||||
#include "qtextcodec_p.h"
|
||||
#include "qutfcodec_p.h"
|
||||
#include "qlatincodec_p.h"
|
||||
#if QT_CONFIG(codecs)
|
||||
#include "qtsciicodec_p.h"
|
||||
#include "qisciicodec_p.h"
|
||||
#endif
|
||||
#include "qsimplecodec_p.h"
|
||||
#include "private/qcoreglobaldata_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
#include "unicode/ucnv.h"
|
||||
|
||||
#if QT_CONFIG(codecs)
|
||||
#include "qtsciicodec_p.h"
|
||||
#include "qisciicodec_p.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
typedef QList<QTextCodec*>::ConstIterator TextCodecListConstIt;
|
||||
|
@ -884,7 +884,7 @@
|
||||
},
|
||||
"datestring": {
|
||||
"label": "QDate/QTime/QDateTime",
|
||||
"purpose": "Provides convertion between dates and strings.",
|
||||
"purpose": "Provides conversion between dates and strings.",
|
||||
"section": "Data structures",
|
||||
"condition": "features.textdate",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
|
@ -274,7 +274,7 @@ QLibraryInfo::licensedProducts()
|
||||
QDate
|
||||
QLibraryInfo::buildDate()
|
||||
{
|
||||
return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate);
|
||||
return QDate::fromString(QString::fromLatin1("2012-12-20"), Qt::ISODate);
|
||||
}
|
||||
#endif
|
||||
#endif // datestring
|
||||
|
@ -1910,12 +1910,14 @@ void qErrnoWarning(const char *msg, ...)
|
||||
{
|
||||
// qt_error_string() will allocate anyway, so we don't have
|
||||
// to be careful here (like we do in plain qWarning())
|
||||
QString error_string = qt_error_string(-1); // before vasprintf changes errno/GetLastError()
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
QString buf = QString::vasprintf(msg, ap);
|
||||
va_end(ap);
|
||||
|
||||
buf += QLatin1String(" (") + qt_error_string(-1) + QLatin1Char(')');
|
||||
buf += QLatin1String(" (") + error_string + QLatin1Char(')');
|
||||
QMessageLogContext context;
|
||||
qt_message_output(QtCriticalMsg, context, buf);
|
||||
}
|
||||
|
@ -70,14 +70,16 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
|
||||
QLoggingCategory represents a certain logging category - identified by a
|
||||
string - at runtime. A category can be configured to enable or disable
|
||||
logging of messages per message type. Whether a message type is enabled or
|
||||
not can be checked with the \l isDebugEnabled(), \l isInfoEnabled(),
|
||||
\l isWarningEnabled(), and \l isCriticalEnabled() methods.
|
||||
logging of messages per message type.
|
||||
|
||||
All objects are meant to be configured by a common registry (see also
|
||||
\l{Configuring Categories}). Different objects can also represent the same
|
||||
category. It is therefore not recommended to export objects across module
|
||||
boundaries, nor to manipulate the objects directly, nor to inherit from
|
||||
To check whether a message type is enabled or not, use one of these methods:
|
||||
\l isDebugEnabled(), \l isInfoEnabled(), \l isWarningEnabled(), and
|
||||
\l isCriticalEnabled().
|
||||
|
||||
All objects are meant to be configured by a common registry, as described in
|
||||
\l{Configuring Categories}. Different objects can also represent the same
|
||||
category. Therefore, it's \b{not} recommended to export objects across
|
||||
module boundaries, to manipulate the objects directly, or to inherit from
|
||||
QLoggingCategory.
|
||||
|
||||
\section1 Creating Category Objects
|
||||
@ -87,17 +89,17 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
|
||||
\snippet qloggingcategory/main.cpp 1
|
||||
|
||||
\note Category names are free text. However, to allow easy configuration
|
||||
of the categories using \l{Logging Rules} the names should follow some rules:
|
||||
Category names are free text; to configure categories using \l{Logging Rules}, their
|
||||
names should follow this convention:
|
||||
\list
|
||||
\li Use letters and numbers only.
|
||||
\li Further structure categories into common areas by using dots.
|
||||
\li Avoid the category names \c{debug}, \c{info}, \c{warning}, and \c{critical}.
|
||||
\li Category names starting with \c{qt} are reserved for Qt modules.
|
||||
\li Use dots to further structure categories into common areas.
|
||||
\li Avoid the category names: \c{debug}, \c{info}, \c{warning}, and \c{critical}.
|
||||
\li Category names with the \c{qt} prefix are solely reserved for Qt modules.
|
||||
\endlist
|
||||
|
||||
QLoggingCategory objects implicitly defined by Q_LOGGING_CATEGORY()
|
||||
are created on first use in a thread-safe manner.
|
||||
QLoggingCategory objects that are implicitly defined by Q_LOGGING_CATEGORY()
|
||||
are created on first use, in a thread-safe manner.
|
||||
|
||||
\section1 Checking Category Configuration
|
||||
|
||||
@ -105,8 +107,8 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
\l isWarningEnabled(), \l isCriticalEnabled(), as well as \l isEnabled()
|
||||
to check whether messages for the given message type should be logged.
|
||||
|
||||
\note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments
|
||||
from being evaluated if the respective message types are not enabled for the
|
||||
The qCDebug(), qCWarning(), and qCCritical() macros prevent arguments from
|
||||
being evaluated if the respective message types are not enabled for the
|
||||
category, so explicit checking is not needed:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 4
|
||||
@ -119,28 +121,27 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
|
||||
\snippet qloggingcategory/main.cpp 5
|
||||
|
||||
will log messages of type \c QtWarningMsg, \c QtCriticalMsg, \c QtFatalMsg, but will
|
||||
ignore messages of type \c QtDebugMsg and \c QtInfoMsg.
|
||||
logs messages of type \c QtWarningMsg, \c QtCriticalMsg, \c QtFatalMsg, but
|
||||
ignores messages of type \c QtDebugMsg and \c QtInfoMsg.
|
||||
|
||||
If no argument is passed, all messages will be logged.
|
||||
If no argument is passed, all messages are logged.
|
||||
|
||||
\section1 Configuring Categories
|
||||
|
||||
The default configuration of categories can be overridden either by setting logging
|
||||
rules, or by installing a custom filter.
|
||||
You can override the default configuration for categories either by setting
|
||||
logging rules, or by installing a custom filter.
|
||||
|
||||
\section2 Logging Rules
|
||||
|
||||
Logging rules allow logging for categories to be enabled or disabled in a
|
||||
flexible way. Rules are specified in text, where every line must have the
|
||||
format
|
||||
Logging rules let you enable or disable logging for categories in a flexible
|
||||
way. Rules are specified in text, where every line must have the format:
|
||||
|
||||
\snippet code/src_corelib_io_qloggingcategory.cpp 0
|
||||
|
||||
\c <category> is the name of the category, potentially with \c{*} as a
|
||||
wildcard symbol as the first or last character (or at both positions).
|
||||
The optional \c <type> must be either \c debug, \c info, \c warning, or \c critical.
|
||||
Lines that do not fit this scheme are ignored.
|
||||
wildcard symbol for the first or last character; or at both positions.
|
||||
The optional \c <type> must be \c debug, \c info, \c warning, or \c critical.
|
||||
Lines that don't fit this scheme are ignored.
|
||||
|
||||
Rules are evaluated in text order, from first to last. That is, if two rules
|
||||
apply to a category/type, the rule that comes later is applied.
|
||||
@ -149,47 +150,37 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
|
||||
\snippet code/src_corelib_io_qloggingcategory.cpp 1
|
||||
|
||||
Since Qt 5.3, logging rules are also
|
||||
automatically loaded from the \c [Rules] section of a logging
|
||||
configuration file. Such configuration files are looked up in the QtProject
|
||||
configuration directory, or explicitly set in a \c QT_LOGGING_CONF
|
||||
environment variable:
|
||||
Logging rules are automatically loaded from the \c [Rules] section in a logging
|
||||
configuration file. These configuration files are looked up in the QtProject
|
||||
configuration directory, or explicitly set in a \c QT_LOGGING_CONF environment
|
||||
variable:
|
||||
|
||||
\snippet code/src_corelib_io_qloggingcategory.cpp 2
|
||||
|
||||
Since Qt 5.3, logging rules can also be specified in a \c QT_LOGGING_RULES
|
||||
environment variable. And since Qt 5.6, multiple rules can also be
|
||||
separated by semicolons:
|
||||
Logging rules can also be specified in a \c QT_LOGGING_RULES environment variable;
|
||||
multiple rules can also be separated by semicolons:
|
||||
|
||||
\snippet code/src_corelib_io_qloggingcategory.cpp 3
|
||||
|
||||
Rules set by \l setFilterRules() take precedence over rules specified
|
||||
in the QtProject configuration directory, and can, in turn, be
|
||||
overwritten by rules from the configuration file specified by
|
||||
\c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES.
|
||||
Rules set by \l setFilterRules() take precedence over rules specified in the
|
||||
QtProject configuration directory. In turn, these rules can be overwritten by those
|
||||
from the configuration file specified by \c QT_LOGGING_CONF, and those set by
|
||||
\c QT_LOGGING_RULES.
|
||||
|
||||
Order of evaluation:
|
||||
\list
|
||||
\li [QLibraryInfo::DataPath]/qtlogging.ini
|
||||
\li QtProject/qtlogging.ini
|
||||
\li \l setFilterRules()
|
||||
\li \c QT_LOGGING_CONF
|
||||
\li \c QT_LOGGING_RULES
|
||||
The order of evaluation is as follows:
|
||||
\list 1
|
||||
\li [QLibraryInfo::DataPath]/qtlogging.ini
|
||||
\li QtProject/qtlogging.ini
|
||||
\li \l setFilterRules()
|
||||
\li \c QT_LOGGING_CONF
|
||||
\li \c QT_LOGGING_RULES
|
||||
\endlist
|
||||
|
||||
The \c QtProject/qtlogging.ini file is looked up in all directories returned
|
||||
by QStandardPaths::GenericConfigLocation, e.g.
|
||||
by QStandardPaths::GenericConfigLocation.
|
||||
|
||||
\list
|
||||
\li on \macos and iOS: \c ~/Library/Preferences
|
||||
\li on Unix: \c ~/.config, \c /etc/xdg
|
||||
\li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,
|
||||
\l QCoreApplication::applicationDirPath(),
|
||||
QCoreApplication::applicationDirPath() + \c "/data"
|
||||
\endlist
|
||||
|
||||
Set the \c QT_LOGGING_DEBUG environment variable to see from where
|
||||
logging rules are loaded.
|
||||
Set the \c QT_LOGGING_DEBUG environment variable to find out where you logging
|
||||
rules are loaded from.
|
||||
|
||||
\section2 Installing a Custom Filter
|
||||
|
||||
@ -211,7 +202,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
||||
|
||||
If \a category is \c{0}, the category name is changed to \c "default".
|
||||
|
||||
Note that \a category must be kept valid during the lifetime of this object.
|
||||
\note \a category must be kept valid during the lifetime of this object.
|
||||
*/
|
||||
QLoggingCategory::QLoggingCategory(const char *category)
|
||||
: d(nullptr),
|
||||
@ -226,7 +217,7 @@ QLoggingCategory::QLoggingCategory(const char *category)
|
||||
|
||||
If \a category is \c{0}, the category name is changed to \c "default".
|
||||
|
||||
Note that \a category must be kept valid during the lifetime of this object.
|
||||
\note \a category must be kept valid during the lifetime of this object.
|
||||
|
||||
\since 5.4
|
||||
*/
|
||||
@ -251,7 +242,7 @@ void QLoggingCategory::init(const char *category, QtMsgType severityLevel)
|
||||
}
|
||||
|
||||
/*!
|
||||
Destructs a QLoggingCategory object.
|
||||
Destroys a QLoggingCategory object.
|
||||
*/
|
||||
QLoggingCategory::~QLoggingCategory()
|
||||
{
|
||||
@ -268,24 +259,24 @@ QLoggingCategory::~QLoggingCategory()
|
||||
/*!
|
||||
\fn bool QLoggingCategory::isDebugEnabled() const
|
||||
|
||||
Returns \c true if debug messages should be shown for this category.
|
||||
Returns \c false otherwise.
|
||||
Returns \c true if debug messages should be shown for this category;
|
||||
\c false otherwise.
|
||||
|
||||
\note The \l qCDebug() macro already does this check before executing any
|
||||
code. However, calling this method may be useful to avoid
|
||||
expensive generation of data that is only used for debug output.
|
||||
\note The \l qCDebug() macro already does this check before running any
|
||||
code. However, calling this method may be useful to avoid the
|
||||
expensive generation of data for debug output only.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool QLoggingCategory::isInfoEnabled() const
|
||||
|
||||
Returns \c true if informational messages should be shown for this category.
|
||||
Returns \c false otherwise.
|
||||
Returns \c true if informational messages should be shown for this category;
|
||||
\c false otherwise.
|
||||
|
||||
\note The \l qCInfo() macro already does this check before executing any
|
||||
code. However, calling this method may be useful to avoid
|
||||
expensive generation of data that is only used for debug output.
|
||||
code. However, calling this method may be useful to avoid the
|
||||
expensive generation of data for debug output only.
|
||||
|
||||
\since 5.5
|
||||
*/
|
||||
@ -294,28 +285,28 @@ QLoggingCategory::~QLoggingCategory()
|
||||
/*!
|
||||
\fn bool QLoggingCategory::isWarningEnabled() const
|
||||
|
||||
Returns \c true if warning messages should be shown for this category.
|
||||
Returns \c false otherwise.
|
||||
Returns \c true if warning messages should be shown for this category;
|
||||
\c false otherwise.
|
||||
|
||||
\note The \l qCWarning() macro already does this check before executing any
|
||||
code. However, calling this method may be useful to avoid
|
||||
expensive generation of data that is only used for debug output.
|
||||
code. However, calling this method may be useful to avoid the
|
||||
expensive generation of data for debug output only.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QLoggingCategory::isCriticalEnabled() const
|
||||
|
||||
Returns \c true if critical messages should be shown for this category.
|
||||
Returns \c false otherwise.
|
||||
Returns \c true if critical messages should be shown for this category;
|
||||
\c false otherwise.
|
||||
|
||||
\note The \l qCCritical() macro already does this check before executing any
|
||||
code. However, calling this method may be useful to avoid
|
||||
expensive generation of data that is only used for debug output.
|
||||
code. However, calling this method may be useful to avoid the
|
||||
expensive generation of data for debug output only.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns \c true if a message of type \a msgtype for the category should be
|
||||
shown. Returns \c false otherwise.
|
||||
shown; \c false otherwise.
|
||||
*/
|
||||
bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
|
||||
{
|
||||
@ -332,11 +323,11 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
|
||||
/*!
|
||||
Changes the message type \a type for the category to \a enable.
|
||||
|
||||
This method is meant to be used only from inside a filter
|
||||
installed by \l installFilter(). See \l {Configuring Categories} for
|
||||
an overview on how to configure categories globally.
|
||||
This method is meant for use only from inside a filter installed with
|
||||
\l installFilter(). For an overview on how to configure categories globally,
|
||||
see \l {Configuring Categories}.
|
||||
|
||||
\note \c QtFatalMsg cannot be changed. It will always remain \c true.
|
||||
\note \c QtFatalMsg cannot be changed; it will always remain \c true.
|
||||
*/
|
||||
void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
|
||||
{
|
||||
@ -359,28 +350,25 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
|
||||
/*!
|
||||
\fn QLoggingCategory &QLoggingCategory::operator()()
|
||||
|
||||
Returns the object itself. This allows both a QLoggingCategory variable, and
|
||||
a factory method returning a QLoggingCategory, to be used in \l qCDebug(),
|
||||
\l qCWarning(), \l qCCritical() macros.
|
||||
Returns the object itself. This allows for both: a QLoggingCategory variable, and
|
||||
a factory method that returns a QLoggingCategory, to be used in \l qCDebug(),
|
||||
\l qCWarning(), or \l qCCritical() macros.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QLoggingCategory &QLoggingCategory::operator()() const
|
||||
|
||||
Returns the object itself. This allows both a QLoggingCategory variable, and
|
||||
a factory method returning a QLoggingCategory, to be used in \l qCDebug(),
|
||||
\l qCWarning(), \l qCCritical() macros.
|
||||
Returns the object itself. This allows for both: a QLoggingCategory variable, and
|
||||
a factory method that returns a QLoggingCategory, to be used in \l qCDebug(),
|
||||
\l qCWarning(), or \l qCCritical() macros.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns a pointer to the global category \c "default" that
|
||||
is used e.g. by qDebug(), qInfo(), qWarning(), qCritical(), qFatal().
|
||||
Returns a pointer to the global category \c "default" that is used, for
|
||||
example, by qDebug(), qInfo(), qWarning(), qCritical(), or qFatal().
|
||||
|
||||
\note The returned pointer may be null during destruction of
|
||||
static objects.
|
||||
|
||||
\note Ownership of the category is not transferred, do not
|
||||
\c delete the returned pointer.
|
||||
\note The pointer returned may be null during destruction of static objects.
|
||||
Also, don't \c delete this pointer, as ownership of the category isn't transferred.
|
||||
|
||||
*/
|
||||
QLoggingCategory *QLoggingCategory::defaultCategory()
|
||||
@ -391,8 +379,7 @@ QLoggingCategory *QLoggingCategory::defaultCategory()
|
||||
/*!
|
||||
\typedef QLoggingCategory::CategoryFilter
|
||||
|
||||
This is a typedef for a pointer to a function with the following
|
||||
signature:
|
||||
This is a typedef for a pointer to a function with the following signature:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 20
|
||||
|
||||
@ -408,14 +395,13 @@ QLoggingCategory *QLoggingCategory::defaultCategory()
|
||||
filter is free to change the respective category configuration with
|
||||
\l setEnabled().
|
||||
|
||||
The filter might be called from different threads, but never concurrently.
|
||||
The filter shall not call any static functions of QLoggingCategory.
|
||||
When you define your filter, note that it can be called from different threads; but never
|
||||
concurrently. This filter cannot call any static functions from QLoggingCategory.
|
||||
|
||||
Example:
|
||||
\snippet qloggingcategory/main.cpp 21
|
||||
|
||||
An alternative way of configuring the default filter is via
|
||||
\l setFilterRules().
|
||||
Alternatively, you can configure the default filter via \l setFilterRules().
|
||||
*/
|
||||
QLoggingCategory::CategoryFilter
|
||||
QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)
|
||||
@ -425,15 +411,15 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)
|
||||
|
||||
/*!
|
||||
Configures which categories and message types should be enabled through a
|
||||
a set of \a rules.
|
||||
set of \a rules.
|
||||
|
||||
Example:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 2
|
||||
|
||||
\note The rules might be ignored if a custom category filter is installed
|
||||
with \l installFilter(), or if the user defined \c QT_LOGGING_CONF or \c QT_LOGGING_RULES
|
||||
environment variable.
|
||||
with \l installFilter(), or if the user has defined the \c QT_LOGGING_CONF
|
||||
or the \c QT_LOGGING_RULES environment variable.
|
||||
*/
|
||||
void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
{
|
||||
@ -446,7 +432,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.2
|
||||
|
||||
Returns an output stream for debug messages in the logging category
|
||||
Returns an output stream for debug messages in the logging category,
|
||||
\a category.
|
||||
|
||||
The macro expands to code that checks whether
|
||||
@ -457,8 +443,8 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
|
||||
\snippet qloggingcategory/main.cpp 10
|
||||
|
||||
\note Arguments are not processed if debug output for the category is not
|
||||
enabled, so do not rely on any side effects.
|
||||
\note Arguments aren't processed if the debug output for that \a category is not
|
||||
enabled, so don't rely on any side effects.
|
||||
|
||||
\sa qDebug()
|
||||
*/
|
||||
@ -469,16 +455,16 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.3
|
||||
|
||||
Logs a debug message \a message in the logging category \a category.
|
||||
\a message might contain place holders that are replaced by additional
|
||||
arguments, similar to the C printf() function.
|
||||
Logs a debug message, \a message, in the logging category, \a category.
|
||||
\a message may contain place holders to be replaced by additional arguments,
|
||||
similar to the C printf() function.
|
||||
|
||||
Example:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 13
|
||||
|
||||
\note Arguments might not be processed if debug output for the category is
|
||||
not enabled, so do not rely on any side effects.
|
||||
\note Arguments aren't processed if the debug output for that \a category is not
|
||||
enabled, so don't rely on any side effects.
|
||||
|
||||
\sa qDebug()
|
||||
*/
|
||||
@ -489,7 +475,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.5
|
||||
|
||||
Returns an output stream for informational messages in the logging category
|
||||
Returns an output stream for informational messages in the logging category,
|
||||
\a category.
|
||||
|
||||
The macro expands to code that checks whether
|
||||
@ -500,8 +486,8 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
|
||||
\snippet qloggingcategory/main.cpp qcinfo_stream
|
||||
|
||||
\note Arguments are not processed if debug output for the category is not
|
||||
enabled, so do not rely on any side effects.
|
||||
\note If the debug output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qInfo()
|
||||
*/
|
||||
@ -512,16 +498,16 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.5
|
||||
|
||||
Logs an informational message \a message in the logging category \a category.
|
||||
\a message might contain place holders that are replaced by additional
|
||||
arguments, similar to the C printf() function.
|
||||
Logs an informational message, \a message, in the logging category, \a category.
|
||||
\a message may contain place holders to be replaced by additional arguments,
|
||||
similar to the C printf() function.
|
||||
|
||||
Example:
|
||||
|
||||
\snippet qloggingcategory/main.cpp qcinfo_printf
|
||||
|
||||
\note Arguments might not be processed if debug output for the category is
|
||||
not enabled, so do not rely on any side effects.
|
||||
\note If the debug output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qInfo()
|
||||
*/
|
||||
@ -532,7 +518,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.2
|
||||
|
||||
Returns an output stream for warning messages in the logging category
|
||||
Returns an output stream for warning messages in the logging category,
|
||||
\a category.
|
||||
|
||||
The macro expands to code that checks whether
|
||||
@ -543,8 +529,8 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
|
||||
\snippet qloggingcategory/main.cpp 11
|
||||
|
||||
\note Arguments are not processed if warning output for the category is not
|
||||
enabled, so do not rely on any side effects.
|
||||
\note If the warning output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qWarning()
|
||||
*/
|
||||
@ -555,16 +541,16 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.3
|
||||
|
||||
Logs a warning message \a message in the logging category \a category.
|
||||
\a message might contain place holders that are replaced by additional
|
||||
arguments, similar to the C printf() function.
|
||||
Logs a warning message, \a message, in the logging category, \a category.
|
||||
\a message may contain place holders to be replaced by additional arguments,
|
||||
similar to the C printf() function.
|
||||
|
||||
Example:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 14
|
||||
|
||||
\note Arguments might not be processed if warning output for the category is
|
||||
not enabled, so do not rely on any side effects.
|
||||
\note If the warning output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qWarning()
|
||||
*/
|
||||
@ -575,7 +561,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.2
|
||||
|
||||
Returns an output stream for critical messages in the logging category
|
||||
Returns an output stream for critical messages in the logging category,
|
||||
\a category.
|
||||
|
||||
The macro expands to code that checks whether
|
||||
@ -586,8 +572,9 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
|
||||
\snippet qloggingcategory/main.cpp 12
|
||||
|
||||
\note Arguments are not processed if critical output for the category is not
|
||||
enabled, so do not rely on any side effects.
|
||||
|
||||
\note If the critical output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qCritical()
|
||||
*/
|
||||
@ -598,16 +585,16 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\threadsafe
|
||||
\since 5.3
|
||||
|
||||
Logs a critical message \a message in the logging category \a category.
|
||||
\a message might contain place holders that are replaced by additional
|
||||
arguments, similar to the C printf() function.
|
||||
Logs a critical message, \a message, in the logging category, \a category.
|
||||
\a message may contain place holders to be replaced by additional arguments,
|
||||
similar to the C printf() function.
|
||||
|
||||
Example:
|
||||
|
||||
\snippet qloggingcategory/main.cpp 15
|
||||
|
||||
\note Arguments might not be processed if critical output for the category
|
||||
is not enabled, so do not rely on any side effects.
|
||||
\note If the critical output for a particular category isn't enabled, arguments
|
||||
won't be processed, so don't rely on any side effects.
|
||||
|
||||
\sa qCritical()
|
||||
*/
|
||||
@ -633,7 +620,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
\a string identifier. By default, all message types are enabled.
|
||||
|
||||
Only one translation unit in a library or executable can define a category
|
||||
with a specific name. The implicitly defined QLoggingCategory object is
|
||||
with a specific name. The implicitly-defined QLoggingCategory object is
|
||||
created on first use, in a thread-safe manner.
|
||||
|
||||
This macro must be used outside of a class or method.
|
||||
@ -650,7 +637,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
|
||||
and more severe are enabled, types with a lower severity are disabled.
|
||||
|
||||
Only one translation unit in a library or executable can define a category
|
||||
with a specific name. The implicitly defined QLoggingCategory object is
|
||||
with a specific name. The implicitly-defined QLoggingCategory object is
|
||||
created on first use, in a thread-safe manner.
|
||||
|
||||
This macro must be used outside of a class or method. It is only defined
|
||||
|
@ -243,9 +243,15 @@ bool QSaveFile::open(OpenMode mode)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool requiresDirectWrite = false;
|
||||
#ifdef Q_OS_WIN
|
||||
// check if it is an Alternate Data Stream
|
||||
if (d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1) {
|
||||
requiresDirectWrite = d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
// check if it is a content:// URL
|
||||
requiresDirectWrite = d->fileName.startsWith(QLatin1String("content://"));
|
||||
#endif
|
||||
if (requiresDirectWrite) {
|
||||
// yes, we can't rename onto it...
|
||||
if (d->directWriteFallback) {
|
||||
if (openDirectly())
|
||||
@ -254,14 +260,12 @@ bool QSaveFile::open(OpenMode mode)
|
||||
d->fileEngine.reset();
|
||||
} else {
|
||||
QString msg =
|
||||
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback "
|
||||
"enabled: path contains an Alternate Data Stream specifier")
|
||||
.arg(QDir::toNativeSeparators(d->fileName));
|
||||
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback enabled.")
|
||||
.arg(QDir::toNativeSeparators(d->fileName));
|
||||
d->setError(QFileDevice::OpenError, msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
d->fileEngine.reset(new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared));
|
||||
// if the target file exists, we'll copy its permissions below,
|
||||
|
@ -112,6 +112,13 @@ QT_BEGIN_NAMESPACE
|
||||
are returned by classInfo(), and you can search for pairs with
|
||||
indexOfClassInfo().
|
||||
|
||||
\note Operations that use the meta object system are generally thread-
|
||||
safe, as QMetaObjects are typically static read-only instances
|
||||
generated at compile time. However, if meta objects are dynamically
|
||||
modified by the application (for instance, when using QQmlPropertyMap),
|
||||
then the application has to explicitly synchronize access to the
|
||||
respective meta object.
|
||||
|
||||
\sa QMetaClassInfo, QMetaEnum, QMetaMethod, QMetaProperty, QMetaType,
|
||||
{Meta-Object System}
|
||||
*/
|
||||
|
@ -4616,7 +4616,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
||||
It works exactly like the Q_NAMESPACE macro. However, the external
|
||||
\c{staticMetaObject} variable that gets defined in the namespace
|
||||
is declared with the supplied \c{EXPORT_MACRO} qualifier. This is
|
||||
useful f.i. if the object needs to be exported from a dynamic library.
|
||||
useful if the object needs to be exported from a dynamic library.
|
||||
|
||||
\sa Q_NAMESPACE, {Creating Shared Libraries}
|
||||
*/
|
||||
|
@ -604,8 +604,8 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv
|
||||
\since 5.12
|
||||
\overload
|
||||
|
||||
Creates a connection from the timeout() signal to \a slot, and returns a
|
||||
handle to the connection.
|
||||
Creates a connection of type \a connectionType from the timeout() signal
|
||||
to \a slot, and returns a handle to the connection.
|
||||
|
||||
This method is provided for convenience.
|
||||
It's equivalent to calling \c {QObject::connect(timer, &QTimer::timeout, timer, slot, connectionType)}.
|
||||
|
@ -2254,10 +2254,10 @@ QVariant::QVariant(const QRegularExpression &re)
|
||||
: d(RegularExpression)
|
||||
{ v_construct<QRegularExpression>(&d, re); }
|
||||
#endif // QT_CONFIG(regularexpression)
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QVariant::QVariant(const QUuid &uuid)
|
||||
: d(Uuid)
|
||||
{ v_construct<QUuid>(&d, uuid); }
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QVariant::QVariant(const QJsonValue &jsonValue)
|
||||
: d(QMetaType::QJsonValue)
|
||||
{ v_construct<QJsonValue>(&d, jsonValue); }
|
||||
@ -3011,7 +3011,6 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const
|
||||
}
|
||||
#endif // QT_CONFIG(itemmodel)
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
@ -3026,6 +3025,7 @@ QUuid QVariant::toUuid() const
|
||||
return qVariantToHelper<QUuid>(d, handlerManager);
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
|
@ -256,12 +256,12 @@ class Q_CORE_EXPORT QVariant
|
||||
#if QT_CONFIG(regularexpression)
|
||||
QVariant(const QRegularExpression &re);
|
||||
#endif // QT_CONFIG(regularexpression)
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QVariant(const QUrl &url);
|
||||
#if QT_CONFIG(easingcurve)
|
||||
QVariant(const QEasingCurve &easing);
|
||||
#endif
|
||||
QVariant(const QUuid &uuid);
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QVariant(const QUrl &url);
|
||||
QVariant(const QJsonValue &jsonValue);
|
||||
QVariant(const QJsonObject &jsonObject);
|
||||
QVariant(const QJsonArray &jsonArray);
|
||||
@ -332,12 +332,12 @@ class Q_CORE_EXPORT QVariant
|
||||
#if QT_CONFIG(regularexpression)
|
||||
QRegularExpression toRegularExpression() const;
|
||||
#endif // QT_CONFIG(regularexpression)
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QUrl toUrl() const;
|
||||
#if QT_CONFIG(easingcurve)
|
||||
QEasingCurve toEasingCurve() const;
|
||||
#endif
|
||||
QUuid toUuid() const;
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QUrl toUrl() const;
|
||||
QJsonValue toJsonValue() const;
|
||||
QJsonObject toJsonObject() const;
|
||||
QJsonArray toJsonArray() const;
|
||||
|
@ -332,7 +332,7 @@ QVariant QJsonDocument::toVariant() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts the QJsonDocument to a UTF-8 encoded JSON document.
|
||||
Converts the QJsonDocument to an indented, UTF-8 encoded JSON document.
|
||||
|
||||
\sa fromJson()
|
||||
*/
|
||||
|
@ -2056,7 +2056,7 @@ bool QTextStreamPrivate::getReal(double *f)
|
||||
// nan/+inf/-inf, so here we also check for uppercase and mixed
|
||||
// case versions.
|
||||
if (!qstricmp(buf, "nan") || !qstricmp(buf, "+nan") || !qstricmp(buf, "-nan")) {
|
||||
*f = qSNaN();
|
||||
*f = qQNaN();
|
||||
return true;
|
||||
} else if (!qstricmp(buf, "+inf") || !qstricmp(buf, "inf")) {
|
||||
*f = qInf();
|
||||
|
@ -2538,6 +2538,10 @@ QStateMachine::~QStateMachine()
|
||||
state machine. Commonly, this could mean that one of the states has not been given
|
||||
any parent or added to any machine. The context of this error is the source state of
|
||||
the transition.
|
||||
\value StateMachineChildModeSetToParallelError The machine's \l childMode
|
||||
property was set to \l{QState::ParallelStates}. This is illegal.
|
||||
Only states may be declared as parallel, not the state machine
|
||||
itself. This enum value was added in Qt 5.14.
|
||||
|
||||
\sa setErrorState()
|
||||
*/
|
||||
|
@ -1775,12 +1775,7 @@ void QByteArray::resize(int size)
|
||||
return;
|
||||
}
|
||||
|
||||
if (size == 0 && !d->capacityReserved) {
|
||||
Data *x = Data::allocate(0);
|
||||
if (!d->ref.deref())
|
||||
Data::deallocate(d);
|
||||
d = x;
|
||||
} else if (d->size == 0 && d->ref.isStatic()) {
|
||||
if (d->size == 0 && d->ref.isStatic()) {
|
||||
//
|
||||
// Optimize the idiom:
|
||||
// QByteArray a;
|
||||
@ -1795,9 +1790,7 @@ void QByteArray::resize(int size)
|
||||
x->data()[size] = '\0';
|
||||
d = x;
|
||||
} else {
|
||||
if (d->ref.isShared() || uint(size) + 1u > d->alloc
|
||||
|| (!d->capacityReserved && size < d->size
|
||||
&& uint(size) + 1u < uint(d->alloc >> 1)))
|
||||
if (d->ref.isShared() || uint(size) + 1u > d->alloc)
|
||||
reallocData(uint(size) + 1u, d->detachFlags() | Data::Grow);
|
||||
if (d->alloc) {
|
||||
d->size = size;
|
||||
|
@ -1465,18 +1465,18 @@ QChar::UnicodeVersion QChar::currentUnicodeVersion() noexcept
|
||||
}
|
||||
|
||||
|
||||
template <typename Traits, typename T>
|
||||
Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) noexcept
|
||||
template <typename T>
|
||||
Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc, QUnicodeTables::Case which) noexcept
|
||||
{
|
||||
const QUnicodeTables::Properties *prop = qGetProp(uc);
|
||||
const auto fold = qGetProp(uc)->cases[which];
|
||||
|
||||
if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
|
||||
const ushort *specialCase = specialCaseMap + Traits::caseDiff(prop);
|
||||
if (Q_UNLIKELY(fold.special)) {
|
||||
const ushort *specialCase = specialCaseMap + fold.diff;
|
||||
// so far, there are no special cases beyond BMP (guaranteed by the qunicodetables generator)
|
||||
return *specialCase == 1 ? specialCase[1] : uc;
|
||||
}
|
||||
|
||||
return uc + Traits::caseDiff(prop);
|
||||
return uc + fold.diff;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1496,7 +1496,7 @@ uint QChar::toLower(uint ucs4) noexcept
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
return ucs4;
|
||||
return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::LowerCase);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1516,7 +1516,7 @@ uint QChar::toUpper(uint ucs4) noexcept
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
return ucs4;
|
||||
return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::UpperCase);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1536,7 +1536,7 @@ uint QChar::toTitleCase(uint ucs4) noexcept
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
return ucs4;
|
||||
return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::TitleCase);
|
||||
}
|
||||
|
||||
static inline uint foldCase(const ushort *ch, const ushort *start)
|
||||
@ -1544,7 +1544,7 @@ static inline uint foldCase(const ushort *ch, const ushort *start)
|
||||
uint ucs4 = *ch;
|
||||
if (QChar::isLowSurrogate(ucs4) && ch > start && QChar::isHighSurrogate(*(ch - 1)))
|
||||
ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4);
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
static inline uint foldCase(uint ch, uint &last) noexcept
|
||||
@ -1553,12 +1553,12 @@ static inline uint foldCase(uint ch, uint &last) noexcept
|
||||
if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
|
||||
ucs4 = QChar::surrogateToUcs4(last, ucs4);
|
||||
last = ch;
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
static inline ushort foldCase(ushort ch) noexcept
|
||||
{
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);
|
||||
return convertCase_helper(ch, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
static inline QChar foldCase(QChar ch) noexcept
|
||||
@ -1582,7 +1582,7 @@ uint QChar::toCaseFolded(uint ucs4) noexcept
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
return ucs4;
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2916,7 +2916,7 @@ static QString rawStandaloneWeekDayName(const QLocaleData *data, const int day,
|
||||
QString QCalendarBackend::monthName(const QLocale &locale, int month, int,
|
||||
QLocale::FormatType format) const
|
||||
{
|
||||
Q_ASSERT(month >= 1 && month <= maxMonthsInYear());
|
||||
Q_ASSERT(month >= 1 && month <= maximumMonthsInYear());
|
||||
return rawMonthName(localeMonthIndexData()[locale.d->m_data_offset],
|
||||
localeMonthData(), month, format);
|
||||
}
|
||||
@ -2942,7 +2942,7 @@ QString QGregorianCalendar::monthName(const QLocale &locale, int month, int year
|
||||
QString QCalendarBackend::standaloneMonthName(const QLocale &locale, int month, int,
|
||||
QLocale::FormatType format) const
|
||||
{
|
||||
Q_ASSERT(month >= 1 && month <= maxMonthsInYear());
|
||||
Q_ASSERT(month >= 1 && month <= maximumMonthsInYear());
|
||||
return rawStandaloneMonthName(localeMonthIndexData()[locale.d->m_data_offset],
|
||||
localeMonthData(), month, format);
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
|
||||
// "-nan" or "+nan"
|
||||
if (qstrcmp(num, "nan") == 0) {
|
||||
processed = 3;
|
||||
return qt_snan();
|
||||
return qt_qnan();
|
||||
} else if ((num[0] == '-' || num[0] == '+') && qstrcmp(num + 1, "nan") == 0) {
|
||||
processed = 0;
|
||||
ok = false;
|
||||
@ -322,7 +322,7 @@ double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
|
||||
conv_flags = double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES
|
||||
| double_conversion::StringToDoubleConverter::ALLOW_TRAILING_SPACES;
|
||||
}
|
||||
double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_snan(), 0, 0);
|
||||
double_conversion::StringToDoubleConverter conv(conv_flags, 0.0, qt_qnan(), 0, 0);
|
||||
d = conv.StringToDouble(num, numLen, &processed);
|
||||
|
||||
if (!qIsFinite(d)) {
|
||||
|
@ -3008,12 +3008,10 @@ int QRegExpEngine::getEscape()
|
||||
yyCharClass->addSingleton(0x005f); // '_'
|
||||
return Tok_CharClass;
|
||||
case 'I':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
if (!xmlSchemaExtensions)
|
||||
break;
|
||||
}
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
case 'i':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
|
||||
@ -3048,12 +3046,10 @@ int QRegExpEngine::getEscape()
|
||||
break;
|
||||
}
|
||||
case 'C':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
if (!xmlSchemaExtensions)
|
||||
break;
|
||||
}
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
case 'c':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
|
||||
@ -3094,12 +3090,10 @@ int QRegExpEngine::getEscape()
|
||||
break;
|
||||
}
|
||||
case 'P':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
if (!xmlSchemaExtensions)
|
||||
break;
|
||||
}
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
Q_FALLTHROUGH();
|
||||
case 'p':
|
||||
if (xmlSchemaExtensions) {
|
||||
if (yyCh != '{') {
|
||||
|
@ -531,7 +531,7 @@ QT_BEGIN_NAMESPACE
|
||||
optimize the execution of the matching algorithm. The JIT makes extensive
|
||||
usage of self-modifying code, which can lead debugging tools such as
|
||||
Valgrind to crash. You must enable all checks for self-modifying code if
|
||||
you want to debug programs using QRegularExpression (f.i., see Valgrind's
|
||||
you want to debug programs using QRegularExpression (for instance, Valgrind's
|
||||
\c{--smc-check} command line option). The downside of enabling such checks
|
||||
is that your program will run considerably slower.
|
||||
|
||||
|
@ -1193,10 +1193,10 @@ static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensit
|
||||
|
||||
static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept
|
||||
{
|
||||
if (cs == Qt::CaseInsensitive)
|
||||
return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size());
|
||||
if (lhs.isEmpty())
|
||||
return lencmp(0, rhs.size());
|
||||
if (cs == Qt::CaseInsensitive)
|
||||
return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size());
|
||||
const auto l = std::min(lhs.size(), rhs.size());
|
||||
int r = qstrncmp(lhs.data(), rhs.data(), l);
|
||||
return r ? r : lencmp(lhs.size(), rhs.size());
|
||||
@ -6629,9 +6629,9 @@ namespace QUnicodeTables {
|
||||
reallocate memory to grow the buffer. In that case, we need to adjust the \a
|
||||
it pointer.
|
||||
*/
|
||||
template <typename Traits, typename T>
|
||||
template <typename T>
|
||||
Q_NEVER_INLINE
|
||||
static QString detachAndConvertCase(T &str, QStringIterator it)
|
||||
static QString detachAndConvertCase(T &str, QStringIterator it, QUnicodeTables::Case which)
|
||||
{
|
||||
Q_ASSERT(!str.isEmpty());
|
||||
QString s = std::move(str); // will copy if T is const QString
|
||||
@ -6640,10 +6640,10 @@ static QString detachAndConvertCase(T &str, QStringIterator it)
|
||||
do {
|
||||
uint uc = it.nextUnchecked();
|
||||
|
||||
const QUnicodeTables::Properties *prop = qGetProp(uc);
|
||||
signed short caseDiff = Traits::caseDiff(prop);
|
||||
const auto fold = qGetProp(uc)->cases[which];
|
||||
signed short caseDiff = fold.diff;
|
||||
|
||||
if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
|
||||
if (Q_UNLIKELY(fold.special)) {
|
||||
const ushort *specialCase = specialCaseMap + caseDiff;
|
||||
ushort length = *specialCase++;
|
||||
|
||||
@ -6674,8 +6674,8 @@ static QString detachAndConvertCase(T &str, QStringIterator it)
|
||||
return s;
|
||||
}
|
||||
|
||||
template <typename Traits, typename T>
|
||||
static QString convertCase(T &str)
|
||||
template <typename T>
|
||||
static QString convertCase(T &str, QUnicodeTables::Case which)
|
||||
{
|
||||
const QChar *p = str.constBegin();
|
||||
const QChar *e = p + str.size();
|
||||
@ -6687,9 +6687,9 @@ static QString convertCase(T &str)
|
||||
QStringIterator it(p, e);
|
||||
while (it.hasNext()) {
|
||||
uint uc = it.nextUnchecked();
|
||||
if (Traits::caseDiff(qGetProp(uc))) {
|
||||
if (qGetProp(uc)->cases[which].diff) {
|
||||
it.recedeUnchecked();
|
||||
return detachAndConvertCase<Traits>(str, it);
|
||||
return detachAndConvertCase(str, it, which);
|
||||
}
|
||||
}
|
||||
return std::move(str);
|
||||
@ -6698,12 +6698,12 @@ static QString convertCase(T &str)
|
||||
|
||||
QString QString::toLower_helper(const QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::LowercaseTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::LowerCase);
|
||||
}
|
||||
|
||||
QString QString::toLower_helper(QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::LowercaseTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::LowerCase);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -6715,12 +6715,12 @@ QString QString::toLower_helper(QString &str)
|
||||
|
||||
QString QString::toCaseFolded_helper(const QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::CasefoldTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
QString QString::toCaseFolded_helper(QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::CasefoldTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::CaseFold);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -6738,12 +6738,12 @@ QString QString::toCaseFolded_helper(QString &str)
|
||||
|
||||
QString QString::toUpper_helper(const QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::UppercaseTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::UpperCase);
|
||||
}
|
||||
|
||||
QString QString::toUpper_helper(QString &str)
|
||||
{
|
||||
return QUnicodeTables::convertCase<QUnicodeTables::UppercaseTraits>(str);
|
||||
return QUnicodeTables::convertCase(str, QUnicodeTables::UpperCase);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 14)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,6 +63,15 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QUnicodeTables {
|
||||
|
||||
enum Case {
|
||||
LowerCase,
|
||||
UpperCase,
|
||||
TitleCase,
|
||||
CaseFold,
|
||||
|
||||
NumCases
|
||||
};
|
||||
|
||||
struct Properties {
|
||||
ushort category : 8; /* 5 used */
|
||||
ushort direction : 8; /* 5 used */
|
||||
@ -70,63 +79,29 @@ struct Properties {
|
||||
ushort joining : 3;
|
||||
signed short digitValue : 5;
|
||||
signed short mirrorDiff : 16;
|
||||
ushort lowerCaseSpecial : 1;
|
||||
signed short lowerCaseDiff : 15;
|
||||
#ifdef Q_OS_WASM
|
||||
unsigned char : 0; //wasm 64 packing trick
|
||||
#endif
|
||||
ushort upperCaseSpecial : 1;
|
||||
signed short upperCaseDiff : 15;
|
||||
ushort titleCaseSpecial : 1;
|
||||
signed short titleCaseDiff : 15;
|
||||
ushort caseFoldSpecial : 1;
|
||||
signed short caseFoldDiff : 15;
|
||||
ushort unicodeVersion : 8; /* 5 used */
|
||||
ushort nfQuickCheck : 8;
|
||||
#ifdef Q_OS_WASM
|
||||
unsigned char : 0; //wasm 64 packing trick
|
||||
#endif
|
||||
struct {
|
||||
ushort special : 1;
|
||||
signed short diff : 15;
|
||||
} cases[NumCases];
|
||||
#ifdef Q_OS_WASM
|
||||
unsigned char : 0; //wasm 64 packing trick
|
||||
#endif
|
||||
ushort graphemeBreakClass : 5; /* 5 used */
|
||||
ushort wordBreakClass : 5; /* 5 used */
|
||||
ushort sentenceBreakClass : 8; /* 4 used */
|
||||
ushort lineBreakClass : 6; /* 6 used */
|
||||
ushort sentenceBreakClass : 8; /* 4 used */
|
||||
ushort script : 8;
|
||||
};
|
||||
|
||||
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept;
|
||||
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) noexcept;
|
||||
|
||||
struct LowercaseTraits
|
||||
{
|
||||
static inline signed short caseDiff(const Properties *prop)
|
||||
{ return prop->lowerCaseDiff; }
|
||||
static inline bool caseSpecial(const Properties *prop)
|
||||
{ return prop->lowerCaseSpecial; }
|
||||
};
|
||||
|
||||
struct UppercaseTraits
|
||||
{
|
||||
static inline signed short caseDiff(const Properties *prop)
|
||||
{ return prop->upperCaseDiff; }
|
||||
static inline bool caseSpecial(const Properties *prop)
|
||||
{ return prop->upperCaseSpecial; }
|
||||
};
|
||||
|
||||
struct TitlecaseTraits
|
||||
{
|
||||
static inline signed short caseDiff(const Properties *prop)
|
||||
{ return prop->titleCaseDiff; }
|
||||
static inline bool caseSpecial(const Properties *prop)
|
||||
{ return prop->titleCaseSpecial; }
|
||||
};
|
||||
|
||||
struct CasefoldTraits
|
||||
{
|
||||
static inline signed short caseDiff(const Properties *prop)
|
||||
{ return prop->caseFoldDiff; }
|
||||
static inline bool caseSpecial(const Properties *prop)
|
||||
{ return prop->caseFoldSpecial; }
|
||||
};
|
||||
Q_STATIC_ASSERT(sizeof(Properties) == 20);
|
||||
|
||||
enum GraphemeBreakClass {
|
||||
GraphemeBreak_Any,
|
||||
|
@ -80,8 +80,7 @@ public:
|
||||
explicit QSemaphoreReleaser(QSemaphore *sem, int n = 1) noexcept
|
||||
: m_sem(sem), m_n(n) {}
|
||||
QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept
|
||||
: m_sem(other.m_sem), m_n(other.m_n)
|
||||
{ other.m_sem = nullptr; }
|
||||
: m_sem(other.cancel()), m_n(other.m_n) {}
|
||||
QSemaphoreReleaser &operator=(QSemaphoreReleaser &&other) noexcept
|
||||
{ QSemaphoreReleaser moved(std::move(other)); swap(moved); return *this; }
|
||||
|
||||
@ -102,9 +101,7 @@ public:
|
||||
|
||||
QSemaphore *cancel() noexcept
|
||||
{
|
||||
QSemaphore *old = m_sem;
|
||||
m_sem = nullptr;
|
||||
return old;
|
||||
return qExchange(m_sem, nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -136,6 +136,7 @@ Q_GLOBAL_STATIC(Registry, calendarRegistry);
|
||||
|
||||
\class QCalendarBackend
|
||||
\inmodule QtCore
|
||||
\internal
|
||||
\reentrant
|
||||
\brief The QCalendarBackend class provides basic calendaring functions.
|
||||
|
||||
@ -167,7 +168,7 @@ Q_GLOBAL_STATIC(Registry, calendarRegistry);
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs the calendar and registers it.
|
||||
Constructs the calendar and registers it under \a name using \a id.
|
||||
*/
|
||||
QCalendarBackend::QCalendarBackend(const QString &name, QCalendar::System id)
|
||||
{
|
||||
@ -192,7 +193,7 @@ QCalendarBackend::~QCalendarBackend()
|
||||
return the member of that enum that produces it. Other calendars should
|
||||
return User.
|
||||
|
||||
\sa QCalendar::fromEnum()
|
||||
\sa QCalendarBackend::fromEnum()
|
||||
*/
|
||||
QCalendar::System QCalendarBackend::calendarSystem() const
|
||||
{
|
||||
@ -223,7 +224,7 @@ QString QCalendar::name() const
|
||||
in the month, although \c{isDateValid(year, month, day)} might return \c true for
|
||||
some larger values of \c day.
|
||||
|
||||
\sa daysInYear(), monthsInYear(), minDaysInMonth(), maxDaysInMonth()
|
||||
\sa daysInYear(), monthsInYear(), minimumDaysInMonth(), maximumDaysInMonth()
|
||||
*/
|
||||
|
||||
// properties of the calendar
|
||||
@ -295,7 +296,7 @@ int QCalendarBackend::daysInYear(int year) const
|
||||
|
||||
This base implementation returns 12 for any valid year.
|
||||
|
||||
\sa daysInYear(), maxMonthsInYear(), isDateValid()
|
||||
\sa daysInYear(), maximumMonthsInYear(), isDateValid()
|
||||
*/
|
||||
int QCalendarBackend::monthsInYear(int year) const
|
||||
{
|
||||
@ -353,13 +354,14 @@ bool QCalendarBackend::hasYearZero() const
|
||||
This base implementation returns 31, as this is a common case.
|
||||
|
||||
For calendars with intercallary days, although daysInMonth() doesn't include
|
||||
the intercallary days in its count for an individual month, maxDaysInMonth()
|
||||
should include intercallary days, so that it is the maximum value of \c day
|
||||
for which \c{isDateValid(year, month, day)} can be true.
|
||||
the intercallary days in its count for an individual month,
|
||||
maximumDaysInMonth() should include intercallary days, so that it is the
|
||||
maximum value of \c day for which \c{isDateValid(year, month, day)} can be
|
||||
true.
|
||||
|
||||
\sa maxMonthsInYear(), daysInMonth()
|
||||
\sa maximumMonthsInYear(), daysInMonth()
|
||||
*/
|
||||
int QCalendarBackend::maxDaysInMonth() const
|
||||
int QCalendarBackend::maximumDaysInMonth() const
|
||||
{
|
||||
return 31;
|
||||
}
|
||||
@ -369,9 +371,9 @@ int QCalendarBackend::maxDaysInMonth() const
|
||||
|
||||
This base implementation returns 29, as this is a common case.
|
||||
|
||||
\sa maxMonthsInYear(), daysInMonth()
|
||||
\sa maximumMonthsInYear(), daysInMonth()
|
||||
*/
|
||||
int QCalendarBackend::minDaysInMonth() const
|
||||
int QCalendarBackend::minimumDaysInMonth() const
|
||||
{
|
||||
return 29;
|
||||
}
|
||||
@ -381,9 +383,9 @@ int QCalendarBackend::minDaysInMonth() const
|
||||
|
||||
This base implementation returns 12, as this is a common case.
|
||||
|
||||
\sa maxDaysInMonth(), monthsInYear()
|
||||
\sa maximumDaysInMonth(), monthsInYear()
|
||||
*/
|
||||
int QCalendarBackend::maxMonthsInYear() const
|
||||
int QCalendarBackend::maximumMonthsInYear() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
@ -391,7 +393,7 @@ int QCalendarBackend::maxMonthsInYear() const
|
||||
// Julian day number calculations
|
||||
|
||||
/*!
|
||||
\fn bool dateToJulianDay(int year, int month, int day, qint64 *jd) const
|
||||
\fn bool QCalendarBackend::dateToJulianDay(int year, int month, int day, qint64 *jd) const
|
||||
|
||||
Computes the Julian day number corresponding to the specified \a year, \a
|
||||
month, and \a day. Returns true and sets \a jd if there is such a date in
|
||||
@ -401,7 +403,7 @@ int QCalendarBackend::maxMonthsInYear() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QCalendar::YearMonthDay julianDayToDate(qint64 jd) const
|
||||
\fn QCalendar::YearMonthDay QCalendarBackend::julianDayToDate(qint64 jd) const
|
||||
|
||||
Computes the year, month, and day in this calendar for the given Julian day
|
||||
number \a jd. If the given day falls outside this calendar's scope
|
||||
@ -413,7 +415,7 @@ int QCalendarBackend::maxMonthsInYear() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns the day of the week for a given Julian Day Number.
|
||||
Returns the day of the week for the given Julian Day Number \a jd.
|
||||
|
||||
This is 1 for Monday through 7 for Sunday.
|
||||
|
||||
@ -541,7 +543,7 @@ int QCalendarBackend::dayOfWeek(qint64 jd) const
|
||||
QCalendarBackend sub-class must be registered before being exposed to Date
|
||||
and Time APIs.
|
||||
|
||||
\sa registerCalendar(), fromName()
|
||||
\sa registerAlias(), fromName()
|
||||
*/
|
||||
QStringList QCalendarBackend::availableCalendars()
|
||||
{
|
||||
@ -578,7 +580,7 @@ bool QCalendarBackend::registerAlias(const QString &name)
|
||||
other means. However, calendars available via the QCalendar::System enum are
|
||||
always registered when this is called.
|
||||
|
||||
\sa availableCalendars(), registerCalendar(), fromEnum()
|
||||
\sa availableCalendars(), registerAlias(), fromEnum()
|
||||
*/
|
||||
const QCalendarBackend *QCalendarBackend::fromName(QStringView name)
|
||||
{
|
||||
@ -662,7 +664,7 @@ const QCalendarBackend *QCalendarBackend::fromEnum(QCalendar::System system)
|
||||
|
||||
A QCalendar value is immutable.
|
||||
|
||||
\sa QCalendarBackend, QDate, QDateTime
|
||||
\sa QDate, QDateTime
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -675,6 +677,8 @@ const QCalendarBackend *QCalendarBackend::fromEnum(QCalendar::System system)
|
||||
\value Milankovic A revised Julian calendar used by some Orthodox churches.
|
||||
\value Jalali The Solar Hijri calendar (also called Persian).
|
||||
\value IslamicCivil The (tabular) Islamic Civil calendar.
|
||||
\omitvalue Last
|
||||
\omitvalue User
|
||||
|
||||
\sa QCalendar
|
||||
*/
|
||||
@ -723,7 +727,7 @@ QCalendar::QCalendar(QStringView name)
|
||||
Months are numbered consecutively, starting with 1 for the first month of each
|
||||
year.
|
||||
|
||||
\sa maxDaysInMonth(), minDaysInMonth()
|
||||
\sa maximumDaysInMonth(), minimumDaysInMonth()
|
||||
*/
|
||||
int QCalendar::daysInMonth(int month, int year) const
|
||||
{
|
||||
@ -772,7 +776,7 @@ bool QCalendar::isGregorian() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the given year is a leap year.
|
||||
Returns \c true if the given \a year is a leap year.
|
||||
|
||||
Since the year is not a whole number of days long, some years are longer than
|
||||
others. The difference may be a whole month or just a single day; the details
|
||||
@ -865,21 +869,21 @@ bool QCalendar::hasYearZero() const
|
||||
/*!
|
||||
Returns the number of days in the longest month in the calendar, in any year.
|
||||
|
||||
\sa daysInMonth(), minDaysInMonth()
|
||||
\sa daysInMonth(), minimumDaysInMonth()
|
||||
*/
|
||||
int QCalendar::maxDaysInMonth() const
|
||||
int QCalendar::maximumDaysInMonth() const
|
||||
{
|
||||
return d ? d->maxDaysInMonth() : 0;
|
||||
return d ? d->maximumDaysInMonth() : 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of days in the shortest month in the calendar, in any year.
|
||||
|
||||
\sa daysInMonth(), maxDaysInMonth()
|
||||
\sa daysInMonth(), maximumDaysInMonth()
|
||||
*/
|
||||
int QCalendar::minDaysInMonth() const
|
||||
int QCalendar::minimumDaysInMonth() const
|
||||
{
|
||||
return d ? d->minDaysInMonth() : 0;
|
||||
return d ? d->minimumDaysInMonth() : 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -887,16 +891,16 @@ int QCalendar::minDaysInMonth() const
|
||||
|
||||
\sa monthName(), standaloneMonthName(), monthsInYear()
|
||||
*/
|
||||
int QCalendar::maxMonthsInYear() const
|
||||
int QCalendar::maximumMonthsInYear() const
|
||||
{
|
||||
return d ? d->maxMonthsInYear() : 0;
|
||||
return d ? d->maximumMonthsInYear() : 0;
|
||||
}
|
||||
|
||||
// Julian Day conversions:
|
||||
|
||||
/*!
|
||||
\fn QDate QCalendar::dateFromParts(int year, int month, int day) const
|
||||
\fn QDate QCalendar::dateFromParts(QCalendar::YearMonthDay parts) const
|
||||
\fn QDate QCalendar::dateFromParts(const QCalendar::YearMonthDay &parts) const
|
||||
|
||||
Converts a year, month, and day to a QDate.
|
||||
|
||||
@ -924,7 +928,7 @@ QDate QCalendar::dateFromParts(const QCalendar::YearMonthDay &parts) const
|
||||
Converts a QDate to a year, month, and day of the month.
|
||||
|
||||
The returned structure's isValid() shall be false if the calendar is unable
|
||||
to represent the given \a date. Otherwise its \a year, \a month, and \a day
|
||||
to represent the given \a date. Otherwise its year, month, and day
|
||||
members record the so-named parts of its representation.
|
||||
|
||||
\sa dateFromParts(), isProleptic(), hasYearZero()
|
||||
@ -967,12 +971,12 @@ int QCalendar::dayOfWeek(QDate date) const
|
||||
in the specified \a locale; the \a format determines how fully it shall be
|
||||
expressed (i.e. to what extent it is abbreviated).
|
||||
|
||||
\sa standaloneMonthName(), maxMonthsInYear(), dateTimeString()
|
||||
\sa standaloneMonthName(), maximumMonthsInYear(), dateTimeToString()
|
||||
*/
|
||||
QString QCalendar::monthName(const QLocale &locale, int month, int year,
|
||||
QLocale::FormatType format) const
|
||||
{
|
||||
const int maxMonth = year == Unspecified ? maxMonthsInYear() : monthsInYear(year);
|
||||
const int maxMonth = year == Unspecified ? maximumMonthsInYear() : monthsInYear(year);
|
||||
if (!d || month < 1 || month > maxMonth)
|
||||
return QString();
|
||||
|
||||
@ -996,12 +1000,12 @@ QString QCalendar::monthName(const QLocale &locale, int month, int year,
|
||||
specified \a locale; the \a format determines how fully it shall be expressed
|
||||
(i.e. to what extent it is abbreviated).
|
||||
|
||||
\sa monthName(), maxMonthsInYear(), dateTimeString()
|
||||
\sa monthName(), maximumMonthsInYear(), dateTimeToString()
|
||||
*/
|
||||
QString QCalendar::standaloneMonthName(const QLocale &locale, int month, int year,
|
||||
QLocale::FormatType format) const
|
||||
{
|
||||
const int maxMonth = year == Unspecified ? maxMonthsInYear() : monthsInYear(year);
|
||||
const int maxMonth = year == Unspecified ? maximumMonthsInYear() : monthsInYear(year);
|
||||
if (!d || month < 1 || month > maxMonth)
|
||||
return QString();
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
User = -1
|
||||
};
|
||||
// New entries must be added to the \enum doc in qcalendar.cpp and
|
||||
// handled in QCalendar::fromEnum()
|
||||
// handled in QCalendarBackend::fromEnum()
|
||||
Q_ENUM(System)
|
||||
|
||||
explicit QCalendar(); // Gregorian, optimised
|
||||
@ -155,9 +155,9 @@ public:
|
||||
bool isSolar() const;
|
||||
bool isProleptic() const;
|
||||
bool hasYearZero() const;
|
||||
int maxDaysInMonth() const;
|
||||
int minDaysInMonth() const;
|
||||
int maxMonthsInYear() const;
|
||||
int maximumDaysInMonth() const;
|
||||
int minimumDaysInMonth() const;
|
||||
int maximumMonthsInYear() const;
|
||||
QString name() const;
|
||||
|
||||
// QDate conversions:
|
||||
|
@ -95,9 +95,9 @@ public:
|
||||
virtual bool isSolar() const = 0;
|
||||
virtual bool isProleptic() const;
|
||||
virtual bool hasYearZero() const;
|
||||
virtual int maxDaysInMonth() const;
|
||||
virtual int minDaysInMonth() const;
|
||||
virtual int maxMonthsInYear() const;
|
||||
virtual int maximumDaysInMonth() const;
|
||||
virtual int minimumDaysInMonth() const;
|
||||
virtual int maximumMonthsInYear() const;
|
||||
// Julian Day conversions:
|
||||
virtual bool dateToJulianDay(int year, int month, int day, qint64 *jd) const = 0;
|
||||
virtual QCalendar::YearMonthDay julianDayToDate(qint64 jd) const = 0;
|
||||
|
@ -1465,7 +1465,7 @@ QDate QDate::addMonths(int nmonths, QCalendar cal) const
|
||||
}
|
||||
|
||||
/*!
|
||||
\override
|
||||
\overload
|
||||
*/
|
||||
|
||||
QDate QDate::addMonths(int nmonths) const
|
||||
@ -1530,7 +1530,7 @@ QDate QDate::addYears(int nyears, QCalendar cal) const
|
||||
}
|
||||
|
||||
/*!
|
||||
\override
|
||||
\overload
|
||||
*/
|
||||
|
||||
QDate QDate::addYears(int nyears) const
|
||||
|
@ -223,21 +223,23 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
|
||||
case TimeZoneSection: return QTimeZone::MaxUtcOffsetSecs;
|
||||
#endif
|
||||
case Hour24Section:
|
||||
case Hour12Section: return 23; // this is special-cased in
|
||||
// parseSection. We want it to be
|
||||
// 23 for the stepBy case.
|
||||
case Hour12Section:
|
||||
// This is special-cased in parseSection.
|
||||
// We want it to be 23 for the stepBy case.
|
||||
return 23;
|
||||
case MinuteSection:
|
||||
case SecondSection: return 59;
|
||||
case MSecSection: return 999;
|
||||
case YearSection2Digits:
|
||||
case YearSection: return 9999; // sectionMaxSize will prevent
|
||||
// people from typing in a larger
|
||||
// number in count == 2 sections.
|
||||
// stepBy() will work on real years anyway
|
||||
case MonthSection: return calendar.maxMonthsInYear();
|
||||
case YearSection:
|
||||
// sectionMaxSize will prevent people from typing in a larger number in
|
||||
// count == 2 sections; stepBy() will work on real years anyway.
|
||||
return 9999;
|
||||
case MonthSection: return calendar.maximumMonthsInYear();
|
||||
case DaySection:
|
||||
case DayOfWeekSectionShort:
|
||||
case DayOfWeekSectionLong: return cur.isValid() ? cur.date().daysInMonth(calendar) : calendar.maxDaysInMonth() ;
|
||||
case DayOfWeekSectionLong:
|
||||
return cur.isValid() ? cur.date().daysInMonth(calendar) : calendar.maximumDaysInMonth();
|
||||
case AmPmSection: return 1;
|
||||
default: break;
|
||||
}
|
||||
@ -615,7 +617,7 @@ int QDateTimeParser::sectionSize(int sectionIndex) const
|
||||
int QDateTimeParser::sectionMaxSize(Section s, int count) const
|
||||
{
|
||||
#if QT_CONFIG(textdate)
|
||||
int mcount = calendar.maxMonthsInYear();
|
||||
int mcount = calendar.maximumMonthsInYear();
|
||||
#endif
|
||||
|
||||
switch (s) {
|
||||
@ -1291,9 +1293,9 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
}
|
||||
|
||||
if (!calendar.isDateValid(year, month, day)) {
|
||||
if (day <= calendar.maxDaysInMonth())
|
||||
if (day <= calendar.maximumDaysInMonth())
|
||||
cachedDay = day;
|
||||
if (day > calendar.minDaysInMonth() && calendar.isDateValid(year, month, 1))
|
||||
if (day > calendar.minimumDaysInMonth() && calendar.isDateValid(year, month, 1))
|
||||
needfixday = true;
|
||||
}
|
||||
if (needfixday) {
|
||||
|
@ -57,7 +57,7 @@ using namespace QRoundingDown;
|
||||
The Gregorian calendar is a refinement of the earlier Julian calendar,
|
||||
itself a late form of the Roman calendar. It is widely used.
|
||||
|
||||
\sa QRomanCalendar, QJulianCalendar, QCalendarBackend, QCalendar
|
||||
\sa QRomanCalendar, QJulianCalendar, QCalendar
|
||||
*/
|
||||
|
||||
QGregorianCalendar::QGregorianCalendar()
|
||||
|
@ -102,7 +102,7 @@ int QHijriCalendar::daysInMonth(int month, int year) const
|
||||
return month % 2 == 0 ? 29 : 30;
|
||||
}
|
||||
|
||||
int QHijriCalendar::maxDaysInMonth() const
|
||||
int QHijriCalendar::maximumDaysInMonth() const
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class Q_CORE_EXPORT QHijriCalendar : public QCalendarBackend
|
||||
{
|
||||
public:
|
||||
int daysInMonth(int month, int year = QCalendar::Unspecified) const override;
|
||||
int maxDaysInMonth() const override;
|
||||
int maximumDaysInMonth() const override;
|
||||
int daysInYear(int year) const override;
|
||||
|
||||
bool isLunar() const override;
|
||||
|
@ -72,7 +72,7 @@ int QRomanCalendar::daysInMonth(int month, int year) const
|
||||
return 30 | ((month & 1) ^ (month >> 3));
|
||||
}
|
||||
|
||||
int QRomanCalendar::minDaysInMonth() const
|
||||
int QRomanCalendar::minimumDaysInMonth() const
|
||||
{
|
||||
return 28;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class Q_CORE_EXPORT QRomanCalendar : public QCalendarBackend
|
||||
public:
|
||||
// date queries:
|
||||
int daysInMonth(int month, int year = QCalendar::Unspecified) const override;
|
||||
int minDaysInMonth() const override;
|
||||
int minimumDaysInMonth() const override;
|
||||
// properties of the calendar
|
||||
bool isLunar() const override;
|
||||
bool isLuniSolar() const override;
|
||||
|
@ -143,7 +143,7 @@ qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t heade
|
||||
}
|
||||
|
||||
result.elementCount = (bytes - unsigned(headerSize)) / unsigned(elementSize);
|
||||
result.size = bytes;
|
||||
result.size = result.elementCount * elementSize + headerSize;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,16 @@ QDBusServer::QDBusServer(QObject *parent)
|
||||
*/
|
||||
QDBusServer::~QDBusServer()
|
||||
{
|
||||
QWriteLocker locker(&d->lock);
|
||||
QMutex *managerMutex = nullptr;
|
||||
if (QDBusConnectionManager::instance())
|
||||
managerMutex = &QDBusConnectionManager::instance()->mutex;
|
||||
QMutexLocker locker(managerMutex);
|
||||
QWriteLocker writeLocker(&d->lock);
|
||||
if (QDBusConnectionManager::instance()) {
|
||||
const auto locker = qt_scoped_lock(QDBusConnectionManager::instance()->mutex);
|
||||
for (const QString &name : qAsConst(d->serverConnectionNames))
|
||||
QDBusConnectionManager::instance()->removeConnection(name);
|
||||
d->serverConnectionNames.clear();
|
||||
locker.unlock();
|
||||
}
|
||||
d->serverObject = nullptr;
|
||||
d->ref.storeRelaxed(0);
|
||||
|
@ -5025,7 +5025,7 @@ QImage QImage::convertedToColorSpace(const QColorSpace &colorSpace) const
|
||||
QColorSpace QImage::colorSpace() const
|
||||
{
|
||||
if (!d)
|
||||
return QColorSpace::Undefined;
|
||||
return QColorSpace();
|
||||
return d->colorSpace;
|
||||
}
|
||||
|
||||
|
@ -3322,8 +3322,11 @@ void QGuiApplication::setFont(const QFont &font)
|
||||
*QGuiApplicationPrivate::app_font = font;
|
||||
applicationResourceFlags |= ApplicationFontExplicitlySet;
|
||||
|
||||
if (emitChange && qGuiApp)
|
||||
emit qGuiApp->fontChanged(*QGuiApplicationPrivate::app_font);
|
||||
if (emitChange && qGuiApp) {
|
||||
auto font = *QGuiApplicationPrivate::app_font;
|
||||
locker.unlock();
|
||||
emit qGuiApp->fontChanged(font);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -86,7 +86,7 @@ static inline qreal initialGlobalScaleFactor()
|
||||
qreal result = 1;
|
||||
if (qEnvironmentVariableIsSet(scaleFactorEnvVar)) {
|
||||
bool ok;
|
||||
const qreal f = qgetenv(scaleFactorEnvVar).toDouble(&ok);
|
||||
const qreal f = qEnvironmentVariable(scaleFactorEnvVar).toDouble(&ok);
|
||||
if (ok && f > 0) {
|
||||
qCDebug(lcScaling) << "Apply " << scaleFactorEnvVar << f;
|
||||
result = f;
|
||||
@ -284,7 +284,8 @@ static inline bool usePixelDensity()
|
||||
return QCoreApplication::testAttribute(Qt::AA_EnableHighDpiScaling)
|
||||
|| (screenEnvValueOk && screenEnvValue > 0)
|
||||
|| (enableEnvValueOk && enableEnvValue > 0)
|
||||
|| (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar) && qgetenv(legacyDevicePixelEnvVar).toLower() == "auto");
|
||||
|| (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)
|
||||
&& qEnvironmentVariable(legacyDevicePixelEnvVar).compare(QLatin1String("auto"), Qt::CaseInsensitive) == 0);
|
||||
}
|
||||
|
||||
qreal QHighDpiScaling::rawScaleFactor(const QPlatformScreen *screen)
|
||||
@ -506,20 +507,20 @@ void QHighDpiScaling::updateHighDpiScaling()
|
||||
}
|
||||
if (qEnvironmentVariableIsSet(screenFactorsEnvVar)) {
|
||||
int i = 0;
|
||||
const auto specs = qgetenv(screenFactorsEnvVar).split(';');
|
||||
for (const QByteArray &spec : specs) {
|
||||
int equalsPos = spec.lastIndexOf('=');
|
||||
const QString spec = qEnvironmentVariable(screenFactorsEnvVar);
|
||||
const auto specs = spec.splitRef(QLatin1Char(';'));
|
||||
for (const QStringRef &spec : specs) {
|
||||
int equalsPos = spec.lastIndexOf(QLatin1Char('='));
|
||||
qreal factor = 0;
|
||||
if (equalsPos > 0) {
|
||||
// support "name=factor"
|
||||
QByteArray name = spec.mid(0, equalsPos);
|
||||
QByteArray f = spec.mid(equalsPos + 1);
|
||||
bool ok;
|
||||
factor = f.toDouble(&ok);
|
||||
const auto name = spec.left(equalsPos);
|
||||
factor = spec.mid(equalsPos + 1).toDouble(&ok);
|
||||
if (ok && factor > 0 ) {
|
||||
const auto screens = QGuiApplication::screens();
|
||||
for (QScreen *s : screens) {
|
||||
if (s->name() == QString::fromLocal8Bit(name)) {
|
||||
if (s->name() == name) {
|
||||
setScreenFactor(s, factor);
|
||||
break;
|
||||
}
|
||||
|
@ -1807,7 +1807,7 @@ QList<QOpenGLDebugMessage> QOpenGLDebugLogger::loggedMessages() const
|
||||
|
||||
\note Message texts are encoded in UTF-8 when they get passed to OpenGL, so
|
||||
their size in bytes does not usually match the amount of UTF-16 code units,
|
||||
as returned f.i. by QString::length(). (It does if the message contains
|
||||
as returned, for instance, by QString::length(). (It does if the message contains
|
||||
7-bit ASCII only data, which is typical for debug messages.)
|
||||
*/
|
||||
qint64 QOpenGLDebugLogger::maximumMessageLength() const
|
||||
|
@ -263,10 +263,9 @@ public:
|
||||
|
||||
bool QOpenGLProgramBinaryCache::load(const QByteArray &cacheKey, uint programId)
|
||||
{
|
||||
if (m_memCache.contains(cacheKey)) {
|
||||
const MemCacheEntry *e = m_memCache[cacheKey];
|
||||
QMutexLocker lock(&m_mutex);
|
||||
if (const MemCacheEntry *e = m_memCache.object(cacheKey))
|
||||
return setProgramBinary(programId, e->format, e->blob.constData(), e->blob.size());
|
||||
}
|
||||
|
||||
QByteArray buf;
|
||||
const QString fn = cacheFileName(cacheKey);
|
||||
@ -401,6 +400,7 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId)
|
||||
GLint outSize = 0;
|
||||
#if defined(QT_OPENGL_ES_2)
|
||||
if (context->isOpenGLES() && context->format().majorVersion() < 3) {
|
||||
QMutexLocker lock(&m_mutex);
|
||||
initializeProgramBinaryOES(context);
|
||||
getProgramBinaryOES(programId, blobSize, &outSize, &blobFormat, p);
|
||||
} else
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtGui/qopenglshaderprogram.h>
|
||||
#include <QtCore/qcache.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -99,6 +100,7 @@ private:
|
||||
void initializeProgramBinaryOES(QOpenGLContext *context);
|
||||
bool m_programBinaryOESInitialized = false;
|
||||
#endif
|
||||
QMutex m_mutex;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
43
src/gui/painting/XCONSORTIUM_LICENSE.txt
Normal file
43
src/gui/painting/XCONSORTIUM_LICENSE.txt
Normal file
@ -0,0 +1,43 @@
|
||||
Copyright (c) 1987, 1988 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
@ -95,6 +95,11 @@ public:
|
||||
QBackingStore::QBackingStore(QWindow *window)
|
||||
: d_ptr(new QBackingStorePrivate(window))
|
||||
{
|
||||
if (window->handle()) {
|
||||
// Create platform backingstore up front if we have a platform window,
|
||||
// otherwise delay the creation until absolutely necessary.
|
||||
handle();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -106,10 +106,10 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold
|
||||
int levels[10];
|
||||
beziers[0] = *this;
|
||||
levels[0] = 9;
|
||||
QBezier *b = beziers;
|
||||
int *lvl = levels;
|
||||
int top = 0;
|
||||
|
||||
while (b >= beziers) {
|
||||
while (top >= 0) {
|
||||
QBezier *b = &beziers[top];
|
||||
// check if we can pop the top bezier curve from the stack
|
||||
qreal y4y1 = b->y4 - b->y1;
|
||||
qreal x4x1 = b->x4 - b->x1;
|
||||
@ -123,17 +123,15 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold
|
||||
qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
|
||||
l = 1.;
|
||||
}
|
||||
if (d < bezier_flattening_threshold*l || *lvl == 0) {
|
||||
if (d < bezier_flattening_threshold * l || levels[top] == 0) {
|
||||
// good enough, we pop it off and add the endpoint
|
||||
polygon->append(QPointF(b->x4, b->y4));
|
||||
--b;
|
||||
--lvl;
|
||||
--top;
|
||||
} else {
|
||||
// split, second half of the polygon goes lower into the stack
|
||||
std::tie(b[1], b[0]) = b->split();
|
||||
lvl[1] = --lvl[0];
|
||||
++b;
|
||||
++lvl;
|
||||
levels[top + 1] = --levels[top];
|
||||
++top;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,10 +142,10 @@ void QBezier::addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattenin
|
||||
int levels[10];
|
||||
beziers[0] = *this;
|
||||
levels[0] = 9;
|
||||
QBezier *b = beziers;
|
||||
int *lvl = levels;
|
||||
int top = 0;
|
||||
|
||||
while (b >= beziers) {
|
||||
while (top >= 0) {
|
||||
QBezier *b = &beziers[top];
|
||||
// check if we can pop the top bezier curve from the stack
|
||||
qreal y4y1 = b->y4 - b->y1;
|
||||
qreal x4x1 = b->x4 - b->x1;
|
||||
@ -161,17 +159,15 @@ void QBezier::addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattenin
|
||||
qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
|
||||
l = 1.;
|
||||
}
|
||||
if (d < bezier_flattening_threshold*l || *lvl == 0) {
|
||||
if (d < bezier_flattening_threshold * l || levels[top] == 0) {
|
||||
// good enough, we pop it off and add the endpoint
|
||||
polygon.add(QPointF(b->x4, b->y4));
|
||||
--b;
|
||||
--lvl;
|
||||
--top;
|
||||
} else {
|
||||
// split, second half of the polygon goes lower into the stack
|
||||
std::tie(b[1], b[0]) = b->split();
|
||||
lvl[1] = --lvl[0];
|
||||
++b;
|
||||
++lvl;
|
||||
levels[top + 1] = --levels[top];
|
||||
++top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,8 +152,7 @@ QColorMatrix QColorSpacePrimaries::toXyzMatrix() const
|
||||
}
|
||||
|
||||
QColorSpacePrivate::QColorSpacePrivate()
|
||||
: id(QColorSpace::Unknown)
|
||||
, primaries(QColorSpace::Primaries::Custom)
|
||||
: primaries(QColorSpace::Primaries::Custom)
|
||||
, transferFunction(QColorSpace::TransferFunction::Custom)
|
||||
, gamma(0.0f)
|
||||
, whitePoint(QColorVector::null())
|
||||
@ -161,16 +160,11 @@ QColorSpacePrivate::QColorSpacePrivate()
|
||||
{
|
||||
}
|
||||
|
||||
QColorSpacePrivate::QColorSpacePrivate(QColorSpace::ColorSpaceId colorSpaceId)
|
||||
: id(colorSpaceId)
|
||||
QColorSpacePrivate::QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSpace)
|
||||
: namedColorSpace(namedColorSpace)
|
||||
, gamma(0.0f)
|
||||
{
|
||||
switch (colorSpaceId) {
|
||||
case QColorSpace::Undefined:
|
||||
primaries = QColorSpace::Primaries::Custom;
|
||||
transferFunction = QColorSpace::TransferFunction::Custom;
|
||||
description = QStringLiteral("Undefined");
|
||||
break;
|
||||
switch (namedColorSpace) {
|
||||
case QColorSpace::SRgb:
|
||||
primaries = QColorSpace::Primaries::SRgb;
|
||||
transferFunction = QColorSpace::TransferFunction::SRgb;
|
||||
@ -202,9 +196,6 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::ColorSpaceId colorSpaceId)
|
||||
transferFunction = QColorSpace::TransferFunction::Bt2020;
|
||||
description = QStringLiteral("BT.2020");
|
||||
break;
|
||||
case QColorSpace::Unknown:
|
||||
qWarning("Can not create an unknown color space");
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
@ -216,8 +207,7 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::Primaries primaries, QColorS
|
||||
, transferFunction(fun)
|
||||
, gamma(gamma)
|
||||
{
|
||||
if (!identifyColorSpace())
|
||||
id = QColorSpace::Unknown;
|
||||
identifyColorSpace();
|
||||
initialize();
|
||||
}
|
||||
|
||||
@ -235,71 +225,71 @@ QColorSpacePrivate::QColorSpacePrivate(const QColorSpacePrimaries &primaries,
|
||||
setTransferFunction();
|
||||
}
|
||||
|
||||
bool QColorSpacePrivate::identifyColorSpace()
|
||||
void QColorSpacePrivate::identifyColorSpace()
|
||||
{
|
||||
switch (primaries) {
|
||||
case QColorSpace::Primaries::SRgb:
|
||||
if (transferFunction == QColorSpace::TransferFunction::SRgb) {
|
||||
id = QColorSpace::SRgb;
|
||||
namedColorSpace = QColorSpace::SRgb;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("sRGB");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (transferFunction == QColorSpace::TransferFunction::Linear) {
|
||||
id = QColorSpace::SRgbLinear;
|
||||
namedColorSpace = QColorSpace::SRgbLinear;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("Linear sRGB");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case QColorSpace::Primaries::AdobeRgb:
|
||||
if (transferFunction == QColorSpace::TransferFunction::Gamma) {
|
||||
if (qAbs(gamma - 2.19921875f) < (1/1024.0f)) {
|
||||
id = QColorSpace::AdobeRgb;
|
||||
namedColorSpace = QColorSpace::AdobeRgb;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("Adobe RGB");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QColorSpace::Primaries::DciP3D65:
|
||||
if (transferFunction == QColorSpace::TransferFunction::SRgb) {
|
||||
id = QColorSpace::DisplayP3;
|
||||
namedColorSpace = QColorSpace::DisplayP3;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("Display P3");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case QColorSpace::Primaries::ProPhotoRgb:
|
||||
if (transferFunction == QColorSpace::TransferFunction::ProPhotoRgb) {
|
||||
id = QColorSpace::ProPhotoRgb;
|
||||
namedColorSpace = QColorSpace::ProPhotoRgb;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("ProPhoto RGB");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (transferFunction == QColorSpace::TransferFunction::Gamma) {
|
||||
// ProPhoto RGB's curve is effectively gamma 1.8 for 8bit precision.
|
||||
if (qAbs(gamma - 1.8f) < (1/1024.0f)) {
|
||||
id = QColorSpace::ProPhotoRgb;
|
||||
namedColorSpace = QColorSpace::ProPhotoRgb;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("ProPhoto RGB");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QColorSpace::Primaries::Bt2020:
|
||||
if (transferFunction == QColorSpace::TransferFunction::Bt2020) {
|
||||
id = QColorSpace::Bt2020;
|
||||
namedColorSpace = QColorSpace::Bt2020;
|
||||
if (description.isEmpty())
|
||||
description = QStringLiteral("BT.2020");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
id = QColorSpace::Unknown;
|
||||
return false;
|
||||
|
||||
namedColorSpace = Unknown;
|
||||
}
|
||||
|
||||
void QColorSpacePrivate::initialize()
|
||||
@ -410,12 +400,10 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
|
||||
|
||||
|
||||
/*!
|
||||
\enum QColorSpace::ColorSpaceId
|
||||
\enum QColorSpace::NamedColorSpace
|
||||
|
||||
Predefined color spaces.
|
||||
|
||||
\value Undefined An empty, invalid or unsupported color space.
|
||||
\value Unknown A valid color space that doesn't match any of the predefined color spaces.
|
||||
\value SRgb The sRGB color space, which Qt operates in by default. It is a close approximation
|
||||
of how most classic monitors operate, and a mode most software and hardware support.
|
||||
\l{http://www.color.org/chardata/rgb/srgb.xalter}{ICC registration of sRGB}.
|
||||
@ -458,22 +446,25 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
|
||||
*/
|
||||
|
||||
/*!
|
||||
Creates a new colorspace object that represents \a colorSpaceId.
|
||||
Creates a new colorspace object that represents an undefined and invalid colorspace.
|
||||
*/
|
||||
QColorSpace::QColorSpace(QColorSpace::ColorSpaceId colorSpaceId)
|
||||
: d_ptr(nullptr)
|
||||
QColorSpace::QColorSpace()
|
||||
{
|
||||
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::Bt2020];
|
||||
// Unknown and undefined both returns the static undefined colorspace
|
||||
if (colorSpaceId > QColorSpace::Unknown) {
|
||||
if (!predefinedColorspacePrivates[colorSpaceId - 2]) {
|
||||
predefinedColorspacePrivates[colorSpaceId - 2] = new QColorSpacePrivate(colorSpaceId);
|
||||
predefinedColorspacePrivates[colorSpaceId - 2]->ref.ref();
|
||||
}
|
||||
d_ptr = predefinedColorspacePrivates[colorSpaceId - 2];
|
||||
d_ptr->ref.ref();
|
||||
Q_ASSERT(isValid());
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a new colorspace object that represents a \a namedColorSpace.
|
||||
*/
|
||||
QColorSpace::QColorSpace(NamedColorSpace namedColorSpace)
|
||||
{
|
||||
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::Bt2020 + 1];
|
||||
if (!predefinedColorspacePrivates[namedColorSpace]) {
|
||||
predefinedColorspacePrivates[namedColorSpace] = new QColorSpacePrivate(namedColorSpace);
|
||||
predefinedColorspacePrivates[namedColorSpace]->ref.ref();
|
||||
}
|
||||
d_ptr = predefinedColorspacePrivates[namedColorSpace];
|
||||
d_ptr->ref.ref();
|
||||
Q_ASSERT(isValid());
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -544,17 +535,6 @@ QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
|
||||
never fails.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns the id of the predefined color space this object
|
||||
represents or \c Unknown if it doesn't match any of them.
|
||||
*/
|
||||
QColorSpace::ColorSpaceId QColorSpace::colorSpaceId() const noexcept
|
||||
{
|
||||
if (Q_UNLIKELY(!d_ptr))
|
||||
return QColorSpace::Undefined;
|
||||
return d_ptr->id;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the predefined primaries of the color space
|
||||
or \c primaries::Custom if it doesn't match any of them.
|
||||
@ -596,8 +576,6 @@ float QColorSpace::gamma() const noexcept
|
||||
/*!
|
||||
Sets the transfer function to \a transferFunction and \a gamma.
|
||||
|
||||
\note This also changes colorSpaceId().
|
||||
|
||||
\sa transferFunction(), gamma(), withTransferFunction()
|
||||
*/
|
||||
void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma)
|
||||
@ -634,8 +612,6 @@ QColorSpace QColorSpace::withTransferFunction(QColorSpace::TransferFunction tran
|
||||
/*!
|
||||
Sets the primaries to those of the \a primariesId set.
|
||||
|
||||
\note This also changes colorSpaceId().
|
||||
|
||||
\sa primaries()
|
||||
*/
|
||||
void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
|
||||
@ -655,8 +631,6 @@ void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
|
||||
Set primaries to the chromaticities of \a whitePoint, \a redPoint, \a greenPoint
|
||||
and \a bluePoint.
|
||||
|
||||
\note This also changes colorSpaceId().
|
||||
|
||||
\sa primaries()
|
||||
*/
|
||||
void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoint,
|
||||
@ -718,7 +692,6 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
|
||||
if (QIcc::fromIccProfile(iccProfile, &colorSpace))
|
||||
return colorSpace;
|
||||
QColorSpacePrivate *d = QColorSpacePrivate::getWritable(colorSpace);
|
||||
d->id = QColorSpace::Undefined;
|
||||
d->iccProfile = iccProfile;
|
||||
return colorSpace;
|
||||
}
|
||||
@ -728,7 +701,8 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
|
||||
*/
|
||||
bool QColorSpace::isValid() const noexcept
|
||||
{
|
||||
return d_ptr && d_ptr->id != QColorSpace::Undefined && d_ptr->toXyz.isValid()
|
||||
return d_ptr
|
||||
&& d_ptr->toXyz.isValid()
|
||||
&& d_ptr->trc[0].isValid() && d_ptr->trc[1].isValid() && d_ptr->trc[2].isValid();
|
||||
}
|
||||
|
||||
@ -744,11 +718,17 @@ bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
|
||||
if (!colorSpace1.d_ptr || !colorSpace2.d_ptr)
|
||||
return false;
|
||||
|
||||
if (colorSpace1.colorSpaceId() == QColorSpace::Undefined && colorSpace2.colorSpaceId() == QColorSpace::Undefined)
|
||||
return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile;
|
||||
if (colorSpace1.d_ptr->namedColorSpace && colorSpace2.d_ptr->namedColorSpace)
|
||||
return colorSpace1.d_ptr->namedColorSpace == colorSpace2.d_ptr->namedColorSpace;
|
||||
|
||||
if (colorSpace1.colorSpaceId() != QColorSpace::Unknown && colorSpace2.colorSpaceId() != QColorSpace::Unknown)
|
||||
return colorSpace1.colorSpaceId() == colorSpace2.colorSpaceId();
|
||||
const bool valid1 = colorSpace1.isValid();
|
||||
const bool valid2 = colorSpace2.isValid();
|
||||
if (!valid1 && !valid2)
|
||||
return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile;
|
||||
else if (!valid1 || !valid2)
|
||||
return false;
|
||||
|
||||
// At this point one or both color spaces are unknown but valid, and must be compared in detail instead
|
||||
|
||||
if (colorSpace1.primaries() != QColorSpace::Primaries::Custom && colorSpace2.primaries() != QColorSpace::Primaries::Custom) {
|
||||
if (colorSpace1.primaries() != colorSpace2.primaries())
|
||||
@ -839,7 +819,9 @@ QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
|
||||
QDebugStateSaver saver(dbg);
|
||||
dbg.nospace();
|
||||
dbg << "QColorSpace(";
|
||||
dbg << colorSpace.colorSpaceId() << ", " << colorSpace.primaries() << ", " << colorSpace.transferFunction();
|
||||
if (colorSpace.d_ptr->namedColorSpace)
|
||||
dbg << colorSpace.d_ptr->namedColorSpace << ", ";
|
||||
dbg << colorSpace.primaries() << ", " << colorSpace.transferFunction();
|
||||
dbg << ", gamma=" << colorSpace.gamma();
|
||||
dbg << ')';
|
||||
return dbg;
|
||||
|
@ -54,17 +54,15 @@ class Q_GUI_EXPORT QColorSpace
|
||||
{
|
||||
Q_GADGET
|
||||
public:
|
||||
enum ColorSpaceId {
|
||||
Undefined = 0,
|
||||
Unknown = 1,
|
||||
SRgb,
|
||||
enum NamedColorSpace {
|
||||
SRgb = 1,
|
||||
SRgbLinear,
|
||||
AdobeRgb,
|
||||
DisplayP3,
|
||||
ProPhotoRgb,
|
||||
Bt2020,
|
||||
};
|
||||
Q_ENUM(ColorSpaceId)
|
||||
Q_ENUM(NamedColorSpace)
|
||||
enum class Primaries {
|
||||
Custom = 0,
|
||||
SRgb,
|
||||
@ -84,7 +82,8 @@ public:
|
||||
};
|
||||
Q_ENUM(TransferFunction)
|
||||
|
||||
QColorSpace(ColorSpaceId colorSpaceId = Undefined);
|
||||
QColorSpace();
|
||||
QColorSpace(NamedColorSpace namedColorSpace);
|
||||
QColorSpace(Primaries primaries, TransferFunction fun, float gamma = 0.0f);
|
||||
QColorSpace(Primaries primaries, float gamma);
|
||||
QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
|
||||
@ -108,7 +107,6 @@ public:
|
||||
void swap(QColorSpace &colorSpace) noexcept
|
||||
{ qSwap(d_ptr, colorSpace.d_ptr); }
|
||||
|
||||
ColorSpaceId colorSpaceId() const noexcept;
|
||||
Primaries primaries() const noexcept;
|
||||
TransferFunction transferFunction() const noexcept;
|
||||
float gamma() const noexcept;
|
||||
@ -133,7 +131,11 @@ public:
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QColorSpace)
|
||||
QColorSpacePrivate *d_ptr;
|
||||
QColorSpacePrivate *d_ptr = nullptr;
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace);
|
||||
#endif
|
||||
};
|
||||
|
||||
bool Q_GUI_EXPORT operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2);
|
||||
|
@ -62,7 +62,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_GUI_EXPORT QColorSpacePrimaries
|
||||
class Q_AUTOTEST_EXPORT QColorSpacePrimaries
|
||||
{
|
||||
public:
|
||||
QColorSpacePrimaries() = default;
|
||||
@ -90,7 +90,7 @@ class QColorSpacePrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
QColorSpacePrivate();
|
||||
QColorSpacePrivate(QColorSpace::ColorSpaceId colorSpaceId);
|
||||
QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSpace);
|
||||
QColorSpacePrivate(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma);
|
||||
QColorSpacePrivate(const QColorSpacePrimaries &primaries, QColorSpace::TransferFunction fun, float gamma);
|
||||
QColorSpacePrivate(const QColorSpacePrivate &other) = default;
|
||||
@ -118,10 +118,12 @@ public:
|
||||
void initialize();
|
||||
void setToXyzMatrix();
|
||||
void setTransferFunction();
|
||||
bool identifyColorSpace();
|
||||
void identifyColorSpace();
|
||||
QColorTransform transformationToColorSpace(const QColorSpacePrivate *out) const;
|
||||
|
||||
QColorSpace::ColorSpaceId id;
|
||||
static constexpr QColorSpace::NamedColorSpace Unknown = QColorSpace::NamedColorSpace(0);
|
||||
QColorSpace::NamedColorSpace namedColorSpace = Unknown;
|
||||
|
||||
QColorSpace::Primaries primaries;
|
||||
QColorSpace::TransferFunction transferFunction;
|
||||
float gamma;
|
||||
|
@ -765,10 +765,9 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
|
||||
qCDebug(lcIcc) << "fromIccProfile: Description" << colorspaceDPtr->description;
|
||||
}
|
||||
|
||||
if (!colorspaceDPtr->identifyColorSpace())
|
||||
colorspaceDPtr->id = QColorSpace::Unknown;
|
||||
else
|
||||
qCDebug(lcIcc) << "fromIccProfile: Named colorspace detected: " << colorSpace->colorSpaceId();
|
||||
colorspaceDPtr->identifyColorSpace();
|
||||
if (colorspaceDPtr->namedColorSpace)
|
||||
qCDebug(lcIcc) << "fromIccProfile: Named colorspace detected: " << QColorSpace::NamedColorSpace(colorspaceDPtr->namedColorSpace);
|
||||
|
||||
colorspaceDPtr->iccProfile = data;
|
||||
|
||||
|
@ -60,8 +60,8 @@ class QColorSpace;
|
||||
|
||||
namespace QIcc {
|
||||
|
||||
Q_GUI_EXPORT bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace);
|
||||
Q_GUI_EXPORT QByteArray toIccProfile(const QColorSpace &space);
|
||||
bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace);
|
||||
QByteArray toIccProfile(const QColorSpace &space);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2214,7 +2214,7 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img)
|
||||
const QClipData *clip = d->clip();
|
||||
QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy());
|
||||
|
||||
if (d->canUseImageBlitting(d->rasterBuffer->compositionMode, img)) {
|
||||
if (d->canUseImageBlitting(d->rasterBuffer->compositionMode, img, pt, img.rect())) {
|
||||
if (!clip) {
|
||||
d->blitImage(pt, img, d->deviceRect);
|
||||
return;
|
||||
@ -2285,7 +2285,12 @@ namespace {
|
||||
return NoRotation;
|
||||
}
|
||||
|
||||
inline bool isPixelAligned(const QRectF &rect) {
|
||||
inline bool isPixelAligned(const QPointF &pt)
|
||||
{
|
||||
return QPointF(pt.toPoint()) == pt;
|
||||
}
|
||||
inline bool isPixelAligned(const QRectF &rect)
|
||||
{
|
||||
return QRectF(rect.toRect()) == rect;
|
||||
}
|
||||
}
|
||||
@ -2353,17 +2358,12 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
|
||||
const QClipData *clip = d->clip();
|
||||
|
||||
if (s->matrix.type() > QTransform::TxTranslate
|
||||
if (s->matrix.type() == QTransform::TxRotate
|
||||
&& !stretch_sr
|
||||
&& (!clip || clip->hasRectClip)
|
||||
&& s->intOpacity == 256
|
||||
&& (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
|
||||
|| d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)
|
||||
&& d->rasterBuffer->format == img.format()
|
||||
&& (d->rasterBuffer->format == QImage::Format_RGB16
|
||||
|| d->rasterBuffer->format == QImage::Format_RGB32
|
||||
|| (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
|
||||
&& d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)))
|
||||
|| d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source))
|
||||
{
|
||||
RotationType rotationType = qRotationType(s->matrix);
|
||||
const QPixelLayout::BPP plBpp = qPixelLayouts[d->rasterBuffer->format].bpp;
|
||||
@ -2371,9 +2371,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
if (rotationType != NoRotation && qMemRotateFunctions[plBpp][rotationType] && img.rect().contains(sr.toAlignedRect())) {
|
||||
QRectF transformedTargetRect = s->matrix.mapRect(r);
|
||||
|
||||
if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing))
|
||||
|| (isPixelAligned(transformedTargetRect) && isPixelAligned(sr)))
|
||||
{
|
||||
if (d->canUseImageBlitting(d->rasterBuffer->compositionMode, img, transformedTargetRect.topRight(), sr)) {
|
||||
QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect);
|
||||
if (clippedTransformedTargetRect.isNull())
|
||||
return;
|
||||
@ -2507,8 +2505,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
fillPath(path, &d->image_filler_xform);
|
||||
s->matrix = m;
|
||||
} else {
|
||||
if (d->canUseImageBlitting(d->rasterBuffer->compositionMode, img)) {
|
||||
QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy());
|
||||
QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy());
|
||||
if (d->canUseImageBlitting(d->rasterBuffer->compositionMode, img, pt, sr)) {
|
||||
if (!clip) {
|
||||
d->blitImage(pt, img, d->deviceRect, sr.toRect());
|
||||
return;
|
||||
@ -2519,7 +2517,6 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
} else if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
|
||||
SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
|
||||
if (func) {
|
||||
QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy());
|
||||
if (!clip) {
|
||||
d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect());
|
||||
return;
|
||||
@ -3754,12 +3751,22 @@ bool QRasterPaintEnginePrivate::canUseFastImageBlending(QPainter::CompositionMod
|
||||
&& !image.hasAlphaChannel()));
|
||||
}
|
||||
|
||||
bool QRasterPaintEnginePrivate::canUseImageBlitting(QPainter::CompositionMode mode, const QImage &image) const
|
||||
bool QRasterPaintEnginePrivate::canUseImageBlitting(QPainter::CompositionMode mode, const QImage &image, const QPointF &pt, const QRectF &sr) const
|
||||
{
|
||||
Q_Q(const QRasterPaintEngine);
|
||||
const QRasterPaintEngineState *s = q->state();
|
||||
|
||||
if (!s->flags.fast_images || s->intOpacity != 256 || qt_depthForFormat(rasterBuffer->format) < 8)
|
||||
if (!(mode == QPainter::CompositionMode_Source
|
||||
|| (mode == QPainter::CompositionMode_SourceOver
|
||||
&& !image.hasAlphaChannel())))
|
||||
return false;
|
||||
|
||||
const QRasterPaintEngineState *s = q->state();
|
||||
Q_ASSERT(s->matrix.type() <= QTransform::TxTranslate || s->matrix.type() == QTransform::TxRotate);
|
||||
|
||||
if (s->intOpacity != 256
|
||||
|| image.depth() < 8
|
||||
|| ((s->renderHints & (QPainter::SmoothPixmapTransform | QPainter::Antialiasing))
|
||||
&& (!isPixelAligned(pt) || !isPixelAligned(sr))))
|
||||
return false;
|
||||
|
||||
QImage::Format dFormat = rasterBuffer->format;
|
||||
@ -3767,18 +3774,13 @@ bool QRasterPaintEnginePrivate::canUseImageBlitting(QPainter::CompositionMode mo
|
||||
// Formats must match or source format must be a subset of destination format
|
||||
if (dFormat != sFormat && image.pixelFormat().alphaUsage() == QPixelFormat::IgnoresAlpha) {
|
||||
if ((sFormat == QImage::Format_RGB32 && dFormat == QImage::Format_ARGB32)
|
||||
|| (sFormat == QImage::Format_RGBX8888 && dFormat == QImage::Format_RGBA8888))
|
||||
|| (sFormat == QImage::Format_RGBX8888 && dFormat == QImage::Format_RGBA8888)
|
||||
|| (sFormat == QImage::Format_RGBX64 && dFormat == QImage::Format_RGBA64))
|
||||
sFormat = dFormat;
|
||||
else
|
||||
sFormat = qt_maybeAlphaVersionWithSameDepth(sFormat); // this returns premul formats
|
||||
}
|
||||
if (dFormat != sFormat)
|
||||
return false;
|
||||
|
||||
return s->matrix.type() <= QTransform::TxTranslate
|
||||
&& (mode == QPainter::CompositionMode_Source
|
||||
|| (mode == QPainter::CompositionMode_SourceOver
|
||||
&& !image.hasAlphaChannel()));
|
||||
return (dFormat == sFormat);
|
||||
}
|
||||
|
||||
QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
|
||||
|
@ -306,7 +306,7 @@ public:
|
||||
|
||||
void recalculateFastImages();
|
||||
bool canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const;
|
||||
bool canUseImageBlitting(QPainter::CompositionMode mode, const QImage &image) const;
|
||||
bool canUseImageBlitting(QPainter::CompositionMode mode, const QImage &image, const QPointF &pt, const QRectF &sr) const;
|
||||
|
||||
QPaintDevice *device;
|
||||
QScopedPointer<QOutlineMapper> outlineMapper;
|
||||
|
@ -88,60 +88,6 @@ QT_BEGIN_NAMESPACE
|
||||
Example of using complex regions:
|
||||
\snippet code/src_gui_painting_qregion.cpp 0
|
||||
|
||||
\section1 Additional License Information
|
||||
|
||||
On Embedded Linux and X11 platforms, parts of this class rely on
|
||||
code obtained under the following licenses:
|
||||
|
||||
\legalese
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
\endlegalese
|
||||
|
||||
\br
|
||||
|
||||
\legalese
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
\endlegalese
|
||||
|
||||
\sa QPainter::setClipRegion(), QPainter::setClipRect(), QPainterPath
|
||||
*/
|
||||
|
||||
|
@ -41,5 +41,20 @@
|
||||
"LicenseId": "MIT",
|
||||
"LicenseFile": "WEBGRADIENTS_LICENSE.txt",
|
||||
"Copyright": "Copyright (c) 2017 itmeo"
|
||||
},
|
||||
{
|
||||
"Id": "xserverhelper",
|
||||
"Name": "X Server helper",
|
||||
"QDocModule": "qtgui",
|
||||
"QtUsage": "Used in Qt GUI (QRegion).",
|
||||
"Files": "qregion.cpp",
|
||||
|
||||
"Description": "Code from X11's region.h, Region.c, poly.h, and PolyReg.c",
|
||||
"Homepage": "https://www.x.org/",
|
||||
"License": "X11 License and Historical Permission Notice and Disclaimer",
|
||||
"LicenseId": "X11 AND HPND",
|
||||
"LicenseFile": "XCONSORTIUM_LICENSE.txt",
|
||||
"Copyright": "Copyright (c) 1987, 1988 X Consortium
|
||||
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts."
|
||||
}
|
||||
]
|
||||
|
@ -450,7 +450,7 @@ QShaderKey::QShaderKey(QShader::Source s,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the two QShader objects \a a and \a b are equal,
|
||||
Returns \c true if the two QShader objects \a lhs and \a rhs are equal,
|
||||
meaning they are for the same stage with matching sets of shader source or
|
||||
binary code.
|
||||
|
||||
@ -486,7 +486,7 @@ uint qHash(const QShader &s, uint seed) Q_DECL_NOTHROW
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the two QShaderVersion objects \a a and \a b are
|
||||
Returns \c true if the two QShaderVersion objects \a lhs and \a rhs are
|
||||
equal.
|
||||
|
||||
\relates QShaderVersion
|
||||
@ -506,7 +506,7 @@ bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOT
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns \c true if the two QShaderKey objects \a a and \a b are equal.
|
||||
Returns \c true if the two QShaderKey objects \a lhs and \a rhs are equal.
|
||||
|
||||
\relates QShaderKey
|
||||
*/
|
||||
@ -536,7 +536,7 @@ uint qHash(const QShaderKey &k, uint seed) Q_DECL_NOTHROW
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the two QShaderCode objects \a a and \a b are equal.
|
||||
Returns \c true if the two QShaderCode objects \a lhs and \a rhs are equal.
|
||||
|
||||
\relates QShaderCode
|
||||
*/
|
||||
|
@ -2210,6 +2210,23 @@ VkQueue QVulkanWindow::graphicsQueue() const
|
||||
return d->gfxQueue;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the family index of the active graphics queue.
|
||||
|
||||
\note Calling this function is only valid from the invocation of
|
||||
QVulkanWindowRenderer::initResources() up until
|
||||
QVulkanWindowRenderer::releaseResources(). Implementations of
|
||||
QVulkanWindowRenderer::updateQueueCreateInfo() can also call this
|
||||
function.
|
||||
|
||||
\since 5.15
|
||||
*/
|
||||
uint32_t QVulkanWindow::graphicsQueueFamilyIndex() const
|
||||
{
|
||||
Q_D(const QVulkanWindow);
|
||||
return d->gfxQueueFamilyIdx;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the active graphics command pool.
|
||||
|
||||
|
@ -112,6 +112,7 @@ public:
|
||||
const VkPhysicalDeviceProperties *physicalDeviceProperties() const;
|
||||
VkDevice device() const;
|
||||
VkQueue graphicsQueue() const;
|
||||
uint32_t graphicsQueueFamilyIndex() const;
|
||||
VkCommandPool graphicsCommandPool() const;
|
||||
uint32_t hostVisibleMemoryIndex() const;
|
||||
uint32_t deviceLocalMemoryIndex() const;
|
||||
|
@ -758,8 +758,9 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
|
||||
quint64 requestStartOffset = requestRange.left(index).toULongLong();
|
||||
quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong();
|
||||
|
||||
// In case an end offset is not given it is skipped from the request range
|
||||
requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) +
|
||||
'-' + QByteArray::number(requestEndOffset);
|
||||
'-' + (requestEndOffset ? QByteArray::number(requestEndOffset) : QByteArray());
|
||||
|
||||
httpRequest.setHeaderField("Range", requestRange);
|
||||
} else {
|
||||
|
@ -63,6 +63,8 @@ static void q_requestErrorCallback(val event)
|
||||
return;
|
||||
|
||||
val xhr = event["target"];
|
||||
if (xhr.isNull() || xhr.isUndefined())
|
||||
return;
|
||||
|
||||
quintptr func = xhr["data-handler"].as<quintptr>();
|
||||
QNetworkReplyWasmImplPrivate *reply = reinterpret_cast<QNetworkReplyWasmImplPrivate*>(func);
|
||||
@ -84,6 +86,8 @@ static void q_progressCallback(val event)
|
||||
return;
|
||||
|
||||
val xhr = event["target"];
|
||||
if (xhr.isNull() || xhr.isUndefined())
|
||||
return;
|
||||
|
||||
QNetworkReplyWasmImplPrivate *reply =
|
||||
reinterpret_cast<QNetworkReplyWasmImplPrivate*>(xhr["data-handler"].as<quintptr>());
|
||||
@ -99,6 +103,8 @@ static void q_loadCallback(val event)
|
||||
return;
|
||||
|
||||
val xhr = event["target"];
|
||||
if (xhr.isNull() || xhr.isUndefined())
|
||||
return;
|
||||
|
||||
QNetworkReplyWasmImplPrivate *reply =
|
||||
reinterpret_cast<QNetworkReplyWasmImplPrivate*>(xhr["data-handler"].as<quintptr>());
|
||||
@ -123,8 +129,13 @@ static void q_loadCallback(val event)
|
||||
} else if (responseType == "arraybuffer" || responseType == "blob") {
|
||||
// handle this data in the FileReader, triggered by the call to readAsArrayBuffer
|
||||
val blob = xhr["response"];
|
||||
if (blob.isNull() || blob.isUndefined())
|
||||
return;
|
||||
|
||||
val reader = val::global("FileReader").new_();
|
||||
if (reader.isNull() || reader.isUndefined())
|
||||
return;
|
||||
|
||||
reader.set("onload", val::module_property("qt_QNetworkReplyWasmImplPrivate_readBinary"));
|
||||
reader.set("data-handler", xhr["data-handler"]);
|
||||
|
||||
@ -151,6 +162,8 @@ static void q_responseHeadersCallback(val event)
|
||||
return;
|
||||
|
||||
val xhr = event["target"];
|
||||
if (xhr.isNull() || xhr.isUndefined())
|
||||
return;
|
||||
|
||||
if (xhr["readyState"].as<int>() == 2) { // HEADERS_RECEIVED
|
||||
std::string responseHeaders = xhr.call<std::string>("getAllResponseHeaders");
|
||||
@ -170,6 +183,8 @@ static void q_readBinary(val event)
|
||||
return;
|
||||
|
||||
val fileReader = event["target"];
|
||||
if (fileReader.isNull() || fileReader.isUndefined())
|
||||
return;
|
||||
|
||||
QNetworkReplyWasmImplPrivate *reply =
|
||||
reinterpret_cast<QNetworkReplyWasmImplPrivate*>(fileReader["data-handler"].as<quintptr>());
|
||||
@ -180,6 +195,9 @@ static void q_readBinary(val event)
|
||||
|
||||
// Set up source typed array
|
||||
val result = fileReader["result"]; // ArrayBuffer
|
||||
if (result.isNull() || result.isUndefined())
|
||||
return;
|
||||
|
||||
val Uint8Array = val::global("Uint8Array");
|
||||
val sourceTypedArray = Uint8Array.new_(result);
|
||||
|
||||
|
@ -385,7 +385,11 @@
|
||||
"purpose": "Provides bearer management for the network stack.",
|
||||
"section": "Networking",
|
||||
"condition": "features.thread && features.library && features.networkinterface && features.properties",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
"output": [
|
||||
"publicFeature",
|
||||
"feature",
|
||||
{ "type": "define", "negative": true, "name": "QT_NO_BEARERMANAGEMENT" }
|
||||
]
|
||||
},
|
||||
"localserver": {
|
||||
"label": "QLocalServer",
|
||||
|
@ -595,7 +595,9 @@ QHostInfo::QHostInfo(const QHostInfo &other)
|
||||
}
|
||||
|
||||
/*!
|
||||
Move-constucts a new QHostInfo from \a other.
|
||||
\fn QHostInfo(QHostInfo &&other)
|
||||
|
||||
Move-constructs a new QHostInfo from \a other.
|
||||
|
||||
\note The moved-from object \a other is placed in a
|
||||
partially-formed state, in which the only valid operations are
|
||||
|
@ -485,6 +485,7 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
|
||||
struct ifreq req;
|
||||
};
|
||||
int socket = -1;
|
||||
memset(&mediareq, 0, sizeof(mediareq));
|
||||
|
||||
// ensure both structs start with the name field, of size IFNAMESIZ
|
||||
Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));
|
||||
|
@ -157,32 +157,36 @@ SSL* QSslContext::createSsl()
|
||||
for (int a = 0; a < protocols.count(); ++a) {
|
||||
if (protocols.at(a).size() > 255) {
|
||||
qCWarning(lcSsl) << "TLS NPN extension" << protocols.at(a)
|
||||
<< "is too long and will be truncated to 255 characters.";
|
||||
protocols[a] = protocols.at(a).left(255);
|
||||
<< "is too long and will be ignored.";
|
||||
continue;
|
||||
} else if (protocols.at(a).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
m_supportedNPNVersions.append(protocols.at(a).size()).append(protocols.at(a));
|
||||
}
|
||||
m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data());
|
||||
m_npnContext.len = m_supportedNPNVersions.count();
|
||||
m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone;
|
||||
if (m_supportedNPNVersions.size()) {
|
||||
m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data());
|
||||
m_npnContext.len = m_supportedNPNVersions.count();
|
||||
m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) {
|
||||
// Callback's type has a parameter 'const unsigned char ** out'
|
||||
// since it was introduced in 1.0.2. Internally, OpenSSL's own code
|
||||
// (tests/examples) cast it to unsigned char * (since it's 'out').
|
||||
// We just re-use our NPN callback and cast here:
|
||||
typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *,
|
||||
const unsigned char *, unsigned int, void *);
|
||||
// With ALPN callback is for a server side only, for a client m_npnContext.status
|
||||
// will stay in NextProtocolNegotiationNone.
|
||||
q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext);
|
||||
// Client:
|
||||
q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len);
|
||||
}
|
||||
if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) {
|
||||
// Callback's type has a parameter 'const unsigned char ** out'
|
||||
// since it was introduced in 1.0.2. Internally, OpenSSL's own code
|
||||
// (tests/examples) cast it to unsigned char * (since it's 'out').
|
||||
// We just re-use our NPN callback and cast here:
|
||||
typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *,
|
||||
const unsigned char *, unsigned int, void *);
|
||||
// With ALPN callback is for a server side only, for a client m_npnContext.status
|
||||
// will stay in NextProtocolNegotiationNone.
|
||||
q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext);
|
||||
// Client:
|
||||
q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len);
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ...
|
||||
|
||||
// And in case our peer does not support ALPN, but supports NPN:
|
||||
q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext);
|
||||
// And in case our peer does not support ALPN, but supports NPN:
|
||||
q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext);
|
||||
}
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
|
||||
|
||||
|
@ -928,6 +928,13 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
QCFType<CFMutableArrayRef> cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks));
|
||||
if (cfNames) {
|
||||
for (const QByteArray &name : protocolNames) {
|
||||
if (name.size() > 255) {
|
||||
qCWarning(lcSsl) << "TLS ALPN extension" << name
|
||||
<< "is too long and will be ignored.";
|
||||
continue;
|
||||
} else if (name.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QCFString cfName(QString::fromLatin1(name).toCFString());
|
||||
CFArrayAppendValue(cfNames, cfName);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ static QAsn1Element _q_PKCS7_data(const QByteArray &data)
|
||||
|
||||
Some test vectors:
|
||||
http://www.drh-consultancy.demon.co.uk/test.txt
|
||||
\internal
|
||||
*/
|
||||
static QByteArray _q_PKCS12_keygen(char id, const QByteArray &salt, const QString &passPhrase, int n, int r)
|
||||
{
|
||||
|
@ -408,13 +408,17 @@ QByteArray createAlpnString(const QByteArrayList &nextAllowedProtocols)
|
||||
for (QByteArray proto : nextAllowedProtocols) {
|
||||
if (proto.size() > 255) {
|
||||
qCWarning(lcSsl) << "TLS ALPN extension" << proto
|
||||
<< "is too long and will be truncated to 255 characters.";
|
||||
proto = proto.left(255);
|
||||
<< "is too long and will be ignored.";
|
||||
continue;
|
||||
} else if (proto.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
protocolString += char(proto.length()) + proto;
|
||||
}
|
||||
return protocolString;
|
||||
}();
|
||||
if (names.isEmpty())
|
||||
return alpnString;
|
||||
|
||||
const quint16 namesSize = names.size();
|
||||
const quint32 alpnId = SecApplicationProtocolNegotiationExt_ALPN;
|
||||
|
@ -355,10 +355,14 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
|
||||
}
|
||||
qCDebug(qLcKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName;
|
||||
|
||||
const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QStringLiteral("xrgb8888"))
|
||||
const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QString())
|
||||
.toByteArray().toLower();
|
||||
uint32_t drmFormat;
|
||||
if (formatStr == "xrgb8888") {
|
||||
bool drmFormatExplicit = true;
|
||||
if (formatStr.isEmpty()) {
|
||||
drmFormat = DRM_FORMAT_XRGB8888;
|
||||
drmFormatExplicit = false;
|
||||
} else if (formatStr == "xrgb8888") {
|
||||
drmFormat = DRM_FORMAT_XRGB8888;
|
||||
} else if (formatStr == "xbgr8888") {
|
||||
drmFormat = DRM_FORMAT_XBGR8888;
|
||||
@ -381,7 +385,10 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
|
||||
} else {
|
||||
qWarning("Invalid pixel format \"%s\" for output %s", formatStr.constData(), connectorName.constData());
|
||||
drmFormat = DRM_FORMAT_XRGB8888;
|
||||
drmFormatExplicit = false;
|
||||
}
|
||||
qCDebug(qLcKmsDebug) << "Format is" << hex << drmFormat << dec << "requested_by_user =" << drmFormatExplicit
|
||||
<< "for output" << connectorName;
|
||||
|
||||
const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString();
|
||||
if (!cloneSource.isEmpty())
|
||||
@ -427,6 +434,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
|
||||
output.forced_plane_id = 0;
|
||||
output.forced_plane_set = false;
|
||||
output.drm_format = drmFormat;
|
||||
output.drm_format_requested_by_user = drmFormatExplicit;
|
||||
output.clone_source = cloneSource;
|
||||
output.size = framebufferSize;
|
||||
|
||||
|
@ -202,6 +202,7 @@ struct QKmsOutput
|
||||
uint32_t forced_plane_id = 0;
|
||||
bool forced_plane_set = false;
|
||||
uint32_t drm_format = DRM_FORMAT_XRGB8888;
|
||||
bool drm_format_requested_by_user = false;
|
||||
QString clone_source;
|
||||
QVector<QKmsPlane> available_planes;
|
||||
struct QKmsPlane *eglfs_plane = nullptr;
|
||||
|
@ -21,8 +21,6 @@ SOURCES += main.mm \
|
||||
qcocoamenuloader.mm \
|
||||
qcocoahelpers.mm \
|
||||
qmultitouch_mac.mm \
|
||||
qcocoaaccessibilityelement.mm \
|
||||
qcocoaaccessibility.mm \
|
||||
qcocoacursor.mm \
|
||||
qcocoaclipboard.mm \
|
||||
qcocoadrag.mm \
|
||||
@ -57,8 +55,6 @@ HEADERS += qcocoaintegration.h \
|
||||
qcocoamenuloader.h \
|
||||
qcocoahelpers.h \
|
||||
qmultitouch_mac_p.h \
|
||||
qcocoaaccessibilityelement.h \
|
||||
qcocoaaccessibility.h \
|
||||
qcocoacursor.h \
|
||||
qcocoaclipboard.h \
|
||||
qcocoadrag.h \
|
||||
@ -83,13 +79,21 @@ qtConfig(vulkan) {
|
||||
HEADERS += qcocoavulkaninstance.h
|
||||
}
|
||||
|
||||
qtConfig(accessibility) {
|
||||
QT += accessibility_support-private
|
||||
SOURCES += qcocoaaccessibilityelement.mm \
|
||||
qcocoaaccessibility.mm
|
||||
HEADERS += qcocoaaccessibilityelement.h \
|
||||
qcocoaaccessibility.h
|
||||
}
|
||||
|
||||
RESOURCES += qcocoaresources.qrc
|
||||
|
||||
LIBS += -framework AppKit -framework CoreServices -framework Carbon -framework IOKit -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups
|
||||
|
||||
QT += \
|
||||
core-private gui-private \
|
||||
accessibility_support-private clipboard_support-private theme_support-private \
|
||||
clipboard_support-private theme_support-private \
|
||||
fontdatabase_support-private graphics_support-private
|
||||
|
||||
qtConfig(vulkan): QT += vulkan_support-private
|
||||
@ -99,17 +103,20 @@ CONFIG += no_app_extension_api_only
|
||||
qtHaveModule(widgets) {
|
||||
QT_FOR_CONFIG += widgets
|
||||
|
||||
SOURCES += \
|
||||
qpaintengine_mac.mm \
|
||||
qprintengine_mac.mm \
|
||||
qcocoaprintersupport.mm \
|
||||
qcocoaprintdevice.mm \
|
||||
SOURCES += qpaintengine_mac.mm
|
||||
HEADERS += qpaintengine_mac_p.h
|
||||
|
||||
HEADERS += \
|
||||
qpaintengine_mac_p.h \
|
||||
qprintengine_mac_p.h \
|
||||
qcocoaprintersupport.h \
|
||||
qcocoaprintdevice.h \
|
||||
qtHaveModule(printsupport) {
|
||||
QT += printsupport-private
|
||||
SOURCES += \
|
||||
qprintengine_mac.mm \
|
||||
qcocoaprintersupport.mm \
|
||||
qcocoaprintdevice.mm
|
||||
HEADERS += \
|
||||
qcocoaprintersupport.h \
|
||||
qcocoaprintdevice.h \
|
||||
qprintengine_mac_p.h
|
||||
}
|
||||
|
||||
qtConfig(colordialog) {
|
||||
SOURCES += qcocoacolordialoghelper.mm
|
||||
@ -126,7 +133,7 @@ qtHaveModule(widgets) {
|
||||
HEADERS += qcocoafontdialoghelper.h
|
||||
}
|
||||
|
||||
QT += widgets-private printsupport-private
|
||||
QT += widgets-private
|
||||
}
|
||||
|
||||
OTHER_FILES += cocoa.json
|
||||
|
@ -54,6 +54,8 @@ class QCocoaBackingStore : public QRasterBackingStore
|
||||
protected:
|
||||
QCocoaBackingStore(QWindow *window);
|
||||
QCFType<CGColorSpaceRef> colorSpace() const;
|
||||
QMacNotificationObserver m_backingPropertiesObserver;
|
||||
virtual void backingPropertiesChanged() = 0;
|
||||
};
|
||||
|
||||
class QNSWindowBackingStore : public QCocoaBackingStore
|
||||
@ -69,6 +71,7 @@ private:
|
||||
bool windowHasUnifiedToolbar() const;
|
||||
QImage::Format format() const override;
|
||||
void redrawRoundedBottomCorners(CGRect) const;
|
||||
void backingPropertiesChanged() override;
|
||||
};
|
||||
|
||||
class QCALayerBackingStore : public QCocoaBackingStore
|
||||
@ -115,6 +118,8 @@ private:
|
||||
bool recreateBackBufferIfNeeded();
|
||||
bool prepareForFlush();
|
||||
|
||||
void backingPropertiesChanged() override;
|
||||
|
||||
std::list<std::unique_ptr<GraphicsBuffer>> m_buffers;
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,17 @@ QT_BEGIN_NAMESPACE
|
||||
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
|
||||
: QRasterBackingStore(window)
|
||||
{
|
||||
// Ideally this would be plumbed from the platform layer to QtGui, and
|
||||
// the QBackingStore would be recreated, but we don't have that code yet,
|
||||
// so at least make sure we invalidate our backingstore when the backing
|
||||
// properties (color space e.g.) are changed.
|
||||
NSView *view = static_cast<QCocoaWindow *>(window->handle())->view();
|
||||
m_backingPropertiesObserver = QMacNotificationObserver(view.window,
|
||||
NSWindowDidChangeBackingPropertiesNotification, [this]() {
|
||||
qCDebug(lcQpaBackingStore) << "Backing properties for"
|
||||
<< this->window() << "did change";
|
||||
backingPropertiesChanged();
|
||||
});
|
||||
}
|
||||
|
||||
QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
|
||||
@ -64,6 +75,37 @@ QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
|
||||
QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
|
||||
: QCocoaBackingStore(window)
|
||||
{
|
||||
// Choose an appropriate window depth based on the requested surface format.
|
||||
// On deep color displays the default bit depth is 16-bit, so unless we need
|
||||
// that level of precision we opt out of it (and the expensive RGB32 -> RGB64
|
||||
// conversions that come with it if our backingstore depth does not match).
|
||||
|
||||
NSWindow *nsWindow = static_cast<QCocoaWindow *>(window->handle())->view().window;
|
||||
auto colorSpaceName = NSColorSpaceFromDepth(nsWindow.depthLimit);
|
||||
|
||||
static const int kDefaultBitDepth = 8;
|
||||
auto surfaceFormat = window->requestedFormat();
|
||||
auto bitsPerSample = qMax(kDefaultBitDepth, qMax(surfaceFormat.redBufferSize(),
|
||||
qMax(surfaceFormat.greenBufferSize(), surfaceFormat.blueBufferSize())));
|
||||
|
||||
// NSBestDepth does not seem to guarantee a window depth deep enough for the
|
||||
// given bits per sample, even if documented as such. For example, requesting
|
||||
// 10 bits per sample will not give us a 16-bit format, even if that's what's
|
||||
// available. Work around this by manually bumping the bit depth.
|
||||
bitsPerSample = !(bitsPerSample & (bitsPerSample - 1))
|
||||
? bitsPerSample : qNextPowerOfTwo(bitsPerSample);
|
||||
|
||||
auto bestDepth = NSBestDepth(colorSpaceName, bitsPerSample, 0, NO, nullptr);
|
||||
|
||||
// Disable dynamic depth limit, otherwise our depth limit will be overwritten
|
||||
// by AppKit if the window moves to a screen with a different depth. We call
|
||||
// this before setting the depth limit, as the call will reset the depth to 0.
|
||||
[nsWindow setDynamicDepthLimit:NO];
|
||||
|
||||
qCDebug(lcQpaBackingStore) << "Using" << NSBitsPerSampleFromDepth(bestDepth)
|
||||
<< "bit window depth for" << nsWindow;
|
||||
|
||||
nsWindow.depthLimit = bestDepth;
|
||||
}
|
||||
|
||||
QNSWindowBackingStore::~QNSWindowBackingStore()
|
||||
@ -212,9 +254,6 @@ void QNSWindowBackingStore::flush(QWindow *window, const QRegion ®ion, const
|
||||
|
||||
CGRect viewRect = viewLocalRect.toCGRect();
|
||||
|
||||
if (windowHasUnifiedToolbar())
|
||||
NSDrawWindowBackground(viewRect);
|
||||
|
||||
[backingStoreImage drawInRect:viewRect fromRect:backingStoreRect.toCGRect()
|
||||
operation:compositingOperation fraction:1.0 respectFlipped:YES hints:nil];
|
||||
|
||||
@ -302,6 +341,11 @@ void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const
|
||||
#endif
|
||||
}
|
||||
|
||||
void QNSWindowBackingStore::backingPropertiesChanged()
|
||||
{
|
||||
m_image = QImage();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
|
||||
@ -565,6 +609,12 @@ QImage QCALayerBackingStore::toImage() const
|
||||
return imageCopy;
|
||||
}
|
||||
|
||||
void QCALayerBackingStore::backingPropertiesChanged()
|
||||
{
|
||||
m_buffers.clear();
|
||||
m_buffers.resize(1);
|
||||
}
|
||||
|
||||
QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const
|
||||
{
|
||||
return m_buffers.back().get();
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "qguiapplication.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
#ifndef QT_NO_WIDGETS
|
||||
#if !defined(QT_NO_WIDGETS) && defined(QT_PRINTSUPPORT_LIB)
|
||||
#include "qcocoaprintersupport.h"
|
||||
#include "qprintengine_mac_p.h"
|
||||
#include <qpa/qplatformprintersupport.h>
|
||||
@ -153,24 +153,24 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
|
||||
|
||||
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
|
||||
{
|
||||
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
|
||||
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB)
|
||||
return new QCocoaPrinterSupport();
|
||||
#else
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets");
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
|
||||
{
|
||||
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
|
||||
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB)
|
||||
QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
|
||||
if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
|
||||
macPrintEnginePriv->initialize();
|
||||
return macPrintEnginePriv->printInfo;
|
||||
#else
|
||||
Q_UNUSED(printEngine);
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets");
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
void updateMenu(QPlatformMenu *menu) override;
|
||||
QRect geometry() const override;
|
||||
void showMessage(const QString &title, const QString &msg,
|
||||
const QIcon& icon, MessageIcon iconType, int secs) override;
|
||||
const QIcon& icon, MessageIcon iconType, int msecs) override;
|
||||
|
||||
bool isSystemTrayAvailable() const override;
|
||||
bool supportsMessages() const override;
|
||||
|
@ -264,7 +264,7 @@ bool QCocoaSystemTrayIcon::supportsMessages() const
|
||||
}
|
||||
|
||||
void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message,
|
||||
const QIcon& icon, MessageIcon, int)
|
||||
const QIcon& icon, MessageIcon, int msecs)
|
||||
{
|
||||
if (!m_sys)
|
||||
return;
|
||||
@ -282,6 +282,10 @@ void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &mess
|
||||
NSUserNotificationCenter *center = NSUserNotificationCenter.defaultUserNotificationCenter;
|
||||
center.delegate = m_sys->item;
|
||||
[center deliverNotification:notification];
|
||||
if (msecs) {
|
||||
NSTimeInterval timeout = msecs / 1000.0;
|
||||
[center performSelector:@selector(removeDeliveredNotification:) withObject:notification afterDelay:timeout];
|
||||
}
|
||||
[notification release];
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
@ -434,8 +438,7 @@ QT_END_NAMESPACE
|
||||
}
|
||||
|
||||
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification {
|
||||
Q_UNUSED(center);
|
||||
Q_UNUSED(notification);
|
||||
[center removeDeliveredNotification:notification];
|
||||
emit systray->messageClicked();
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
Q_NOTIFICATION_HANDLER(NSWindowDidOrderOffScreenNotification) void windowDidOrderOffScreen();
|
||||
Q_NOTIFICATION_HANDLER(NSWindowDidChangeOcclusionStateNotification) void windowDidChangeOcclusionState();
|
||||
Q_NOTIFICATION_HANDLER(NSWindowDidChangeScreenNotification) void windowDidChangeScreen();
|
||||
Q_NOTIFICATION_HANDLER(NSWindowDidChangeBackingPropertiesNotification) void windowDidChangeBackingProperties();
|
||||
Q_NOTIFICATION_HANDLER(NSWindowWillCloseNotification) void windowWillClose();
|
||||
|
||||
bool windowShouldClose();
|
||||
|
@ -1259,6 +1259,17 @@ void QCocoaWindow::windowDidChangeScreen()
|
||||
currentScreen->requestUpdate();
|
||||
}
|
||||
}
|
||||
/*
|
||||
The window's backing scale factor or color space has changed.
|
||||
*/
|
||||
void QCocoaWindow::windowDidChangeBackingProperties()
|
||||
{
|
||||
// Ideally we would plumb this thought QPA in a way that lets clients
|
||||
// invalidate their own caches, and recreate QBackingStore. For now we
|
||||
// trigger an expose, and let QCocoaBackingStore deal with its own
|
||||
// buffer invalidation.
|
||||
[m_view setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
void QCocoaWindow::windowWillClose()
|
||||
{
|
||||
@ -1646,21 +1657,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
|
||||
|
||||
applyContentBorderThickness(nsWindow);
|
||||
|
||||
// Prevent CoreGraphics RGB32 -> RGB64 backing store conversions on deep color
|
||||
// displays by forcing 8-bit components, unless a deep color format has been
|
||||
// requested. This conversion uses significant CPU time.
|
||||
QSurface::SurfaceType surfaceType = QPlatformWindow::window()->surfaceType();
|
||||
bool usesCoreGraphics = surfaceType == QSurface::RasterSurface || surfaceType == QSurface::RasterGLSurface;
|
||||
QSurfaceFormat surfaceFormat = QPlatformWindow::window()->format();
|
||||
bool usesDeepColor = surfaceFormat.redBufferSize() > 8 ||
|
||||
surfaceFormat.greenBufferSize() > 8 ||
|
||||
surfaceFormat.blueBufferSize() > 8;
|
||||
bool usesLayer = view().layer;
|
||||
if (usesCoreGraphics && !usesDeepColor && !usesLayer) {
|
||||
[nsWindow setDynamicDepthLimit:NO];
|
||||
[nsWindow setDepthLimit:NSWindowDepthTwentyfourBitRGB];
|
||||
}
|
||||
|
||||
if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace)
|
||||
nsWindow.colorSpace = NSColorSpace.sRGBColorSpace;
|
||||
|
||||
|
@ -394,14 +394,16 @@
|
||||
}
|
||||
// Close the popups if the click was outside.
|
||||
if (!inside) {
|
||||
bool selfClosed = false;
|
||||
Qt::WindowType type = QCocoaIntegration::instance()->activePopupWindow()->window()->type();
|
||||
while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) {
|
||||
selfClosed = self == popup->view();
|
||||
QWindowSystemInterface::handleCloseEvent(popup->window());
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
}
|
||||
// Consume the mouse event when closing the popup, except for tool tips
|
||||
// were it's expected that the event is processed normally.
|
||||
if (type != Qt::ToolTip)
|
||||
if (type != Qt::ToolTip || selfClosed)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -253,20 +253,10 @@ static bool isMouseEvent(NSEvent *ev)
|
||||
return m_platformWindow ? m_platformWindow->isOpaque() : [super isOpaque];
|
||||
}
|
||||
|
||||
/*!
|
||||
Borderless windows need a transparent background
|
||||
|
||||
Technically windows with NSWindowStyleMaskTexturedBackground
|
||||
(such as windows with unified toolbars) need to draw the textured
|
||||
background of the NSWindow, and can't have a transparent
|
||||
background, but as NSWindowStyleMaskBorderless is 0, you can't
|
||||
have a window with NSWindowStyleMaskTexturedBackground that is
|
||||
also borderless.
|
||||
*/
|
||||
- (NSColor *)backgroundColor
|
||||
{
|
||||
return self.styleMask == NSWindowStyleMaskBorderless
|
||||
? [NSColor clearColor] : [super backgroundColor];
|
||||
return self.styleMask & NSWindowStyleMaskTexturedBackground ?
|
||||
[super backgroundColor] : [NSColor clearColor];
|
||||
}
|
||||
|
||||
- (void)sendEvent:(NSEvent*)theEvent
|
||||
|
@ -38,14 +38,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qpaintengine_mac_p.h"
|
||||
#if defined(QT_PRINTSUPPORT_LIB)
|
||||
#include "qprintengine_mac_p.h"
|
||||
#endif
|
||||
|
||||
#include <qbitmap.h>
|
||||
#include <qpaintdevice.h>
|
||||
#include <qpainterpath.h>
|
||||
#include <qpixmapcache.h>
|
||||
#include <private/qpaintengine_raster_p.h>
|
||||
#if defined(QT_PRINTSUPPORT_LIB)
|
||||
#include <qprinter.h>
|
||||
#endif
|
||||
#include <qstack.h>
|
||||
#include <qwidget.h>
|
||||
#include <qvarlengtharray.h>
|
||||
|
@ -155,20 +155,33 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig)
|
||||
qCDebug(qLcEglfsKmsDebug, "Creating gbm_surface for screen %s", qPrintable(name()));
|
||||
|
||||
const auto gbmDevice = static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice();
|
||||
EGLint native_format = -1;
|
||||
EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format);
|
||||
qCDebug(qLcEglfsKmsDebug) << "Got native format" << Qt::hex << native_format << Qt::dec << "from eglGetConfigAttrib() with return code" << bool(success);
|
||||
// If there was no format override given in the config file,
|
||||
// query the native (here, gbm) format from the EGL config.
|
||||
const bool queryFromEgl = !m_output.drm_format_requested_by_user;
|
||||
if (queryFromEgl) {
|
||||
EGLint native_format = -1;
|
||||
EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format);
|
||||
qCDebug(qLcEglfsKmsDebug) << "Got native format" << Qt::hex << native_format << Qt::dec
|
||||
<< "from eglGetConfigAttrib() with return code" << bool(success);
|
||||
|
||||
if (success)
|
||||
m_gbm_surface = gbm_surface_create(gbmDevice,
|
||||
rawGeometry().width(),
|
||||
rawGeometry().height(),
|
||||
native_format,
|
||||
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||
if (success) {
|
||||
m_gbm_surface = gbm_surface_create(gbmDevice,
|
||||
rawGeometry().width(),
|
||||
rawGeometry().height(),
|
||||
native_format,
|
||||
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||
if (m_gbm_surface)
|
||||
m_output.drm_format = gbmFormatToDrmFormat(native_format);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_gbm_surface) { // fallback for older drivers
|
||||
// Fallback for older drivers, and when "format" is explicitly specified
|
||||
// in the output config. (not guaranteed that the requested format works
|
||||
// of course, but do what we are told to)
|
||||
if (!m_gbm_surface) {
|
||||
uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format);
|
||||
qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
|
||||
if (queryFromEgl)
|
||||
qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
|
||||
m_gbm_surface = gbm_surface_create(gbmDevice,
|
||||
rawGeometry().width(),
|
||||
rawGeometry().height(),
|
||||
|
@ -101,7 +101,7 @@
|
||||
- (id)accessibilityElementAtIndex:(NSInteger)index
|
||||
{
|
||||
[self initAccessibility];
|
||||
if (index >= [m_accessibleElements count])
|
||||
if (NSUInteger(index) >= [m_accessibleElements count])
|
||||
return nil;
|
||||
return m_accessibleElements[index];
|
||||
}
|
||||
|
@ -670,18 +670,26 @@ HRESULT QWindowsUiaMainProvider::ElementProviderFromPoint(double x, double y, IR
|
||||
QPoint point;
|
||||
nativeUiaPointToPoint(uiaPoint, window, &point);
|
||||
|
||||
QAccessibleInterface *targetacc = accessible->childAt(point.x(), point.y());
|
||||
|
||||
if (targetacc) {
|
||||
QAccessibleInterface *acc = targetacc;
|
||||
// Controls can be embedded within grouping elements. By default returns the innermost control.
|
||||
while (acc) {
|
||||
targetacc = acc;
|
||||
// For accessibility tools it may be better to return the text element instead of its subcomponents.
|
||||
if (targetacc->textInterface()) break;
|
||||
acc = acc->childAt(point.x(), point.y());
|
||||
if (auto targetacc = accessible->childAt(point.x(), point.y())) {
|
||||
auto acc = accessible->childAt(point.x(), point.y());
|
||||
// Reject the cases where childAt() returns a different instance in each call for the same
|
||||
// element (e.g., QAccessibleTree), as it causes an endless loop with Youdao Dictionary installed.
|
||||
if (targetacc == acc) {
|
||||
// Controls can be embedded within grouping elements. By default returns the innermost control.
|
||||
while (acc) {
|
||||
targetacc = acc;
|
||||
// For accessibility tools it may be better to return the text element instead of its subcomponents.
|
||||
if (targetacc->textInterface()) break;
|
||||
acc = targetacc->childAt(point.x(), point.y());
|
||||
if (acc != targetacc->childAt(point.x(), point.y())) {
|
||||
qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << targetacc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pRetVal = providerForAccessible(targetacc);
|
||||
} else {
|
||||
qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << accessible;
|
||||
}
|
||||
*pRetVal = providerForAccessible(targetacc);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -40,13 +40,11 @@
|
||||
#include "qppdprintdevice.h"
|
||||
|
||||
#include "qcupsprintersupport_p.h"
|
||||
#include "private/qcups_p.h" // Only needed for PDPK_*
|
||||
|
||||
#if QT_CONFIG(mimetype)
|
||||
#include <QtCore/QMimeDatabase>
|
||||
#endif
|
||||
#include <qdebug.h>
|
||||
|
||||
#include "private/qcups_p.h" // Only needed for PDPK_*
|
||||
|
||||
#ifndef QT_LINUXBASE // LSB merges everything into cups.h
|
||||
#include <cups/language.h>
|
||||
|
@ -555,10 +555,10 @@ QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect)
|
||||
newRot = -90;
|
||||
}
|
||||
tabRect.setRect(0, 0, tabRect.height(), tabRect.width());
|
||||
QMatrix m;
|
||||
m.translate(newX, newY);
|
||||
m.rotate(newRot);
|
||||
p->setMatrix(m, true);
|
||||
QTransform transform;
|
||||
transform.translate(newX, newY);
|
||||
transform.rotate(newRot);
|
||||
p->setTransform(transform, true);
|
||||
}
|
||||
return tabRect;
|
||||
}
|
||||
@ -2951,24 +2951,24 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
|
||||
}
|
||||
#endif
|
||||
|
||||
QMatrix matrix;
|
||||
matrix.translate(opt->rect.center().x() + xOffset, opt->rect.center().y() + 2);
|
||||
QTransform transform;
|
||||
transform.translate(opt->rect.center().x() + xOffset, opt->rect.center().y() + 2);
|
||||
QPainterPath path;
|
||||
switch(pe) {
|
||||
default:
|
||||
case PE_IndicatorArrowDown:
|
||||
break;
|
||||
case PE_IndicatorArrowUp:
|
||||
matrix.rotate(180);
|
||||
transform.rotate(180);
|
||||
break;
|
||||
case PE_IndicatorArrowLeft:
|
||||
matrix.rotate(90);
|
||||
transform.rotate(90);
|
||||
break;
|
||||
case PE_IndicatorArrowRight:
|
||||
matrix.rotate(-90);
|
||||
transform.rotate(-90);
|
||||
break;
|
||||
}
|
||||
p->setMatrix(matrix);
|
||||
p->setTransform(transform);
|
||||
|
||||
path.moveTo(-halfSize, -halfSize * 0.5);
|
||||
path.lineTo(0.0, halfSize * 0.5);
|
||||
|
@ -318,8 +318,10 @@ static QString shellQuote(const QString &arg)
|
||||
|
||||
QString architecureFromName(const QString &name)
|
||||
{
|
||||
const QFileInfo fi(name);
|
||||
const QString extractedFileName = fi.fileName();
|
||||
QRegExp architecture(QStringLiteral(".*_(.*)\\.so"));
|
||||
if (!architecture.exactMatch(name))
|
||||
if (!architecture.exactMatch(extractedFileName))
|
||||
return {};
|
||||
return architecture.capturedTexts().last();
|
||||
}
|
||||
|
@ -39,6 +39,8 @@
|
||||
|
||||
#include "qdirmodel.h"
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
#include <qfile.h>
|
||||
#include <qfilesystemmodel.h>
|
||||
#include <qurl.h>
|
||||
@ -1372,3 +1374,5 @@ QFileInfo QDirModelPrivate::resolvedInfo(QFileInfo info)
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qdirmodel.cpp"
|
||||
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
@ -45,6 +45,8 @@
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtWidgets/qfileiconprovider.h>
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
QT_REQUIRE_CONFIG(dirmodel);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -65,9 +67,10 @@ public:
|
||||
FileNameRole
|
||||
};
|
||||
|
||||
QDirModel(const QStringList &nameFilters, QDir::Filters filters,
|
||||
QDir::SortFlags sort, QObject *parent = nullptr);
|
||||
explicit QDirModel(QObject *parent = nullptr);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") QDirModel(const QStringList &nameFilters,
|
||||
QDir::Filters filters, QDir::SortFlags sort,
|
||||
QObject *parent = nullptr);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") explicit QDirModel(QObject *parent = nullptr);
|
||||
~QDirModel();
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
@ -144,4 +147,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
#endif // QDIRMODEL_H
|
||||
|
@ -147,6 +147,7 @@ QWidgetRepaintManager::~QWidgetRepaintManager()
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Invalidates the \a r (in widget's coordinates) of the backing store, i.e.
|
||||
all widgets intersecting with the region will be repainted when the backing
|
||||
store is synced.
|
||||
@ -193,6 +194,7 @@ static inline QRect widgetRectFor(QWidget *, const QRect &r) { return r; }
|
||||
static inline QRect widgetRectFor(QWidget *widget, const QRegion &) { return widget->rect(); }
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Marks the region of the widget as dirty (if not already marked as dirty) and
|
||||
posts an UpdateRequest event to the top-level widget (if not already posted).
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user