Merge remote-tracking branch 'origin/dev' into wip/cmake

Change-Id: Ide5b3408bfefca410323cf26b810b44c06d3a227
bb10
Alexandru Croitor 2019-06-03 15:26:34 +02:00
commit 5591e82135
161 changed files with 2646 additions and 1977 deletions

View File

@ -48,13 +48,14 @@
**
****************************************************************************/
#include "httpwindow.h"
#include "ui_authenticationdialog.h"
#include <QtWidgets>
#include <QtNetwork>
#include <QUrl>
#include "httpwindow.h"
#include "ui_authenticationdialog.h"
#if QT_CONFIG(ssl)
const char defaultUrl[] = "https://www.qt.io/";
#else
@ -74,6 +75,10 @@ ProgressDialog::ProgressDialog(const QUrl &url, QWidget *parent)
setMinimumSize(QSize(400, 75));
}
ProgressDialog::~ProgressDialog()
{
}
void ProgressDialog::networkReplyProgress(qint64 bytesRead, qint64 totalBytes)
{
setMaximum(totalBytes);
@ -137,6 +142,10 @@ HttpWindow::HttpWindow(QWidget *parent)
urlLineEdit->setFocus();
}
HttpWindow::~HttpWindow()
{
}
void HttpWindow::startRequest(const QUrl &requestedUrl)
{
url = requestedUrl;
@ -204,9 +213,9 @@ void HttpWindow::downloadFile()
startRequest(newUrl);
}
QFile *HttpWindow::openFileForWrite(const QString &fileName)
std::unique_ptr<QFile> HttpWindow::openFileForWrite(const QString &fileName)
{
QScopedPointer<QFile> file(new QFile(fileName));
std::unique_ptr<QFile> file(new QFile(fileName));
if (!file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Error"),
tr("Unable to save the file %1: %2.")
@ -214,7 +223,7 @@ QFile *HttpWindow::openFileForWrite(const QString &fileName)
file->errorString()));
return nullptr;
}
return file.take();
return file;
}
void HttpWindow::cancelDownload()
@ -231,8 +240,7 @@ void HttpWindow::httpFinished()
if (file) {
fi.setFile(file->fileName());
file->close();
delete file;
file = nullptr;
file.reset();
}
if (httpRequestAborted) {

View File

@ -55,6 +55,8 @@
#include <QNetworkAccessManager>
#include <QUrl>
#include <memory>
QT_BEGIN_NAMESPACE
class QFile;
class QLabel;
@ -72,6 +74,7 @@ class ProgressDialog : public QProgressDialog {
public:
explicit ProgressDialog(const QUrl &url, QWidget *parent = nullptr);
~ProgressDialog();
public slots:
void networkReplyProgress(qint64 bytesRead, qint64 totalBytes);
@ -83,6 +86,7 @@ class HttpWindow : public QDialog
public:
explicit HttpWindow(QWidget *parent = nullptr);
~HttpWindow();
void startRequest(const QUrl &requestedUrl);
@ -98,7 +102,7 @@ private slots:
#endif
private:
QFile *openFileForWrite(const QString &fileName);
std::unique_ptr<QFile> openFileForWrite(const QString &fileName);
QLabel *statusLabel;
QLineEdit *urlLineEdit;
@ -110,7 +114,7 @@ private:
QUrl url;
QNetworkAccessManager qnam;
QNetworkReply *reply;
QFile *file;
std::unique_ptr<QFile> file;
bool httpRequestAborted;
};

View File

@ -874,8 +874,7 @@ void TorrentClient::removeClient()
// Remove the client from RateController and all structures.
RateController::instance()->removeSocket(client);
d->connections.removeAll(client);
QMultiMap<PeerWireClient *, TorrentPiece *>::Iterator it = d->payloads.find(client);
while (it != d->payloads.end() && it.key() == client) {
for (auto it = d->payloads.find(client); it != d->payloads.end() && it.key() == client; /*erasing*/) {
TorrentPiece *piece = it.value();
piece->inProgress = false;
piece->requestedBlocks.fill(false);
@ -883,9 +882,12 @@ void TorrentClient::removeClient()
}
// Remove pending read requests.
QMapIterator<int, PeerWireClient *> it2(d->readIds);
while (it2.findNext(client))
d->readIds.remove(it2.key());
for (auto it = d->readIds.begin(), end = d->readIds.end(); it != end; /*erasing*/) {
if (it.value() == client)
it = d->readIds.erase(it);
else
++it;
}
// Delete the client later.
disconnect(client, SIGNAL(disconnected()), this, SLOT(removeClient()));

View File

@ -58,6 +58,8 @@
#include "mainwindow.h"
#include "glwidget.h"
#include <memory>
static QString getGlString(QOpenGLFunctions *functions, GLenum name)
{
if (const GLubyte *p = functions->glGetString(name))
@ -104,8 +106,8 @@ int main( int argc, char ** argv )
const QString toolTip = supportsThreading ? glInfo : glInfo + QStringLiteral("\ndoes not support threaded OpenGL.");
topLevelGlWidget.setToolTip(toolTip);
QScopedPointer<MainWindow> mw1;
QScopedPointer<MainWindow> mw2;
std::unique_ptr<MainWindow> mw1;
std::unique_ptr<MainWindow> mw2;
if (!parser.isSet(singleOption)) {
if (supportsThreading) {
pos += QPoint(100, 100);

View File

@ -53,6 +53,8 @@
#include "../connection.h"
#include <memory>
void initializeModel(QSqlRelationalTableModel *model)
{
//! [0]
@ -76,12 +78,12 @@ void initializeModel(QSqlRelationalTableModel *model)
model->select();
}
QTableView *createView(const QString &title, QSqlTableModel *model)
std::unique_ptr<QTableView> createView(const QString &title, QSqlTableModel *model)
{
//! [4]
QTableView *view = new QTableView;
std::unique_ptr<QTableView> view{new QTableView};
view->setModel(model);
view->setItemDelegate(new QSqlRelationalDelegate(view));
view->setItemDelegate(new QSqlRelationalDelegate(view.get()));
//! [4]
view->setWindowTitle(title);
return view;
@ -118,7 +120,7 @@ int main(int argc, char *argv[])
initializeModel(&model);
QScopedPointer<QTableView> view(createView(QObject::tr("Relational Table Model"), &model));
std::unique_ptr<QTableView> view = createView(QObject::tr("Relational Table Model"), &model);
view->show();
return app.exec();

View File

@ -224,6 +224,10 @@ CompositionWidget::CompositionWidget(QWidget *parent)
setWindowTitle(tr("Composition Modes"));
}
CompositionWidget::~CompositionWidget()
{
}
void CompositionWidget::nextMode()
{
@ -265,6 +269,10 @@ CompositionRenderer::CompositionRenderer(QWidget *parent)
#endif
}
CompositionRenderer::~CompositionRenderer()
{
}
QRectF rectangle_around(const QPointF &p, const QSizeF &size = QSize(250, 200))
{
QRectF rect(p, size);
@ -371,7 +379,7 @@ void CompositionRenderer::paint(QPainter *painter)
if (size() != m_previous_size) {
m_previous_size = size();
QPainter p(m_fbo.data());
QPainter p(m_fbo.get());
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(QRect(QPoint(0, 0), size()), Qt::transparent);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
@ -382,7 +390,7 @@ void CompositionRenderer::paint(QPainter *painter)
painter->beginNativePainting();
{
QPainter p(m_fbo.data());
QPainter p(m_fbo.get());
p.beginNativePainting();
m_blitter.bind();
const QRect targetRect(QPoint(0, 0), m_fbo->size());

View File

@ -61,6 +61,8 @@
#include <QPainter>
#include <QEvent>
#include <memory>
QT_BEGIN_NAMESPACE
class QPushButton;
class QRadioButton;
@ -71,7 +73,8 @@ class CompositionWidget : public QWidget
Q_OBJECT
public:
CompositionWidget(QWidget *parent);
explicit CompositionWidget(QWidget *parent = nullptr);
~CompositionWidget();
public slots:
void nextMode();
@ -117,7 +120,8 @@ class CompositionRenderer : public ArthurFrame
Q_PROPERTY(bool animation READ animationEnabled WRITE setAnimationEnabled)
public:
CompositionRenderer(QWidget *parent);
explicit CompositionRenderer(QWidget *parent = nullptr);
~CompositionRenderer();
void paint(QPainter *) override;
@ -188,7 +192,7 @@ private:
int m_animationTimer;
#if QT_CONFIG(opengl)
QScopedPointer<QFboPaintDevice> m_fbo;
std::unique_ptr<QFboPaintDevice> m_fbo;
int m_pbuffer_size; // width==height==size of pbuffer
uint m_base_tex;
uint m_compositing_tex;

View File

@ -55,6 +55,8 @@
#include "imagedelegate.h"
#include "mainwindow.h"
#include <memory>
//! [40]
enum { OtherSize = QStyle::PM_CustomBase };
//! [40]
@ -514,8 +516,8 @@ void MainWindow::checkCurrentStyle()
const QList<QAction *> actions = styleActionGroup->actions();
for (QAction *action : actions) {
const QString styleName = action->data().toString();
QScopedPointer<QStyle> candidate(QStyleFactory::create(styleName));
Q_ASSERT(!candidate.isNull());
const std::unique_ptr<QStyle> candidate{QStyleFactory::create(styleName)};
Q_ASSERT(candidate);
if (candidate->metaObject()->className()
== QApplication::style()->metaObject()->className()) {
action->trigger();

View File

@ -56,7 +56,6 @@ add_qt_executable(qmake
../src/corelib/tools/qmap.cpp ../src/corelib/tools/qmap.h
../src/corelib/tools/qregexp.cpp ../src/corelib/tools/qregexp.h
../src/corelib/tools/qstring.cpp ../src/corelib/tools/qstring.h
../src/corelib/tools/qstring_compat.cpp
../src/corelib/tools/qstringlist.cpp ../src/corelib/tools/qstringlist.h
../src/corelib/tools/qstringmatcher.h
../src/corelib/tools/qvector.h

View File

@ -74,7 +74,6 @@ add_qt_tool(qmake # special case
../src/corelib/tools/qregexp.cpp ../src/corelib/tools/qregexp.h
../src/corelib/tools/qringbuffer.cpp # special case
../src/corelib/tools/qstring.cpp ../src/corelib/tools/qstring.h
../src/corelib/tools/qstring_compat.cpp
../src/corelib/tools/qstringlist.cpp ../src/corelib/tools/qstringlist.h
../src/corelib/tools/qstringmatcher.h
../src/corelib/tools/qvector.h

View File

@ -30,7 +30,7 @@ QOBJS = \
qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \
qcryptographichash.o qdatetime.o qhash.o qlist.o \
qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \
qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o \
qstringbuilder.o qstring.o qstringlist.o qversionnumber.o \
qvsnprintf.o qxmlstream.o qxmlutils.o \
$(QTOBJS) $(QTOBJS2)
# QTOBJS and QTOBJS2 are populated by Makefile.unix.* as for QTSRC (see below).
@ -119,7 +119,6 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \
@ -342,9 +341,6 @@ qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstring_compat.o: $(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstringbuilder.o: $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<

View File

@ -99,7 +99,6 @@ QTOBJS= \
qregexp.obj \
qutfcodec.obj \
qstring.obj \
qstring_compat.obj \
qstringlist.obj \
qstringbuilder.obj \
qsystemerror.obj \
@ -200,10 +199,7 @@ qmake_pch.obj:
{$(SOURCE_PATH)\src\corelib\tools}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
# Make sure qstring_compat.obj and qlibraryinfo.obj aren't compiled with PCH enabled
qstring_compat.obj: $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp
$(CXX) -c $(CXXFLAGS_BARE) $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp
# Make sure qlibraryinfo.obj isn't compiled with PCH enabled
qlibraryinfo.obj: $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp
$(CXX) $(CXXFLAGS_BARE) -DQT_BUILD_QMAKE_BOOTSTRAP $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp

View File

@ -1294,9 +1294,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += fi.fileName();
QString cmd;
if (is_target || (!fi.isDir() && fi.isExecutable()))
cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else
cmd = QLatin1String("-$(QINSTALL)");
cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&
@ -1316,9 +1316,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += filestr;
QString cmd;
if (installConfigValues.contains("executable"))
cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else
cmd = QLatin1String("-$(QINSTALL)");
cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd;
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false))));
@ -1331,7 +1331,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
if (!dst_file.endsWith(Option::dir_sep))
dst_file += Option::dir_sep;
dst_file += fi.fileName();
QString cmd = QLatin1String("-$(QINSTALL) ") +
QString cmd = QLatin1String("$(QINSTALL) ") +
escapeFilePath(dirstr + file) + " " + escapeFilePath(dst_file);
inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&
@ -1862,6 +1862,55 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &
return {};
}
void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler,
const QString &dep_cd_cmd,
const QString &tmp_dep_cmd,
const QString &inpf,
const QString &tmp_out,
bool dep_lines,
QStringList *deps)
{
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if (indeps.isEmpty())
return;
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for (int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
const QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
const QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file)) {
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
extraCompiler.toLatin1().constData());
} else {
file = absFile; // fallback for generated resources
}
} else {
file = localFile;
}
}
if (!file.isEmpty())
file = fileFixify(file);
}
deps->append(dep_cmd_deps);
}
}
void
MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
{
@ -1991,44 +2040,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
deps += findDependencies(inpf);
inputs += Option::fixPathToTargetOS(inpf, false);
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
(*it).toLatin1().constData());
else
file = absFile; // fallback for generated resources
} else {
file = localFile;
}
}
if(!file.isEmpty())
file = fileFixify(file);
}
deps += dep_cmd_deps;
}
}
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
tmp_out, dep_lines, &deps);
}
}
for(int i = 0; i < inputs.size(); ) {
@ -2076,44 +2089,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3)
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
(*it).toLatin1().constData());
else
file = absFile; // fallback for generated resources
} else {
file = localFile;
}
}
if(!file.isEmpty())
file = fileFixify(file);
}
deps += dep_cmd_deps;
}
}
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
tmp_out, dep_lines, &deps);
//use the depend system to find includes of these included files
QStringList inc_deps;
for(int i = 0; i < deps.size(); ++i) {

View File

@ -84,6 +84,9 @@ protected:
void writeExtraVariables(QTextStream &t);
void writeExtraTargets(QTextStream &t);
QString resolveDependency(const QDir &outDir, const QString &file);
void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd,
const QString &tmp_dep_cmd, const QString &inpf,
const QString &tmp_out, bool dep_lines, QStringList *deps);
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);

View File

@ -604,7 +604,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1)));
if(!ret.isEmpty())
ret += "\n\t";
ret += "-$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst;
ret += "$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst;
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) " + dst);
@ -640,16 +640,16 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QString copy_cmd;
if (bundle == SolidBundle) {
copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + plain_targ;
copy_cmd += "$(QINSTALL) " + src_targ + ' ' + plain_targ;
} else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) {
copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + dst_targ;
copy_cmd += "$(QINSTALL) " + src_targ + ' ' + dst_targ;
} else if (!isAux) {
if (bundle == SlicedBundle) {
if (!ret.isEmpty())
ret += "\n\t";
ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false);
}
copy_cmd += "-$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
copy_cmd += "$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
}
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
&& project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) {
@ -702,7 +702,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
ret += "\n\t";
ret += mkdir_p_asstring("\"`dirname " + dst + "`\"", false) + "\n\t";
ret += "-$(DEL_FILE) " + dst + "\n\t"; // Can't overwrite symlinks to directories
ret += "-$(QINSTALL) " + escapeFilePath(src) + " " + dst;
ret += "$(QINSTALL) " + escapeFilePath(src) + " " + dst;
if (!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) " + dst);

View File

@ -147,7 +147,6 @@ SOURCES += \
qregexp.cpp \
qsettings.cpp \
qstring.cpp \
qstring_compat.cpp \
qstringlist.cpp \
qsystemerror.cpp \
qtemporaryfile.cpp \

2365
src/3rdparty/md4c/md4c.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,12 @@
extern "C" {
#endif
/* Magic to support UTF-16. */
#if defined MD4C_USE_UTF16
/* Magic to support UTF-16. Not that in order to use it, you have to define
* the macro MD4C_USE_UTF16 both when building MD4C as well as when
* including this header in your code. */
#ifdef _WIN32
#include <wchar.h>
#include <windows.h>
typedef WCHAR MD_CHAR;
#else
#error MD4C_USE_UTF16 is only supported on Windows.
@ -236,6 +238,7 @@ typedef struct MD_BLOCK_H_DETAIL {
typedef struct MD_BLOCK_CODE_DETAIL {
MD_ATTRIBUTE info;
MD_ATTRIBUTE lang;
MD_CHAR fence_char; /* The character used for fenced code block; or zero for indented code block. */
} MD_BLOCK_CODE_DETAIL;
/* Detailed info for MD_BLOCK_TH and MD_BLOCK_TD. */

View File

@ -9,7 +9,7 @@
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE.md",
"Version": "0.3.0",
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.3.0-rc",
"Version": "0.3.3",
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.3.3",
"Copyright": "Copyright © 2016-2019 Martin Mitáš"
}

View File

@ -277,15 +277,20 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
if (oldState == Stopped) {
d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData()));
//let's check if we have a start value and an end value
const char *what = nullptr;
if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) {
qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value",
d->propertyName.constData(), d->target.data()->metaObject()->className(),
qPrintable(d->target.data()->objectName()));
what = "start";
}
if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) {
qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value",
if (what)
what = "start and end";
else
what = "end";
}
if (Q_UNLIKELY(what)) {
qWarning("QPropertyAnimation::updateState (%s, %s, %ls): starting an animation without %s value",
d->propertyName.constData(), d->target.data()->metaObject()->className(),
qPrintable(d->target.data()->objectName()));
qUtf16Printable(d->target.data()->objectName()), what);
}
}
} else if (hash.value(key) == this) {

View File

@ -439,7 +439,7 @@ void QMessageLogger::debug(const QLoggingCategory &cat, const char *msg, ...) co
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -466,7 +466,7 @@ void QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc,
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -489,7 +489,7 @@ QDebug QMessageLogger::debug() const
{
QDebug dbg = QDebug(QtDebugMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
return dbg;
}
@ -506,7 +506,7 @@ QDebug QMessageLogger::debug(const QLoggingCategory &cat) const
dbg.stream->message_output = false;
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
return dbg;
@ -550,7 +550,7 @@ void QMessageLogger::info(const QLoggingCategory &cat, const char *msg, ...) con
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -577,7 +577,7 @@ void QMessageLogger::info(QMessageLogger::CategoryFunction catFunc,
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -601,7 +601,7 @@ QDebug QMessageLogger::info() const
{
QDebug dbg = QDebug(QtInfoMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
return dbg;
}
@ -618,7 +618,7 @@ QDebug QMessageLogger::info(const QLoggingCategory &cat) const
dbg.stream->message_output = false;
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
return dbg;
@ -668,7 +668,7 @@ void QMessageLogger::warning(const QLoggingCategory &cat, const char *msg, ...)
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -695,7 +695,7 @@ void QMessageLogger::warning(QMessageLogger::CategoryFunction catFunc,
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -717,7 +717,7 @@ QDebug QMessageLogger::warning() const
{
QDebug dbg = QDebug(QtWarningMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
return dbg;
}
@ -733,7 +733,7 @@ QDebug QMessageLogger::warning(const QLoggingCategory &cat) const
dbg.stream->message_output = false;
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
return dbg;
@ -784,7 +784,7 @@ void QMessageLogger::critical(const QLoggingCategory &cat, const char *msg, ...)
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -811,7 +811,7 @@ void QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc,
return;
QMessageLogContext ctxt;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
va_list ap;
@ -833,7 +833,7 @@ QDebug QMessageLogger::critical() const
{
QDebug dbg = QDebug(QtCriticalMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
return dbg;
}
@ -850,7 +850,7 @@ QDebug QMessageLogger::critical(const QLoggingCategory &cat) const
dbg.stream->message_output = false;
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.copy(context);
ctxt.copyContextFrom(context);
ctxt.category = cat.categoryName();
return dbg;
@ -2108,15 +2108,20 @@ void qSetMessagePattern(const QString &pattern)
/*!
Copies context information from \a logContext into this QMessageLogContext
Copies context information from \a logContext into this QMessageLogContext.
Returns a reference to this object.
Note that the version is \b not copied, only the context information.
\internal
*/
void QMessageLogContext::copy(const QMessageLogContext &logContext)
QMessageLogContext &QMessageLogContext::copyContextFrom(const QMessageLogContext &logContext) noexcept
{
this->category = logContext.category;
this->file = logContext.file;
this->line = logContext.line;
this->function = logContext.function;
return *this;
}
/*!

View File

@ -63,20 +63,19 @@ class QMessageLogContext
{
Q_DISABLE_COPY(QMessageLogContext)
public:
Q_DECL_CONSTEXPR QMessageLogContext()
: version(2), line(0), file(nullptr), function(nullptr), category(nullptr) {}
Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName)
: version(2), line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
Q_DECL_CONSTEXPR QMessageLogContext() noexcept = default;
Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
: line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
void copy(const QMessageLogContext &logContext);
int version;
int line;
const char *file;
const char *function;
const char *category;
int version = 2;
int line = 0;
const char *file = nullptr;
const char *function = nullptr;
const char *category = nullptr;
private:
QMessageLogContext &copyContextFrom(const QMessageLogContext &logContext) noexcept;
friend class QMessageLogger;
friend class QDebug;
};

View File

@ -546,6 +546,7 @@ public:
AA_DontShowShortcutsInContextMenus = 28,
AA_CompressTabletEvents = 29,
AA_DisableWindowContextHelpButton = 30, // ### Qt 6: remove me
AA_DisableSessionManager = 31,
// Add new attributes before this line
AA_AttributeCount

View File

@ -286,6 +286,13 @@
This value was added in Qt 5.10. In Qt 6, WindowContextHelpButtonHint
will not be set by default.
\value AA_DisableSessionManager Disables the QSessionManager.
By default Qt will connect to a running session manager for a GUI
application on supported platforms, use of a session manager may be
redundant for system services.
This attribute must be set before QGuiApplication is constructed.
This value was added in 5.13
The following values are deprecated or obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully

View File

@ -166,6 +166,8 @@
# define Q_OS_QNX
#elif defined(__INTEGRITY)
# define Q_OS_INTEGRITY
#elif defined(__rtems__)
# define Q_OS_RTEMS
#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
# define Q_OS_VXWORKS
#elif defined(__HAIKU__)

View File

@ -61,6 +61,12 @@
QT_BEGIN_NAMESPACE
Q_DECL_COLD_FUNCTION
static bool file_already_open(QFile &file, const char *where = nullptr) {
qWarning("QFile::%s: File (%ls) already open", where ? where : "open", qUtf16Printable(file.fileName()));
return false;
}
//************* QFilePrivate
QFilePrivate::QFilePrivate()
{
@ -324,8 +330,7 @@ QFile::setFileName(const QString &name)
{
Q_D(QFile);
if (isOpen()) {
qWarning("QFile::setFileName: File (%s) is already opened",
qPrintable(fileName()));
file_already_open(*this, "setFileName");
close();
}
if(d->fileEngine) { //get a new file engine later
@ -910,10 +915,8 @@ QFile::copy(const QString &fileName, const QString &newName)
bool QFile::open(OpenMode mode)
{
Q_D(QFile);
if (isOpen()) {
qWarning("QFile::open: File (%s) already open", qPrintable(fileName()));
return false;
}
if (isOpen())
return file_already_open(*this);
// Either Append or NewOnly implies WriteOnly
if (mode & (Append | NewOnly))
mode |= WriteOnly;
@ -982,10 +985,8 @@ bool QFile::open(OpenMode mode)
bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
{
Q_D(QFile);
if (isOpen()) {
qWarning("QFile::open: File (%s) already open", qPrintable(fileName()));
return false;
}
if (isOpen())
return file_already_open(*this);
// Either Append or NewOnly implies WriteOnly
if (mode & (Append | NewOnly))
mode |= WriteOnly;
@ -1041,10 +1042,8 @@ bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags)
{
Q_D(QFile);
if (isOpen()) {
qWarning("QFile::open: File (%s) already open", qPrintable(fileName()));
return false;
}
if (isOpen())
return file_already_open(*this);
// Either Append or NewOnly implies WriteOnly
if (mode & (Append | NewOnly))
mode |= WriteOnly;

View File

@ -306,8 +306,7 @@ void QWindowsRemovableDriveListener::addPath(const QString &p)
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, // Volume requires BACKUP_SEMANTICS
0);
if (volumeHandle == INVALID_HANDLE_VALUE) {
qErrnoWarning("CreateFile %s failed.",
qPrintable(QString::fromWCharArray(devicePath)));
qErrnoWarning("CreateFile %ls failed.", devicePath);
return;
}
@ -324,8 +323,7 @@ void QWindowsRemovableDriveListener::addPath(const QString &p)
// closed. Do it here to avoid having to close/reopen in lock message handling.
CloseHandle(volumeHandle);
if (!re.devNotify) {
qErrnoWarning("RegisterDeviceNotification %s failed.",
qPrintable(QString::fromWCharArray(devicePath)));
qErrnoWarning("RegisterDeviceNotification %ls failed.", devicePath);
return;
}
@ -641,15 +639,15 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread()
}
}
static inline QString msgFindNextFailed(const QWindowsFileSystemWatcherEngineThread::PathInfoHash &pathInfos)
Q_DECL_COLD_FUNCTION
static QString msgFindNextFailed(const QWindowsFileSystemWatcherEngineThread::PathInfoHash &pathInfos)
{
QString result;
QTextStream str(&result);
str << "QFileSystemWatcher: FindNextChangeNotification failed for";
QString str;
str += QLatin1String("QFileSystemWatcher: FindNextChangeNotification failed for");
for (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo : pathInfos)
str << " \"" << QDir::toNativeSeparators(pathInfo.absolutePath) << '"';
str << ' ';
return result;
str += QLatin1String(" \"") + QDir::toNativeSeparators(pathInfo.absolutePath) + QLatin1Char('"');
str += QLatin1Char(' ');
return str;
}
void QWindowsFileSystemWatcherEngineThread::run()
@ -695,7 +693,7 @@ void QWindowsFileSystemWatcherEngineThread::run()
fakeRemove = true;
}
qErrnoWarning(error, "%s", qPrintable(msgFindNextFailed(h)));
qErrnoWarning(error, "%ls", qUtf16Printable(msgFindNextFailed(h)));
}
QMutableHashIterator<QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo> it(h);
while (it.hasNext()) {

View File

@ -169,7 +169,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) {
qt_safe_close(fd);
if (!QFile::remove(fileName))
qWarning("QLockFile: Could not remove our own lock file %s.", qPrintable(fileName));
qWarning("QLockFile: Could not remove our own lock file %ls.", qUtf16Printable(fileName));
return QLockFile::UnknownError; // partition full
}

View File

@ -202,8 +202,7 @@ static int qt_create_pipe(int *pipe)
qt_safe_close(pipe[1]);
int pipe_ret = qt_safe_pipe(pipe);
if (pipe_ret != 0) {
qWarning("QProcessPrivate::createPipe: Cannot create pipe %p: %s",
pipe, qPrintable(qt_error_string(errno)));
qErrnoWarning("QProcessPrivate::createPipe: Cannot create pipe %p", pipe);
}
return pipe_ret;
}
@ -473,7 +472,7 @@ void QProcessPrivate::startProcess()
if (forkfd == -1) {
// Cleanup, report error and return
#if defined (QPROCESS_DEBUG)
qDebug("fork failed: %s", qPrintable(qt_error_string(lastForkErrno)));
qDebug("fork failed: %ls", qUtf16Printable(qt_error_string(lastForkErrno)));
#endif
q->setProcessState(QProcess::NotRunning);
setErrorAndEmit(QProcess::FailedToStart,
@ -652,7 +651,7 @@ bool QProcessPrivate::writeToStdin()
qDebug("QProcessPrivate::writeToStdin(), write(%p \"%s\", %lld) == %lld",
data, qt_prettyDebug(data, bytesToWrite, 16).constData(), bytesToWrite, written);
if (written == -1)
qDebug("QProcessPrivate::writeToStdin(), failed to write (%s)", qPrintable(qt_error_string(errno)));
qDebug("QProcessPrivate::writeToStdin(), failed to write (%ls)", qUtf16Printable(qt_error_string(errno)));
#endif
if (written == -1) {
// If the O_NONBLOCK flag is set and If some data can be written without blocking

View File

@ -193,7 +193,7 @@ bool QSaveFile::open(OpenMode mode)
{
Q_D(QSaveFile);
if (isOpen()) {
qWarning("QSaveFile::open: File (%s) already open", qPrintable(fileName()));
qWarning("QSaveFile::open: File (%ls) already open", qUtf16Printable(fileName()));
return false;
}
unsetError();
@ -326,7 +326,7 @@ bool QSaveFile::commit()
return false;
if (!isOpen()) {
qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName()));
qWarning("QSaveFile::commit: File (%ls) is not open", qUtf16Printable(fileName()));
return false;
}
QFileDevice::close(); // calls flush()

View File

@ -166,8 +166,8 @@ static HKEY createOrOpenKey(HKEY parentHandle, REGSAM perms, const QString &rSub
if (res == ERROR_SUCCESS)
return resultHandle;
//qWarning("QSettings: Failed to create subkey \"%s\": %s",
// qPrintable(rSubKey), qPrintable(qt_error_string(int(res))));
//qErrnoWarning(int(res), "QSettings: Failed to create subkey \"%ls\"",
// qUtf16Printable(rSubKey));
return 0;
}
@ -207,7 +207,7 @@ static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildS
&numKeys, &maxKeySize, 0, 0, 0);
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegQueryInfoKey() failed: %s", qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: RegQueryInfoKey() failed");
return result;
}
@ -241,7 +241,7 @@ static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildS
item = QString::fromWCharArray((const wchar_t *)buff.constData(), l);
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegEnumValue failed: %s", qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: RegEnumValue failed");
continue;
}
if (item.isEmpty())
@ -295,8 +295,8 @@ static void deleteChildGroups(HKEY parentHandle, REGSAM access = 0)
// delete group itself
LONG res = RegDeleteKey(parentHandle, reinterpret_cast<const wchar_t *>(group.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteKey failed on subkey \"%s\": %s",
qPrintable(group), qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: RegDeleteKey failed on subkey \"%ls\"",
qUtf16Printable(group));
return;
}
}
@ -596,8 +596,8 @@ QWinSettingsPrivate::~QWinSettingsPrivate()
QString emptyKey;
DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: Failed to delete key \"%s\": %s",
qPrintable(regList.at(0).key()), qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: Failed to delete key \"%ls\"",
qUtf16Printable(regList.constFirst().key()));
}
}
@ -633,16 +633,16 @@ void QWinSettingsPrivate::remove(const QString &uKey)
for (const QString &group : childKeys) {
LONG res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteValue failed on subkey \"%s\": %s",
qPrintable(group), qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: RegDeleteValue failed on subkey \"%ls\"",
qUtf16Printable(group));
}
}
} else {
res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: RegDeleteKey failed on key \"%s\": %s",
qPrintable(rKey), qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: RegDeleteKey failed on key \"%ls\"",
qUtf16Printable(rKey));
}
}
RegCloseKey(handle);
@ -739,8 +739,8 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
if (res == ERROR_SUCCESS) {
deleteWriteHandleOnExit = false;
} else {
qWarning("QSettings: failed to set subkey \"%s\": %s",
qPrintable(rKey), qPrintable(qt_error_string(int(res))));
qErrnoWarning(int(res), "QSettings: failed to set subkey \"%ls\"",
qUtf16Printable(rKey));
setStatus(QSettings::AccessError);
}

View File

@ -130,29 +130,31 @@ QString QStandardPaths::writableLocation(StandardLocation type)
fileInfo.setFile(xdgRuntimeDir);
if (!fileInfo.isDir()) {
if (!QDir().mkdir(xdgRuntimeDir)) {
qWarning("QStandardPaths: error creating runtime directory %s: %s", qPrintable(xdgRuntimeDir), qPrintable(qt_error_string(errno)));
qErrnoWarning("QStandardPaths: error creating runtime directory %ls",
qUtf16Printable(xdgRuntimeDir));
return QString();
}
}
#ifndef Q_OS_WASM
qWarning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", qPrintable(xdgRuntimeDir));
qWarning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%ls'", qUtf16Printable(xdgRuntimeDir));
#endif
} else {
fileInfo.setFile(xdgRuntimeDir);
if (!fileInfo.exists()) {
qWarning("QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '%s', "
"please create it with 0700 permissions.", qPrintable(xdgRuntimeDir));
qWarning("QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '%ls', "
"please create it with 0700 permissions.", qUtf16Printable(xdgRuntimeDir));
return QString();
}
if (!fileInfo.isDir()) {
qWarning("QStandardPaths: XDG_RUNTIME_DIR points to '%s' which is not a directory",
qPrintable(xdgRuntimeDir));
qWarning("QStandardPaths: XDG_RUNTIME_DIR points to '%ls' which is not a directory",
qUtf16Printable(xdgRuntimeDir));
return QString();
}
}
// "The directory MUST be owned by the user"
if (fileInfo.ownerId() != myUid) {
qWarning("QStandardPaths: wrong ownership on runtime directory %s, %d instead of %d", qPrintable(xdgRuntimeDir),
qWarning("QStandardPaths: wrong ownership on runtime directory %ls, %d instead of %d",
qUtf16Printable(xdgRuntimeDir),
fileInfo.ownerId(), myUid);
return QString();
}
@ -163,8 +165,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (fileInfo.permissions() != wantedPerms) {
QFile file(xdgRuntimeDir);
if (!file.setPermissions(wantedPerms)) {
qWarning("QStandardPaths: could not set correct permissions on runtime directory %s: %s",
qPrintable(xdgRuntimeDir), qPrintable(file.errorString()));
qWarning("QStandardPaths: could not set correct permissions on runtime directory %ls: %ls",
qUtf16Printable(xdgRuntimeDir), qUtf16Printable(file.errorString()));
return QString();
}
}

View File

@ -3266,10 +3266,10 @@ QUrl QUrl::resolved(const QUrl &relative) const
removeDotsFromPath(&t.d->path);
#if defined(QURL_DEBUG)
qDebug("QUrl(\"%s\").resolved(\"%s\") = \"%s\"",
qPrintable(url()),
qPrintable(relative.url()),
qPrintable(t.url()));
qDebug("QUrl(\"%ls\").resolved(\"%ls\") = \"%ls\"",
qUtf16Printable(url()),
qUtf16Printable(relative.url()),
qUtf16Printable(t.url()));
#endif
return t;
}

View File

@ -226,6 +226,13 @@ bool QCoreApplicationPrivate::checkInstance(const char *function)
return b;
}
void QCoreApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options)
{
options->append(QCommandLineOption(QStringLiteral("qmljsdebugger"),
QStringLiteral("Activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block]. \"block\" makes the application wait for a connection."),
QStringLiteral("value")));
}
void QCoreApplicationPrivate::processCommandLineArguments()
{
int j = argc ? 1 : 0;

View File

@ -227,6 +227,7 @@ private:
#endif
friend Q_CORE_EXPORT QString qAppName();
friend class QClassFactory;
friend class QCommandLineParserPrivate;
};
#ifdef QT_NO_DEPRECATED

View File

@ -52,6 +52,7 @@
//
#include "QtCore/qcoreapplication.h"
#include "QtCore/qcommandlineoption.h"
#include "QtCore/qtranslator.h"
#if QT_CONFIG(settings)
#include "QtCore/qsettings.h"
@ -84,6 +85,11 @@ public:
};
QCoreApplicationPrivate(int &aargc, char **aargv, uint flags);
// If not inheriting from QObjectPrivate: force this class to be polymorphic
#ifdef QT_NO_QOBJECT
virtual
#endif
~QCoreApplicationPrivate();
void init();
@ -99,6 +105,8 @@ public:
static bool checkInstance(const char *method);
virtual void addQtOptions(QList<QCommandLineOption> *options);
#ifndef QT_NO_QOBJECT
bool sendThroughApplicationEventFilters(QObject *, QEvent *);
static bool sendThroughObjectEventFilters(QObject *, QEvent *);

View File

@ -82,8 +82,13 @@ extern uint qGlobalPostedEventsCount();
enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
WM_QT_ACTIVATENOTIFIERS = WM_USER + 2,
SendPostedEventsWindowsTimerId = ~1u
WM_QT_ACTIVATENOTIFIERS = WM_USER + 2
};
// WM_QT_SENDPOSTEDEVENTS message parameter
enum {
WMWP_QT_TOFOREIGNLOOP = 0,
WMWP_QT_FROMWAKEUP
};
class QEventDispatcherWin32Private;
@ -96,8 +101,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
wakeUps(0), activateNotifiersPosted(false), winEventNotifierActivatedEvent(NULL)
getMessageHook(0), wakeUps(0), activateNotifiersPosted(false),
winEventNotifierActivatedEvent(NULL)
{
}
@ -234,22 +239,20 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
return 0;
}
case WM_TIMER:
if (d->sendPostedEventsWindowsTimerId == 0
|| wp != uint(d->sendPostedEventsWindowsTimerId)) {
Q_ASSERT(d != 0);
d->sendTimerEvent(wp);
return 0;
}
// we also use a Windows timer to send posted events when the message queue is full
Q_FALLTHROUGH();
case WM_QT_SENDPOSTEDEVENTS: {
const int localSerialNumber = d->serialNumber.load();
if (localSerialNumber != d->lastSerialNumber) {
d->lastSerialNumber = localSerialNumber;
q->sendPostedEvents();
}
Q_ASSERT(d != 0);
d->sendTimerEvent(wp);
return 0;
case WM_QT_SENDPOSTEDEVENTS:
Q_ASSERT(d != 0);
// Allow posting WM_QT_SENDPOSTEDEVENTS message.
d->wakeUps.store(0);
// We send posted events manually, if the window procedure was invoked
// by the foreign event loop (e.g. from the native modal dialog).
q->sendPostedEvents();
return 0;
}
} // switch (message)
return DefWindowProc(hwnd, message, wp, lp);
@ -272,39 +275,6 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
Q_ASSERT(q != 0);
if (wp == PM_REMOVE) {
if (q) {
MSG *msg = (MSG *) lp;
QEventDispatcherWin32Private *d = q->d_func();
const int localSerialNumber = d->serialNumber.load();
static const UINT mask = inputTimerMask();
if (HIWORD(GetQueueStatus(mask)) == 0) {
// no more input or timer events in the message queue, we can allow posted events to be sent normally now
if (d->sendPostedEventsWindowsTimerId != 0) {
// stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message
KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId);
d->sendPostedEventsWindowsTimerId = 0;
}
(void) d->wakeUps.fetchAndStoreRelease(0);
if (localSerialNumber != d->lastSerialNumber
// if this message IS the one that triggers sendPostedEvents(), no need to post it again
&& (msg->hwnd != d->internalHwnd
|| msg->message != WM_QT_SENDPOSTEDEVENTS)) {
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
}
} else if (d->sendPostedEventsWindowsTimerId == 0
&& localSerialNumber != d->lastSerialNumber) {
// start a special timer to continue delivering posted events while
// there are still input and timer messages in the message queue
d->sendPostedEventsWindowsTimerId = SetTimer(d->internalHwnd,
SendPostedEventsWindowsTimerId,
0, // we specify zero, but Windows uses USER_TIMER_MINIMUM
NULL);
// we don't check the return value of SetTimer()... if creating the timer failed, there's little
// we can do. we just have to accept that posted events will be starved
}
}
}
return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0;
}
@ -342,7 +312,7 @@ QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext()
wc.lpszClassName = className;
atom = RegisterClass(&wc);
if (!atom) {
qErrnoWarning("%s RegisterClass() failed", qPrintable(qClassName));
qErrnoWarning("%ls RegisterClass() failed", qUtf16Printable(qClassName));
delete [] className;
className = 0;
}
@ -504,8 +474,8 @@ void QEventDispatcherWin32::installMessageHook()
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (Q_UNLIKELY(!d->getMessageHook)) {
int errorCode = GetLastError();
qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %s",
errorCode, qPrintable(qt_error_string(errorCode)));
qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %ls",
errorCode, qUtf16Printable(qt_error_string(errorCode)));
}
}
@ -559,9 +529,12 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
d->interrupt.store(false);
emit awake();
// To prevent livelocks, send posted events once per iteration.
// QCoreApplication::sendPostedEvents() takes care about recursions.
sendPostedEvents();
bool canWait;
bool retVal = false;
bool seenWM_QT_SENDPOSTEDEVENTS = false;
bool needWM_QT_SENDPOSTEDEVENTS = false;
do {
DWORD waitRet = 0;
@ -615,14 +588,15 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
(void) qt_GetMessageHook(0, PM_REMOVE, reinterpret_cast<LPARAM>(&msg));
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
if (seenWM_QT_SENDPOSTEDEVENTS) {
// when calling processEvents() "manually", we only want to send posted
// events once
needWM_QT_SENDPOSTEDEVENTS = true;
continue;
// Set result to 'true', if the message was sent by wakeUp().
if (msg.wParam == WMWP_QT_FROMWAKEUP) {
d->wakeUps.store(0);
retVal = true;
}
seenWM_QT_SENDPOSTEDEVENTS = true;
} else if (msg.message == WM_TIMER) {
needWM_QT_SENDPOSTEDEVENTS = true;
continue;
}
if (msg.message == WM_TIMER) {
// avoid live-lock by keeping track of the timers we've already sent
bool found = false;
for (int i = 0; !found && i < processedTimers.count(); ++i) {
@ -639,10 +613,22 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
if (!filterNativeEvent(QByteArrayLiteral("windows_generic_MSG"), &msg, 0)) {
// Post WM_QT_SENDPOSTEDEVENTS before calling external code,
// as it can start a foreign event loop.
if (needWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = false;
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS,
WMWP_QT_TOFOREIGNLOOP, 0);
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else if (waitRet - WAIT_OBJECT_0 < nCount) {
if (needWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = false;
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS,
WMWP_QT_TOFOREIGNLOOP, 0);
}
activateEventNotifiers();
} else {
// nothing todo so break
@ -660,19 +646,20 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE | MWMO_INPUTAVAILABLE);
emit awake();
if (waitRet - WAIT_OBJECT_0 < nCount) {
if (needWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = false;
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS,
WMWP_QT_TOFOREIGNLOOP, 0);
}
activateEventNotifiers();
retVal = true;
}
}
} while (canWait);
if (!seenWM_QT_SENDPOSTEDEVENTS && (flags & QEventLoop::EventLoopExec) == 0) {
// when called "manually", always send posted events
sendPostedEvents();
}
if (needWM_QT_SENDPOSTEDEVENTS)
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS,
WMWP_QT_TOFOREIGNLOOP, 0);
return retVal;
}
@ -1016,10 +1003,11 @@ int QEventDispatcherWin32::remainingTime(int timerId)
void QEventDispatcherWin32::wakeUp()
{
Q_D(QEventDispatcherWin32);
d->serialNumber.ref();
if (d->internalHwnd && d->wakeUps.testAndSetAcquire(0, 1)) {
// post a WM_QT_SENDPOSTEDEVENTS to this thread if there isn't one already pending
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
if (!PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS,
WMWP_QT_FROMWAKEUP, 0))
qErrnoWarning("QEventDispatcherWin32::wakeUp: Failed to post a message");
}
}

View File

@ -172,8 +172,6 @@ public:
HHOOK getMessageHook;
// for controlling when to send posted events
QAtomicInt serialNumber;
int lastSerialNumber, sendPostedEventsWindowsTimerId;
QAtomicInt wakeUps;
// timers

View File

@ -1759,11 +1759,11 @@ void QObject::killTimer(int id)
int at = d->extraData ? d->extraData->runningTimers.indexOf(id) : -1;
if (at == -1) {
// timer isn't owned by this object
qWarning("QObject::killTimer(): Error: timer id %d is not valid for object %p (%s, %s), timer has not been killed",
qWarning("QObject::killTimer(): Error: timer id %d is not valid for object %p (%s, %ls), timer has not been killed",
id,
this,
metaObject()->className(),
qPrintable(objectName()));
qUtf16Printable(objectName()));
return;
}

View File

@ -237,7 +237,7 @@ public:
{
return reinterpret_cast<const ConnectionList *>(this + 1)[i + 1];
}
int count() { return static_cast<int>(allocated); }
int count() const { return static_cast<int>(allocated); }
};

View File

@ -673,7 +673,7 @@ void QMimeXMLProvider::load(const QString &fileName)
{
QString errorMessage;
if (!load(fileName, &errorMessage))
qWarning("QMimeDatabase: Error loading %s\n%s", qPrintable(fileName), qPrintable(errorMessage));
qWarning("QMimeDatabase: Error loading %ls\n%ls", qUtf16Printable(fileName), qUtf16Printable(errorMessage));
}
bool QMimeXMLProvider::load(const QString &fileName, QString *errorMessage)

View File

@ -241,8 +241,8 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
if (lib)
lib->errorString = file.errorString();
if (qt_debug_component()) {
qWarning("%s: %s", QFile::encodeName(library).constData(),
qPrintable(QSystemError::stdString()));
qWarning("%s: %ls", QFile::encodeName(library).constData(),
qUtf16Printable(QSystemError::stdString()));
}
return false;
}
@ -275,7 +275,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
int r = QElfParser().parse(filedata, fdlen, library, lib, &pos, &fdlen);
if (r == QElfParser::Corrupt || r == QElfParser::NotElf) {
if (lib && qt_debug_component()) {
qWarning("QElfParser: %s",qPrintable(lib->errorString));
qWarning("QElfParser: %ls", qUtf16Printable(lib->errorString));
}
return false;
} else if (r == QElfParser::QtMetaDataSection) {
@ -292,7 +292,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
int r = QMachOParser::parse(filedata, fdlen, library, &errorString, &pos, &fdlen);
if (r == QMachOParser::NotSuitable) {
if (qt_debug_component())
qWarning("QMachOParser: %s", qPrintable(errorString));
qWarning("QMachOParser: %ls", qUtf16Printable(errorString));
if (lib)
lib->errorString = errorString;
return false;
@ -319,8 +319,8 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
QString errMsg;
QJsonDocument doc = qJsonFromRawLibraryMetaData(data, fdlen, &errMsg);
if (doc.isNull()) {
qWarning("Found invalid metadata in lib %s: %s",
qPrintable(library), qPrintable(errMsg));
qWarning("Found invalid metadata in lib %ls: %ls",
qUtf16Printable(library), qUtf16Printable(errMsg));
} else {
lib->metaData = doc.object();
if (qt_debug_component())
@ -356,11 +356,11 @@ static void installCoverageTool(QLibraryPrivate *libPrivate)
if (qt_debug_component()) {
if (ret >= 0) {
qDebug("coverage data for %s registered",
qPrintable(libPrivate->fileName));
qDebug("coverage data for %ls registered",
qUtf16Printable(libPrivate->fileName));
} else {
qWarning("could not register %s: error %d; coverage data may be incomplete",
qPrintable(libPrivate->fileName),
qWarning("could not register %ls: error %d; coverage data may be incomplete",
qUtf16Printable(libPrivate->fileName),
ret);
}
}

View File

@ -1526,8 +1526,8 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);
pendingErrorStates -= configuration;
} else {
qWarning("Unrecoverable error detected in running state machine: %s",
qPrintable(errorString));
qWarning("Unrecoverable error detected in running state machine: %ls",
qUtf16Printable(errorString));
q->stop();
}
}

View File

@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
static void report_error(int code, const char *where, const char *what)
{
if (code != 0)
qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code)));
qErrnoWarning(code, "%s: %s failure", where, what);
}
#ifdef QT_UNIX_SEMAPHORE

View File

@ -714,8 +714,7 @@ void QThread::start(Priority priority)
#endif // _POSIX_THREAD_ATTR_STACKSIZE
if (code) {
qWarning("QThread::start: Thread stack size error: %s",
qPrintable(qt_error_string(code)));
qErrnoWarning(code, "QThread::start: Thread stack size error");
// we failed to set the stacksize, and as the documentation states,
// the thread will fail to run...
@ -740,7 +739,7 @@ void QThread::start(Priority priority)
pthread_attr_destroy(&attr);
if (code) {
qWarning("QThread::start: Thread creation error: %s", qPrintable(qt_error_string(code)));
qErrnoWarning(code, "QThread::start: Thread creation error");
d->running = false;
d->finished = false;
@ -759,8 +758,7 @@ void QThread::terminate()
int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId.load()));
if (code) {
qWarning("QThread::start: Thread termination error: %s",
qPrintable(qt_error_string((code))));
qErrnoWarning(code, "QThread::start: Thread termination error");
}
#endif
}

View File

@ -72,7 +72,7 @@ __attribute__((weakref("__pthread_cond_timedwait_relative")));
static void report_error(int code, const char *where, const char *what)
{
if (code != 0)
qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code)));
qErrnoWarning(code, "%s: %s failure", where, what);
}
void qt_initialize_pthread_cond(pthread_cond_t *cond, const char *where)

View File

@ -41,6 +41,7 @@
#include "qcommandlineparser.h"
#include <qcoreapplication.h>
#include <private/qcoreapplication_p.h>
#include <qhash.h>
#include <qvector.h>
#include <qdebug.h>
@ -70,11 +71,12 @@ public:
bool parse(const QStringList &args);
void checkParsed(const char *method);
QStringList aliases(const QString &name) const;
QString helpText() const;
QString helpText(bool includeQtOptions) const;
bool registerFoundOption(const QString &optionName);
bool parseOptionValue(const QString &optionName, const QString &argument,
QStringList::const_iterator *argumentIterator,
QStringList::const_iterator argsEnd);
Q_NORETURN void showHelp(int exitCode, bool includeQtOptions);
//! Error text set when parse() returns false
QString errorText;
@ -130,7 +132,7 @@ QStringList QCommandLineParserPrivate::aliases(const QString &optionName) const
{
const NameHash_t::const_iterator it = nameHash.constFind(optionName);
if (it == nameHash.cend()) {
qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName));
qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
return QStringList();
}
return commandLineOptionList.at(*it).names();
@ -419,7 +421,9 @@ QCommandLineOption QCommandLineParser::addVersionOption()
/*!
Adds the help option (\c{-h}, \c{--help} and \c{-?} on Windows)
This option is handled automatically by QCommandLineParser.
as well as an option \c{--help-all} to include Qt-specific options in the output.
These options are handled automatically by QCommandLineParser.
Remember to use setApplicationDescription to set the application description,
which will be displayed when this option is used.
@ -436,8 +440,10 @@ QCommandLineOption QCommandLineParser::addHelpOption()
<< QStringLiteral("?")
#endif
<< QStringLiteral("h")
<< QStringLiteral("help"), tr("Displays this help."));
<< QStringLiteral("help"), tr("Displays help on commandline options."));
addOption(opt);
QCommandLineOption optHelpAll(QStringLiteral("help-all"), tr("Displays help including Qt specific options."));
addOption(optHelpAll);
d->builtinHelpOption = true;
return opt;
}
@ -554,9 +560,9 @@ static void showParserMessage(const QString &message, MessageType type)
{
#if defined(Q_OS_WINRT)
if (type == UsageMessage)
qInfo(qPrintable(message));
qInfo("%ls", qUtf16Printable(message));
else
qCritical(qPrintable(message));
qCritical("%ls", qUtf16Printable(message));
return;
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
if (displayMessageBox()) {
@ -581,7 +587,8 @@ static void showParserMessage(const QString &message, MessageType type)
In addition to parsing the options (like parse()), this function also handles the builtin
options and handles errors.
The builtin options are \c{--version} if addVersionOption was called and \c{--help} if addHelpOption was called.
The builtin options are \c{--version} if addVersionOption was called and
\c{--help} / \c{--help-all} if addHelpOption was called.
When invoking one of these options, or when an error happens (for instance an unknown option was
passed), the current process will then stop, using the exit() function.
@ -600,7 +607,10 @@ void QCommandLineParser::process(const QStringList &arguments)
showVersion();
if (d->builtinHelpOption && isSet(QStringLiteral("help")))
showHelp(EXIT_SUCCESS);
d->showHelp(EXIT_SUCCESS, false);
if (d->builtinHelpOption && isSet(QStringLiteral("help-all")))
d->showHelp(EXIT_SUCCESS, true);
}
/*!
@ -888,7 +898,7 @@ QStringList QCommandLineParser::values(const QString &optionName) const
return values;
}
qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName));
qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
return QStringList();
}
@ -1033,7 +1043,12 @@ Q_NORETURN void QCommandLineParser::showVersion()
*/
Q_NORETURN void QCommandLineParser::showHelp(int exitCode)
{
showParserMessage(d->helpText(), UsageMessage);
d->showHelp(exitCode, false);
}
Q_NORETURN void QCommandLineParserPrivate::showHelp(int exitCode, bool includeQtOptions)
{
showParserMessage(helpText(includeQtOptions), UsageMessage);
qt_call_post_routines();
::exit(exitCode);
}
@ -1045,7 +1060,7 @@ Q_NORETURN void QCommandLineParser::showHelp(int exitCode)
*/
QString QCommandLineParser::helpText() const
{
return d->helpText();
return d->helpText(false);
}
static QString wrapText(const QString &names, int longestOptionNameString, const QString &description)
@ -1103,13 +1118,16 @@ static QString wrapText(const QString &names, int longestOptionNameString, const
return text;
}
QString QCommandLineParserPrivate::helpText() const
QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
{
const QLatin1Char nl('\n');
QString text;
QString usage;
usage += QCoreApplication::instance()->arguments().constFirst(); // executable name
if (!commandLineOptionList.isEmpty())
QList<QCommandLineOption> options = commandLineOptionList;
if (includeQtOptions)
QCoreApplication::instance()->d_func()->addQtOptions(&options);
if (!options.isEmpty())
usage += QLatin1Char(' ') + QCommandLineParser::tr("[options]");
for (const PositionalArgumentDefinition &arg : positionalArgumentDefinitions)
usage += QLatin1Char(' ') + arg.syntax;
@ -1117,12 +1135,12 @@ QString QCommandLineParserPrivate::helpText() const
if (!description.isEmpty())
text += description + nl;
text += nl;
if (!commandLineOptionList.isEmpty())
if (!options.isEmpty())
text += QCommandLineParser::tr("Options:") + nl;
QStringList optionNameList;
optionNameList.reserve(commandLineOptionList.size());
optionNameList.reserve(options.size());
int longestOptionNameString = 0;
for (const QCommandLineOption &option : commandLineOptionList) {
for (const QCommandLineOption &option : qAsConst(options)) {
if (option.flags() & QCommandLineOption::HiddenFromHelp)
continue;
const QStringList optionNames = option.names();
@ -1141,14 +1159,14 @@ QString QCommandLineParserPrivate::helpText() const
}
++longestOptionNameString;
auto optionNameIterator = optionNameList.cbegin();
for (const QCommandLineOption &option : commandLineOptionList) {
for (const QCommandLineOption &option : qAsConst(options)) {
if (option.flags() & QCommandLineOption::HiddenFromHelp)
continue;
text += wrapText(*optionNameIterator, longestOptionNameString, option.description());
++optionNameIterator;
}
if (!positionalArgumentDefinitions.isEmpty()) {
if (!commandLineOptionList.isEmpty())
if (!options.isEmpty())
text += nl;
text += QCommandLineParser::tr("Arguments:") + nl;
for (const PositionalArgumentDefinition &arg : positionalArgumentDefinitions)

View File

@ -77,8 +77,8 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const
{
if (index < 0 || index >= sectionNodes.size()) {
#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::getDigit() Internal error (%s %d)",
qPrintable(t.toString()), index);
qWarning("QDateTimeParser::getDigit() Internal error (%ls %d)",
qUtf16Printable(t.toString()), index);
#else
qWarning("QDateTimeParser::getDigit() Internal error (%d)", index);
#endif
@ -103,8 +103,8 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const
}
#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::getDigit() Internal error 2 (%s %d)",
qPrintable(t.toString()), index);
qWarning("QDateTimeParser::getDigit() Internal error 2 (%ls %d)",
qUtf16Printable(t.toString()), index);
#else
qWarning("QDateTimeParser::getDigit() Internal error 2 (%d)", index);
#endif
@ -127,8 +127,8 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
{
if (index < 0 || index >= sectionNodes.size()) {
#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::setDigit() Internal error (%s %d %d)",
qPrintable(v.toString()), index, newVal);
qWarning("QDateTimeParser::setDigit() Internal error (%ls %d %d)",
qUtf16Printable(v.toString()), index, newVal);
#else
qWarning("QDateTimeParser::setDigit() Internal error (%d %d)", index, newVal);
#endif
@ -176,8 +176,8 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
break;
case AmPmSection: hour = (newVal == 0 ? hour % 12 : (hour % 12) + 12); break;
default:
qWarning("QDateTimeParser::setDigit() Internal error (%s)",
qPrintable(node.name()));
qWarning("QDateTimeParser::setDigit() Internal error (%ls)",
qUtf16Printable(node.name()));
break;
}
@ -238,8 +238,8 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
case AmPmSection: return 1;
default: break;
}
qWarning("QDateTimeParser::absoluteMax() Internal error (%s)",
qPrintable(sn.name()));
qWarning("QDateTimeParser::absoluteMax() Internal error (%ls)",
qUtf16Printable(sn.name()));
return -1;
}
@ -270,8 +270,8 @@ int QDateTimeParser::absoluteMin(int s) const
case AmPmSection: return 0;
default: break;
}
qWarning("QDateTimeParser::absoluteMin() Internal error (%s, %0x)",
qPrintable(sn.name()), sn.type);
qWarning("QDateTimeParser::absoluteMin() Internal error (%ls, %0x)",
qUtf16Printable(sn.name()), sn.type);
return -1;
}
@ -326,7 +326,7 @@ int QDateTimeParser::sectionPos(const SectionNode &sn) const
default: break;
}
if (sn.pos == -1) {
qWarning("QDateTimeParser::sectionPos Internal error (%s)", qPrintable(sn.name()));
qWarning("QDateTimeParser::sectionPos Internal error (%ls)", qUtf16Printable(sn.name()));
return -1;
}
return sn.pos;
@ -733,8 +733,8 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
ParsedSection result; // initially Invalid
const SectionNode &sn = sectionNode(sectionIndex);
if (sn.type & Internal) {
qWarning("QDateTimeParser::parseSection Internal error (%s %d)",
qPrintable(sn.name()), sectionIndex);
qWarning("QDateTimeParser::parseSection Internal error (%ls %d)",
qUtf16Printable(sn.name()), sectionIndex);
return result;
}
@ -884,8 +884,8 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
}
break; }
default:
qWarning("QDateTimeParser::parseSection Internal error (%s %d)",
qPrintable(sn.name()), sectionIndex);
qWarning("QDateTimeParser::parseSection Internal error (%ls %d)",
qUtf16Printable(sn.name()), sectionIndex);
return result;
}
Q_ASSERT(result.state != Invalid || result.value == -1);
@ -1199,8 +1199,8 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
case DaySection: current = &day; sect.value = qMax<int>(1, sect.value); break;
case AmPmSection: current = &ampm; break;
default:
qWarning("QDateTimeParser::parse Internal error (%s)",
qPrintable(sn.name()));
qWarning("QDateTimeParser::parse Internal error (%ls)",
qUtf16Printable(sn.name()));
break;
}
@ -1390,8 +1390,8 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu
if (context != FromString && scan.value < minimum) {
const QLatin1Char space(' ');
if (scan.value >= minimum)
qWarning("QDateTimeParser::parse Internal error 3 (%s %s)",
qPrintable(scan.value.toString()), qPrintable(minimum.toString()));
qWarning("QDateTimeParser::parse Internal error 3 (%ls %ls)",
qUtf16Printable(scan.value.toString()), qUtf16Printable(minimum.toString()));
bool done = false;
scan.state = Invalid;
@ -1473,8 +1473,8 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu
const int min = getDigit(minimum, i);
if (min == -1) {
qWarning("QDateTimeParser::parse Internal error 4 (%s)",
qPrintable(sn.name()));
qWarning("QDateTimeParser::parse Internal error 4 (%ls)",
qUtf16Printable(sn.name()));
scan.state = Invalid;
done = true;
break;
@ -1772,8 +1772,8 @@ int QDateTimeParser::SectionNode::maxChange() const
case YearSection: return 9999 * 365;
case YearSection2Digits: return 100 * 365;
default:
qWarning("QDateTimeParser::maxChange() Internal error (%s)",
qPrintable(name()));
qWarning("QDateTimeParser::maxChange() Internal error (%ls)",
qUtf16Printable(name()));
}
return -1;
@ -1821,8 +1821,8 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
case TimeZoneSection:
break;
default:
qWarning("QDateTimeParser::fieldInfo Internal error 2 (%d %s %d)",
index, qPrintable(sn.name()), sn.count);
qWarning("QDateTimeParser::fieldInfo Internal error 2 (%d %ls %d)",
index, qUtf16Printable(sn.name()), sn.count);
break;
}
return ret;
@ -1845,8 +1845,8 @@ QString QDateTimeParser::SectionNode::format() const
case YearSection2Digits:
case YearSection: fillChar = QLatin1Char('y'); break;
default:
qWarning("QDateTimeParser::sectionFormat Internal error (%s)",
qPrintable(name(type)));
qWarning("QDateTimeParser::sectionFormat Internal error (%ls)",
qUtf16Printable(name(type)));
return QString();
}
if (fillChar.isNull()) {

View File

@ -709,7 +709,7 @@ void QHashData::dump()
}
n = n->next;
}
qDebug("%s", qPrintable(line));
qDebug("%ls", qUtf16Printable(line));
}
}
}

View File

@ -45,6 +45,7 @@
#include <QtCore/qpair.h>
#include <numeric> // for std::accumulate
#include <functional> // for std::hash
#if 0
#pragma qt_class(QHashFunctions)
@ -172,6 +173,41 @@ template <typename T1, typename T2> inline uint qHash(const std::pair<T1, T2> &k
return seed;
}
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, Arguments) \
QT_BEGIN_INCLUDE_NAMESPACE \
namespace std { \
template <> \
struct hash< QT_PREPEND_NAMESPACE(Class) > { \
using argument_type = QT_PREPEND_NAMESPACE(Class); \
using result_type = size_t; \
size_t operator()(Arguments s) const \
noexcept(noexcept(QT_PREPEND_NAMESPACE(qHash)(s))) \
{ \
/* this seeds qHash with the result of */ \
/* std::hash applied to an int, to reap */ \
/* any protection against predictable hash */ \
/* values the std implementation may provide */ \
return QT_PREPEND_NAMESPACE(qHash)(s, \
QT_PREPEND_NAMESPACE(qHash)( \
std::hash<int>{}(0))); \
} \
}; \
} \
QT_END_INCLUDE_NAMESPACE \
/*end*/
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(Class) \
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, const argument_type &)
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(Class) \
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, argument_type)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QString)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QStringRef)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(QStringView)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(QLatin1String)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QByteArray)
QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QBitArray)
QT_END_NAMESPACE
#if defined(Q_CC_MSVC)

View File

@ -489,8 +489,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
} else if (typeId == CFStringGetTypeID()) {
result = QStringList(QString::fromCFString(languages.as<CFStringRef>()));
} else {
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io",
qPrintable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%ls\"; please report to http://bugreports.qt.io",
qUtf16Printable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}

View File

@ -1048,8 +1048,8 @@ void QRegularExpressionPrivate::getPatternInfo()
unsigned int hasJOptionChanged;
pcre2_pattern_info_16(compiledPattern, PCRE2_INFO_JCHANGED, &hasJOptionChanged);
if (Q_UNLIKELY(hasJOptionChanged)) {
qWarning("QRegularExpressionPrivate::getPatternInfo(): the pattern '%s'\n is using the (?J) option; duplicate capturing group names are not supported by Qt",
qPrintable(pattern));
qWarning("QRegularExpressionPrivate::getPatternInfo(): the pattern '%ls'\n is using the (?J) option; duplicate capturing group names are not supported by Qt",
qUtf16Printable(pattern));
}
}

View File

@ -678,9 +678,11 @@ public:
#else
template <class X> friend class QSharedPointer;
template <class X> friend class QPointer;
# ifndef QT_NO_QOBJECT
template<typename X>
friend QWeakPointer<typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<X*>::Value, X>::type>
qWeakPointerFromVariant(const QVariant &variant);
# endif
template<typename X>
friend QPointer<X>
qPointerFromVariant(const QVariant &variant);

View File

@ -1306,6 +1306,58 @@ static void init_plugins(const QList<QByteArray> &pluginList)
}
}
void QGuiApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options)
{
QCoreApplicationPrivate::addQtOptions(options);
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
const QByteArray sessionType = qgetenv("XDG_SESSION_TYPE");
const bool x11 = sessionType == "x11";
// Technically the x11 aliases are only available if platformName is "xcb", but we can't know that here.
#else
const bool x11 = false;
#endif
options->append(QCommandLineOption(QStringLiteral("platform"),
QGuiApplication::tr("QPA plugin. See QGuiApplication documentation for available options for each plugin."), QStringLiteral("platformName[:options]")));
options->append(QCommandLineOption(QStringLiteral("platformpluginpath"),
QGuiApplication::tr("Path to the platform plugins."), QStringLiteral("path")));
options->append(QCommandLineOption(QStringLiteral("platformtheme"),
QGuiApplication::tr("Platform theme."), QStringLiteral("theme")));
options->append(QCommandLineOption(QStringLiteral("plugin"),
QGuiApplication::tr("Additional plugins to load, can be specified multiple times."), QStringLiteral("plugin")));
options->append(QCommandLineOption(QStringLiteral("qwindowgeometry"),
QGuiApplication::tr("Window geometry for the main window, using the X11-syntax, like 100x100+50+50."), QStringLiteral("geometry")));
options->append(QCommandLineOption(QStringLiteral("qwindowicon"),
QGuiApplication::tr("Default window icon."), QStringLiteral("icon")));
options->append(QCommandLineOption(QStringLiteral("qwindowtitle"),
QGuiApplication::tr("Title of the first window."), QStringLiteral("title")));
options->append(QCommandLineOption(QStringLiteral("reverse"),
QGuiApplication::tr("Sets the application's layout direction to Qt::RightToLeft (debugging helper).")));
options->append(QCommandLineOption(QStringLiteral("session"),
QGuiApplication::tr("Restores the application from an earlier session."), QStringLiteral("session")));
if (x11) {
options->append(QCommandLineOption(QStringLiteral("display"),
QGuiApplication::tr("Display name, overrides $DISPLAY."), QStringLiteral("display")));
options->append(QCommandLineOption(QStringLiteral("name"),
QGuiApplication::tr("Instance name according to ICCCM 4.1.2.5."), QStringLiteral("name")));
options->append(QCommandLineOption(QStringLiteral("nograb"),
QGuiApplication::tr("Disable mouse grabbing (useful in debuggers).")));
options->append(QCommandLineOption(QStringLiteral("dograb"),
QGuiApplication::tr("Force mouse grabbing (even when running in a debugger).")));
options->append(QCommandLineOption(QStringLiteral("visual"),
QGuiApplication::tr("ID of the X11 Visual to use."), QStringLiteral("id")));
// Not using the "QStringList names" solution for those aliases, because it makes the first column too wide
options->append(QCommandLineOption(QStringLiteral("geometry"),
QGuiApplication::tr("Alias for --windowgeometry."), QStringLiteral("geometry")));
options->append(QCommandLineOption(QStringLiteral("icon"),
QGuiApplication::tr("Alias for --windowicon."), QStringLiteral("icon")));
options->append(QCommandLineOption(QStringLiteral("title"),
QGuiApplication::tr("Alias for --windowtitle."), QStringLiteral("title")));
}
}
void QGuiApplicationPrivate::createPlatformIntegration()
{
QHighDpiScaling::initHighDpiScaling();

View File

@ -92,6 +92,7 @@ public:
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);
void addQtOptions(QList<QCommandLineOption> *options) override;
virtual bool shouldQuit() override;
bool shouldQuitInternal(const QWindowList &processedWindows);

View File

@ -413,6 +413,8 @@ public:
static inline QPoint origin(const QPlatformScreen *) { return QPoint(); }
static inline QPoint mapPositionFromNative(const QPoint &pos, const QPlatformScreen *) { return pos; }
static inline QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *) { return pos; }
static inline QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
static inline QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
static inline QDpi logicalDpi() { return QDpi(-1,-1); }
};

View File

@ -123,7 +123,11 @@ QSessionManagerPrivate::QSessionManagerPrivate(const QString &id,
const QString &key)
: QObjectPrivate()
{
platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key);
if (qApp->testAttribute(Qt::AA_DisableSessionManager)) {
platformSessionManager = new QPlatformSessionManager(id, key);
} else {
platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key);
}
Q_ASSERT_X(platformSessionManager, "Platform session management",
"No platform session management, should use the default implementation");
}

View File

@ -41,6 +41,7 @@
#include <qtextformat.h>
#include "qtextdocument_p.h"
#include "qtextengine_p.h"
#include "qtextlist.h"
#include "qabstracttextdocumentlayout_p.h"
@ -649,6 +650,36 @@ QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
return pieceTable->formatCollection()->format(it->format);
}
/*!
\since 5.14
Returns the block (probably a list item) whose \l{QTextBlockFormat::marker()}{marker}
is found at the given position \a pos.
*/
QTextBlock QAbstractTextDocumentLayout::blockWithMarkerAt(const QPointF &pos) const
{
QTextBlock block = document()->firstBlock();
while (block.isValid()) {
if (block.blockFormat().marker() != QTextBlockFormat::NoMarker) {
QRectF blockBr = blockBoundingRect(block);
QTextBlockFormat blockFmt = block.blockFormat();
QFontMetrics fm(block.charFormat().font());
qreal totalIndent = blockFmt.indent() + blockFmt.leftMargin() + blockFmt.textIndent();
if (block.textList())
totalIndent += block.textList()->format().indent() * 40;
QRectF adjustedBr = blockBr.adjusted(totalIndent - fm.height(), 0, totalIndent - blockBr.width(), fm.height() - blockBr.height());
if (adjustedBr.contains(pos)) {
//qDebug() << "hit block" << block.text() << blockBr << adjustedBr << "marker" << block.blockFormat().marker()
// << "font" << block.charFormat().font() << "adj" << lineHeight << totalIndent;
if (block.blockFormat().hasProperty(QTextFormat::BlockMarker))
return block;
}
}
block = block.next();
}
return QTextBlock();
}
/*!
\fn QRectF QAbstractTextDocumentLayout::frameBoundingRect(QTextFrame *frame) const

View File

@ -87,6 +87,7 @@ public:
QString anchorAt(const QPointF& pos) const;
QString imageAt(const QPointF &pos) const;
QTextFormat formatAt(const QPointF &pos) const;
QTextBlock blockWithMarkerAt(const QPointF &pos) const;
virtual int pageCount() const = 0;
virtual QSizeF documentSize() const = 0;

View File

@ -138,19 +138,20 @@ struct QFontDef
inline uint qHash(const QFontDef &fd, uint seed = 0) noexcept
{
return qHash(qRound64(fd.pixelSize*10000)) // use only 4 fractional digits
^ qHash(fd.weight)
^ qHash(fd.style)
^ qHash(fd.stretch)
^ qHash(fd.styleHint)
^ qHash(fd.styleStrategy)
^ qHash(fd.ignorePitch)
^ qHash(fd.fixedPitch)
^ qHash(fd.family, seed)
^ qHash(fd.families, seed)
^ qHash(fd.styleName)
^ qHash(fd.hintingPreference)
;
QtPrivate::QHashCombine hash;
seed = hash(seed, qRound64(fd.pixelSize*10000)); // use only 4 fractional digits
seed = hash(seed, fd.weight);
seed = hash(seed, fd.style);
seed = hash(seed, fd.stretch);
seed = hash(seed, fd.styleHint);
seed = hash(seed, fd.styleStrategy);
seed = hash(seed, fd.ignorePitch);
seed = hash(seed, fd.fixedPitch);
seed = hash(seed, fd.family);
seed = hash(seed, fd.families);
seed = hash(seed, fd.styleName);
seed = hash(seed, fd.hintingPreference);
return seed;
}
class QFontEngineData

View File

@ -2076,6 +2076,7 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
The icon needs to be converted to one of the supported types first,
for example using QIcon::pixmap.
\value StyleSheetResource The resource contains CSS.
\value MarkdownResource The resource contains Markdown.
\value UserResource The first available value for user defined
resource types.

View File

@ -228,6 +228,7 @@ public:
HtmlResource = 1,
ImageResource = 2,
StyleSheetResource = 3,
MarkdownResource = 4,
UserResource = 100
};

View File

@ -931,7 +931,10 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
Q_ASSERT(!fd->sizeDirty);
Q_ASSERT(!fd->layoutDirty);
const QPointF off = offset + fd->position.toPointF();
// floor the offset to avoid painting artefacts when drawing adjacent borders
// we later also round table cell heights and widths
const QPointF off = QPointF(QPointF(offset + fd->position.toPointF()).toPoint());
if (context.clip.isValid()
&& (off.y() > context.clip.bottom() || off.y() + fd->size.height.toReal() < context.clip.top()
|| off.x() > context.clip.right() || off.x() + fd->size.width.toReal() < context.clip.left()))
@ -1681,7 +1684,8 @@ recalc_minmax_widths:
for (int n = 0; n < cspan; ++n) {
const int col = i + n;
QFixed w = widthToDistribute / (cspan - n);
td->minWidths[col] = qMax(td->minWidths.at(col), w);
// ceil to avoid going below minWidth when rounding all column widths later
td->minWidths[col] = qMax(td->minWidths.at(col), w).ceil();
widthToDistribute -= td->minWidths.at(col);
if (widthToDistribute <= 0)
break;
@ -1787,6 +1791,18 @@ recalc_minmax_widths:
}
}
// in order to get a correct border rendering we must ensure that the distance between
// two cells is exactly 2 * td->border pixel. we do this by rounding the calculated width
// values here.
// to minimize the total rounding error we propagate the rounding error for each width
// to its successor.
QFixed error = 0;
for (int i = 0; i < columns; ++i) {
QFixed orig = td->widths[i];
td->widths[i] = (td->widths[i] - error).round();
error = td->widths[i] - orig;
}
td->columnPositions.resize(columns);
td->columnPositions[0] = leftMargin /*includes table border*/ + cellSpacing + td->border;
@ -1887,7 +1903,7 @@ relayout:
if (cellRow != r) {
// the last row gets all the remaining space
if (cellRow + rspan - 1 == r)
td->heights[r] = qMax(td->heights.at(r), heightToDistribute.at(c) - dropDistance);
td->heights[r] = qMax(td->heights.at(r), heightToDistribute.at(c) - dropDistance).round();
continue;
}
}
@ -1908,7 +1924,7 @@ relayout:
td, absoluteTableY,
/*withPageBreaks =*/true);
const QFixed height = layoutStruct.y + bottomPadding + topPadding;
const QFixed height = (layoutStruct.y + bottomPadding + topPadding).round();
if (rspan > 1)
heightToDistribute[c] = height + dropDistance;

View File

@ -151,25 +151,16 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
m_blockType = blockType;
switch (blockType) {
case MD_BLOCK_P:
if (m_listStack.isEmpty()) {
m_needsInsertBlock = true;
if (!m_listStack.isEmpty())
qCDebug(lcMD, m_listItem ? "P of LI at level %d" : "P continuation inside LI at level %d", m_listStack.count());
else
qCDebug(lcMD, "P");
} else {
if (m_emptyListItem) {
qCDebug(lcMD, "LI text block at level %d -> BlockIndent %d",
m_listStack.count(), m_cursor->blockFormat().indent());
m_emptyListItem = false;
} else {
qCDebug(lcMD, "P inside LI at level %d", m_listStack.count());
m_needsInsertBlock = true;
}
}
m_needsInsertBlock = true;
break;
case MD_BLOCK_QUOTE: {
case MD_BLOCK_QUOTE:
++m_blockQuoteDepth;
qCDebug(lcMD, "QUOTE level %d", m_blockQuoteDepth);
break;
}
case MD_BLOCK_CODE: {
MD_BLOCK_CODE_DETAIL *detail = static_cast<MD_BLOCK_CODE_DETAIL *>(det);
m_codeBlock = true;
@ -194,51 +185,40 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
qCDebug(lcMD, "H%d", detail->level);
} break;
case MD_BLOCK_LI: {
m_needsInsertBlock = false;
MD_BLOCK_LI_DETAIL *detail = static_cast<MD_BLOCK_LI_DETAIL *>(det);
QTextList *list = m_listStack.top();
QTextBlockFormat bfmt = list->item(list->count() - 1).blockFormat();
bfmt.setMarker(detail->is_task ?
(detail->task_mark == ' ' ? QTextBlockFormat::Unchecked : QTextBlockFormat::Checked) :
QTextBlockFormat::NoMarker);
if (!m_emptyList) {
m_cursor->insertBlock(bfmt, QTextCharFormat());
list->add(m_cursor->block());
}
m_cursor->setBlockFormat(bfmt);
qCDebug(lcMD) << (m_emptyList ? "LI (first in list)" : "LI");
m_emptyList = false; // Avoid insertBlock for the first item (because insertList already did that)
m_needsInsertBlock = true;
m_listItem = true;
m_emptyListItem = true;
MD_BLOCK_LI_DETAIL *detail = static_cast<MD_BLOCK_LI_DETAIL *>(det);
m_markerType = detail->is_task ?
(detail->task_mark == ' ' ? QTextBlockFormat::Unchecked : QTextBlockFormat::Checked) :
QTextBlockFormat::NoMarker;
qCDebug(lcMD) << "LI";
} break;
case MD_BLOCK_UL: {
MD_BLOCK_UL_DETAIL *detail = static_cast<MD_BLOCK_UL_DETAIL *>(det);
QTextListFormat fmt;
fmt.setIndent(m_listStack.count() + 1);
m_listFormat = QTextListFormat();
m_listFormat.setIndent(m_listStack.count() + 1);
switch (detail->mark) {
case '*':
fmt.setStyle(QTextListFormat::ListCircle);
m_listFormat.setStyle(QTextListFormat::ListCircle);
break;
case '+':
fmt.setStyle(QTextListFormat::ListSquare);
m_listFormat.setStyle(QTextListFormat::ListSquare);
break;
default: // including '-'
fmt.setStyle(QTextListFormat::ListDisc);
m_listFormat.setStyle(QTextListFormat::ListDisc);
break;
}
qCDebug(lcMD, "UL %c level %d", detail->mark, m_listStack.count());
m_listStack.push(m_cursor->insertList(fmt));
m_emptyList = true;
m_needsInsertList = true;
} break;
case MD_BLOCK_OL: {
MD_BLOCK_OL_DETAIL *detail = static_cast<MD_BLOCK_OL_DETAIL *>(det);
QTextListFormat fmt;
fmt.setIndent(m_listStack.count() + 1);
fmt.setNumberSuffix(QChar::fromLatin1(detail->mark_delimiter));
fmt.setStyle(QTextListFormat::ListDecimal);
m_listFormat = QTextListFormat();
m_listFormat.setIndent(m_listStack.count() + 1);
m_listFormat.setNumberSuffix(QChar::fromLatin1(detail->mark_delimiter));
m_listFormat.setStyle(QTextListFormat::ListDecimal);
qCDebug(lcMD, "OL xx%d level %d", detail->mark_delimiter, m_listStack.count());
m_listStack.push(m_cursor->insertList(fmt));
m_emptyList = true;
m_needsInsertList = true;
} break;
case MD_BLOCK_TD: {
MD_BLOCK_TD_DETAIL *detail = static_cast<MD_BLOCK_TD_DETAIL *>(det);
@ -299,6 +279,9 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
{
Q_UNUSED(detail)
switch (blockType) {
case MD_BLOCK_P:
m_listItem = false;
break;
case MD_BLOCK_UL:
case MD_BLOCK_OL:
qCDebug(lcMD, "list at level %d ended", m_listStack.count());
@ -525,19 +508,32 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
return 0; // no error
}
/*!
Insert a new block based on stored state.
m_cursor cannot store the state for the _next_ block ahead of time, because
m_cursor->setBlockFormat() controls the format of the block that the cursor
is already in; so cbLeaveBlock() cannot call setBlockFormat() without
altering the block that was just added. Therefore cbLeaveBlock() and the
following cbEnterBlock() set variables to remember what formatting should
come next, and insertBlock() is called just before the actual text
insertion, to create a new block with the right formatting.
*/
void QTextMarkdownImporter::insertBlock()
{
QTextCharFormat charFormat;
if (!m_spanFormatStack.isEmpty())
charFormat = m_spanFormatStack.top();
QTextBlockFormat blockFormat;
if (!m_listStack.isEmpty() && !m_needsInsertList && m_listItem) {
QTextList *list = m_listStack.top();
blockFormat = list->item(list->count() - 1).blockFormat();
}
if (m_blockQuoteDepth) {
blockFormat.setProperty(QTextFormat::BlockQuoteLevel, m_blockQuoteDepth);
blockFormat.setLeftMargin(BlockQuoteIndent * m_blockQuoteDepth);
blockFormat.setRightMargin(BlockQuoteIndent);
}
if (m_listStack.count())
blockFormat.setIndent(m_listStack.count());
if (m_codeBlock) {
blockFormat.setProperty(QTextFormat::BlockCodeLanguage, m_blockCodeLanguage);
charFormat.setFont(m_monoFont);
@ -545,7 +541,19 @@ void QTextMarkdownImporter::insertBlock()
blockFormat.setTopMargin(m_paragraphMargin);
blockFormat.setBottomMargin(m_paragraphMargin);
}
if (m_markerType == QTextBlockFormat::NoMarker)
blockFormat.clearProperty(QTextFormat::BlockMarker);
else
blockFormat.setMarker(m_markerType);
if (!m_listStack.isEmpty())
blockFormat.setIndent(m_listStack.count());
m_cursor->insertBlock(blockFormat, charFormat);
if (m_needsInsertList) {
m_listStack.push(m_cursor->createList(m_listFormat));
} else if (!m_listStack.isEmpty() && m_listItem) {
m_listStack.top()->add(m_cursor->block());
}
m_needsInsertList = false;
m_needsInsertBlock = false;
}

View File

@ -123,14 +123,15 @@ private:
int m_tableRowCount = 0;
int m_tableCol = -1; // because relative cell movements (e.g. m_cursor->movePosition(QTextCursor::NextCell)) don't work
int m_paragraphMargin = 0;
Features m_features;
int m_blockType = 0;
bool m_emptyList = false; // true when the last thing we did was insertList
bool m_listItem = false;
bool m_emptyListItem = false;
Features m_features;
QTextListFormat m_listFormat;
QTextBlockFormat::MarkerType m_markerType = QTextBlockFormat::NoMarker;
bool m_needsInsertBlock = false;
bool m_needsInsertList = false;
bool m_listItem = false; // true from the beginning of LI to the end of the first P
bool m_codeBlock = false;
bool m_imageSpan = false;
bool m_needsInsertBlock = false;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextMarkdownImporter::Features)

View File

@ -212,10 +212,19 @@ QTextMarkdownWriter::ListInfo QTextMarkdownWriter::listInfo(QTextList *list)
static int nearestWordWrapIndex(const QString &s, int before)
{
before = qMin(before, s.length());
for (int i = before - 1; i >= 0; --i) {
if (s.at(i).isSpace())
return i;
int fragBegin = qMax(before - 15, 0);
if (lcMDW().isDebugEnabled()) {
QString frag = s.mid(fragBegin, 30);
qCDebug(lcMDW) << frag << before;
qCDebug(lcMDW) << QString(before - fragBegin, Period) + QLatin1Char('<');
}
for (int i = before - 1; i >= 0; --i) {
if (s.at(i).isSpace()) {
qCDebug(lcMDW) << QString(i - fragBegin, Period) + QLatin1Char('^') << i;
return i;
}
}
qCDebug(lcMDW, "not possible");
return -1;
}
@ -251,7 +260,7 @@ static void maybeEscapeFirstChar(QString &s)
int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat)
{
int ColumnLimit = 80;
const int ColumnLimit = 80;
QTextBlockFormat blockFmt = block.blockFormat();
bool indentedCodeBlock = false;
if (block.textList()) { // it's a list-item
@ -419,12 +428,18 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
int fragLen = fragmentText.length();
bool breakingLine = false;
while (i < fragLen) {
if (col >= ColumnLimit) {
m_stream << Newline << wrapIndentString;
col = m_wrappedLineIndent;
while (fragmentText[i].isSpace())
++i;
}
int j = i + ColumnLimit - col;
if (j < fragLen) {
int wi = nearestWordWrapIndex(fragmentText, j);
if (wi < 0) {
j = fragLen;
} else {
} else if (wi >= i) {
j = wi;
breakingLine = true;
}

View File

@ -600,6 +600,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket,
}
}
#if QT_CONFIG(networkproxy)
// Send "Proxy-Authorization" header, but not if it's NTLM and the socket is already authenticated.
if (channels[i].proxyAuthMethod != QAuthenticatorPrivate::None) {
if (!(channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 407)) {
@ -611,6 +612,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket,
}
}
}
#endif // QT_CONFIG(networkproxy)
}
QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetworkRequest &request)

View File

@ -1344,7 +1344,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
QByteArray QNetworkHeadersPrivate::toHttpDate(const QDateTime &dt)
{
return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'"))
return QLocale::c().toString(dt, QStringViewLiteral("ddd, dd MMM yyyy hh:mm:ss 'GMT'"))
.toLatin1();
}

View File

@ -364,9 +364,9 @@ QSslCertificate QSslError::certificate() const
*/
uint qHash(const QSslError &key, uint seed) noexcept
{
// 2x boost::hash_combine inlined:
seed ^= qHash(key.error()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
seed ^= qHash(key.certificate()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
QtPrivate::QHashCombine hash;
seed = hash(seed, key.error());
seed = hash(seed, key.certificate());
return seed;
}

View File

@ -48,7 +48,7 @@ class QWindowsDirect2DWindow;
class QWindowsDirect2DBackingStore : public QPlatformBackingStore
{
Q_DISABLE_COPY(QWindowsDirect2DBackingStore)
Q_DISABLE_COPY_MOVE(QWindowsDirect2DBackingStore)
public:
QWindowsDirect2DBackingStore(QWindow *window);

View File

@ -59,7 +59,7 @@ class QColor;
class QWindowsDirect2DBitmap
{
Q_DECLARE_PRIVATE(QWindowsDirect2DBitmap)
Q_DISABLE_COPY(QWindowsDirect2DBitmap)
Q_DISABLE_COPY_MOVE(QWindowsDirect2DBitmap)
public:
QWindowsDirect2DBitmap();
QWindowsDirect2DBitmap(ID2D1Bitmap1 *bitmap, ID2D1DeviceContext *dc);

View File

@ -91,7 +91,7 @@ private:
};
class QWindowsDirect2DDeviceContextSuspender {
Q_DISABLE_COPY(QWindowsDirect2DDeviceContextSuspender)
Q_DISABLE_COPY_MOVE(QWindowsDirect2DDeviceContextSuspender)
QWindowsDirect2DDeviceContext *m_dc;
public:

View File

@ -1800,7 +1800,7 @@ void QWindowsDirect2DPaintEngine::resume()
class QWindowsDirect2DPaintEngineSuspenderImpl
{
Q_DISABLE_COPY(QWindowsDirect2DPaintEngineSuspenderImpl)
Q_DISABLE_COPY_MOVE(QWindowsDirect2DPaintEngineSuspenderImpl)
QWindowsDirect2DPaintEngine *m_engine;
bool m_active;
public:

View File

@ -128,7 +128,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowsDirect2DPaintEngine::Flags)
class QWindowsDirect2DPaintEngineSuspenderPrivate;
class QWindowsDirect2DPaintEngineSuspender
{
Q_DISABLE_COPY(QWindowsDirect2DPaintEngineSuspender)
Q_DISABLE_COPY_MOVE(QWindowsDirect2DPaintEngineSuspender)
Q_DECLARE_PRIVATE(QWindowsDirect2DPaintEngineSuspender)
QScopedPointer<QWindowsDirect2DPaintEngineSuspenderPrivate> d_ptr;
public:

View File

@ -52,7 +52,7 @@ class QWindowsNativeImage;
class QWindowsBackingStore : public QPlatformBackingStore
{
Q_DISABLE_COPY(QWindowsBackingStore)
Q_DISABLE_COPY_MOVE(QWindowsBackingStore)
public:
QWindowsBackingStore(QWindow *window);
~QWindowsBackingStore() override;

View File

@ -58,7 +58,7 @@ protected:
class QWindowsClipboard : public QPlatformClipboard
{
Q_DISABLE_COPY(QWindowsClipboard)
Q_DISABLE_COPY_MOVE(QWindowsClipboard)
public:
QWindowsClipboard();
~QWindowsClipboard() override;
@ -87,8 +87,8 @@ private:
QWindowsClipboardRetrievalMimeData m_retrievalData;
QWindowsOleDataObject *m_data = nullptr;
HWND m_clipboardViewer = 0;
HWND m_nextClipboardViewer = 0;
HWND m_clipboardViewer = nullptr;
HWND m_nextClipboardViewer = nullptr;
bool m_formatListenerRegistered = false;
};

View File

@ -80,7 +80,7 @@ bool qWindowsComQueryUnknownInterfaceMulti(Derived *d, REFIID id, LPVOID *iface)
// Helper base class to provide IUnknown methods for COM classes (single inheritance)
template <class ComInterface> class QWindowsComBase : public ComInterface
{
Q_DISABLE_COPY(QWindowsComBase)
Q_DISABLE_COPY_MOVE(QWindowsComBase)
public:
explicit QWindowsComBase(ULONG initialRefCount = 1) : m_ref(initialRefCount) {}
virtual ~QWindowsComBase() = default;

View File

@ -155,7 +155,7 @@ struct QWindowsShcoreDLL {
class QWindowsContext
{
Q_DISABLE_COPY(QWindowsContext)
Q_DISABLE_COPY_MOVE(QWindowsContext)
public:
enum SystemInfoFlags
@ -180,11 +180,11 @@ public:
QString registerWindowClass(const QWindow *w);
QString registerWindowClass(QString cname, WNDPROC proc,
unsigned style = 0, HBRUSH brush = 0,
unsigned style = 0, HBRUSH brush = nullptr,
bool icon = false);
HWND createDummyWindow(const QString &classNameIn,
const wchar_t *windowName,
WNDPROC wndProc = 0, DWORD style = WS_OVERLAPPED);
WNDPROC wndProc = nullptr, DWORD style = WS_OVERLAPPED);
HDC displayContext() const;
int screenDepth() const;

View File

@ -68,7 +68,7 @@ inline uint qHash(const QWindowsPixmapCursorCacheKey &k, uint seed) noexcept
class CursorHandle
{
Q_DISABLE_COPY(CursorHandle)
Q_DISABLE_COPY_MOVE(CursorHandle)
public:
explicit CursorHandle(HCURSOR hcursor = nullptr) : m_hcursor(hcursor) {}
~CursorHandle()

View File

@ -507,7 +507,7 @@ class QWindowsNativeFileDialogBase;
class QWindowsNativeFileDialogEventHandler : public QWindowsComBase<IFileDialogEvents>
{
Q_DISABLE_COPY(QWindowsNativeFileDialogEventHandler)
Q_DISABLE_COPY_MOVE(QWindowsNativeFileDialogEventHandler)
public:
static IFileDialogEvents *create(QWindowsNativeFileDialogBase *nativeFileDialog);

View File

@ -64,7 +64,7 @@ namespace QWindowsDialogs
template <class BaseClass>
class QWindowsDialogHelperBase : public BaseClass
{
Q_DISABLE_COPY(QWindowsDialogHelperBase)
Q_DISABLE_COPY_MOVE(QWindowsDialogHelperBase)
public:
typedef QSharedPointer<QWindowsNativeDialogBase> QWindowsNativeDialogBasePtr;
~QWindowsDialogHelperBase() { cleanupThread(); }
@ -75,7 +75,7 @@ public:
QWindow *parent) override;
void hide() override;
virtual bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const { return true; }
virtual bool supportsNonModalDialog(const QWindow * /* parent */ = nullptr) const { return true; }
protected:
QWindowsDialogHelperBase() = default;
@ -91,7 +91,7 @@ private:
void cleanupThread();
QWindowsNativeDialogBasePtr m_nativeDialog;
HWND m_ownerWindow = 0;
HWND m_ownerWindow = nullptr;
int m_timerId = 0;
QThread *m_thread = nullptr;
};

View File

@ -109,7 +109,7 @@ private:
class QWindowsEGLStaticContext : public QWindowsStaticOpenGLContext
{
Q_DISABLE_COPY(QWindowsEGLStaticContext)
Q_DISABLE_COPY_MOVE(QWindowsEGLStaticContext)
public:
static QWindowsEGLStaticContext *create(QWindowsOpenGLTester::Renderers preferredType);

View File

@ -916,7 +916,7 @@ void QWindowsOpenGLContextFormat::apply(QSurfaceFormat *format) const
class QOpenGLTemporaryContext
{
Q_DISABLE_COPY(QOpenGLTemporaryContext)
Q_DISABLE_COPY_MOVE(QOpenGLTemporaryContext)
public:
QOpenGLTemporaryContext();
~QOpenGLTemporaryContext();

View File

@ -75,9 +75,9 @@ struct QOpenGLContextData
QOpenGLContextData(HGLRC r, HWND h, HDC d) : renderingContext(r), hwnd(h), hdc(d) {}
QOpenGLContextData() {}
HGLRC renderingContext = 0;
HWND hwnd = 0;
HDC hdc = 0;
HGLRC renderingContext = nullptr;
HWND hwnd = nullptr;
HDC hdc = nullptr;
};
class QOpenGLStaticContext;
@ -89,7 +89,7 @@ struct QWindowsOpenGLContextFormat
QSurfaceFormat::OpenGLContextProfile profile = QSurfaceFormat::NoProfile;
int version = 0; //! majorVersion<<8 + minorVersion
QSurfaceFormat::FormatOptions options = 0;
QSurfaceFormat::FormatOptions options = nullptr;
};
#ifndef QT_NO_DEBUG_STREAM
@ -134,7 +134,7 @@ private:
class QOpenGLStaticContext : public QWindowsStaticOpenGLContext
{
Q_DISABLE_COPY(QOpenGLStaticContext)
Q_DISABLE_COPY_MOVE(QOpenGLStaticContext)
QOpenGLStaticContext();
public:
enum Extensions
@ -222,7 +222,7 @@ private:
typedef GLenum (APIENTRY *GlGetGraphicsResetStatusArbType)();
inline void releaseDCs();
bool updateObtainedParams(HDC hdc, int *obtainedSwapInterval = 0);
bool updateObtainedParams(HDC hdc, int *obtainedSwapInterval = nullptr);
QOpenGLStaticContext *m_staticContext;
QOpenGLContext *m_context;

View File

@ -53,12 +53,12 @@ class QWindowsWindow;
class QWindowsInputContext : public QPlatformInputContext
{
Q_DISABLE_COPY(QWindowsInputContext)
Q_DISABLE_COPY_MOVE(QWindowsInputContext)
Q_OBJECT
struct CompositionContext
{
HWND hwnd = 0;
HWND hwnd = nullptr;
QString composition;
int position = 0;
bool isComposing = false;

View File

@ -133,7 +133,7 @@ QT_BEGIN_NAMESPACE
struct QWindowsIntegrationPrivate
{
Q_DISABLE_COPY(QWindowsIntegrationPrivate)
Q_DISABLE_COPY_MOVE(QWindowsIntegrationPrivate)
explicit QWindowsIntegrationPrivate(const QStringList &paramList);
~QWindowsIntegrationPrivate();

View File

@ -54,7 +54,7 @@ class QWindowsStaticOpenGLContext;
class QWindowsIntegration : public QPlatformIntegration
{
Q_DISABLE_COPY(QWindowsIntegration)
Q_DISABLE_COPY_MOVE(QWindowsIntegration)
public:
enum Options { // Options to be passed on command line.
FontDatabaseFreeType = 0x1,

View File

@ -71,7 +71,7 @@ struct KeyboardLayoutItem {
class QWindowsKeyMapper
{
Q_DISABLE_COPY(QWindowsKeyMapper)
Q_DISABLE_COPY_MOVE(QWindowsKeyMapper)
public:
explicit QWindowsKeyMapper();
~QWindowsKeyMapper();

View File

@ -53,7 +53,7 @@ class QMimeData;
class QWindowsMime
{
Q_DISABLE_COPY(QWindowsMime)
Q_DISABLE_COPY_MOVE(QWindowsMime)
public:
QWindowsMime();
virtual ~QWindowsMime();
@ -73,7 +73,7 @@ public:
class QWindowsMimeConverter
{
Q_DISABLE_COPY(QWindowsMimeConverter)
Q_DISABLE_COPY_MOVE(QWindowsMimeConverter)
public:
QWindowsMimeConverter();
~QWindowsMimeConverter();
@ -85,7 +85,7 @@ public:
// Convenience.
QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QVariant::Type preferredType,
QString *format = 0) const;
QString *format = nullptr) const;
void registerMime(QWindowsMime *mime);
void unregisterMime(QWindowsMime *mime) { m_mimes.removeOne(mime); }

View File

@ -54,7 +54,7 @@ class QTouchDevice;
class QWindowsMouseHandler
{
Q_DISABLE_COPY(QWindowsMouseHandler)
Q_DISABLE_COPY_MOVE(QWindowsMouseHandler)
public:
QWindowsMouseHandler();
@ -79,7 +79,7 @@ public:
static Qt::MouseButtons queryMouseButtons();
QWindow *windowUnderMouse() const { return m_windowUnderMouse.data(); }
void clearWindowUnderMouse() { m_windowUnderMouse = 0; }
void clearWindowUnderMouse() { m_windowUnderMouse = nullptr; }
void clearEvents();
private:

View File

@ -51,7 +51,7 @@ class QWindowsOpenGLContext;
class QWindowsStaticOpenGLContext
{
Q_DISABLE_COPY(QWindowsStaticOpenGLContext)
Q_DISABLE_COPY_MOVE(QWindowsStaticOpenGLContext)
public:
static QWindowsStaticOpenGLContext *create();
virtual ~QWindowsStaticOpenGLContext() = default;
@ -63,7 +63,7 @@ public:
// If the windowing system interface needs explicitly created window surfaces (like EGL),
// reimplement these.
virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, int * /*err*/) { return 0; }
virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, int * /*err*/) { return nullptr; }
virtual void destroyWindowSurface(void * /*nativeSurface*/) { }
protected:
@ -75,14 +75,14 @@ private:
class QWindowsOpenGLContext : public QPlatformOpenGLContext
{
Q_DISABLE_COPY(QWindowsOpenGLContext)
Q_DISABLE_COPY_MOVE(QWindowsOpenGLContext)
public:
// Returns the native context handle (e.g. HGLRC for WGL, EGLContext for EGL).
virtual void *nativeContext() const = 0;
// These should be implemented only for some winsys interfaces, for example EGL.
// For others, like WGL, they are not relevant.
virtual void *nativeDisplay() const { return 0; }
virtual void *nativeDisplay() const { return nullptr; }
virtual void *nativeConfig() const { return 0; }
protected:

View File

@ -83,7 +83,7 @@ static GpuDescription adapterIdentifierToGpuDescription(const D3DADAPTER_IDENTIF
class QDirect3D9Handle
{
public:
Q_DISABLE_COPY(QDirect3D9Handle)
Q_DISABLE_COPY_MOVE(QDirect3D9Handle)
QDirect3D9Handle();
~QDirect3D9Handle();

View File

@ -480,7 +480,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
<< " message=" << Qt::hex << msg.message
<< " count=" << Qt::dec << count;
Qt::TouchPointStates allStates = 0;
Qt::TouchPointStates allStates = nullptr;
for (quint32 i = 0; i < count; ++i) {
if (QWindowsContext::verbose > 1)

View File

@ -55,7 +55,7 @@ class QTouchDevice;
class QWindowsPointerHandler
{
Q_DISABLE_COPY(QWindowsPointerHandler)
Q_DISABLE_COPY_MOVE(QWindowsPointerHandler)
public:
QWindowsPointerHandler() = default;
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);

View File

@ -79,7 +79,7 @@ private:
bool m_blockUserInput = false;
bool m_canceled = false;
Q_DISABLE_COPY(QWindowsSessionManager)
Q_DISABLE_COPY_MOVE(QWindowsSessionManager)
};
QT_END_NAMESPACE

View File

@ -110,7 +110,7 @@ QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
class QWindowsTabletSupport
{
Q_DISABLE_COPY(QWindowsTabletSupport)
Q_DISABLE_COPY_MOVE(QWindowsTabletSupport)
explicit QWindowsTabletSupport(HWND window, HCTX context);

View File

@ -51,7 +51,7 @@ class QWindow;
class QWindowsTheme : public QPlatformTheme
{
Q_DISABLE_COPY(QWindowsTheme)
Q_DISABLE_COPY_MOVE(QWindowsTheme)
public:
QWindowsTheme();
~QWindowsTheme() override;
@ -71,7 +71,7 @@ public:
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const override;
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = nullptr) const override;
void windowsThemeChanged(QWindow *window);
void displayChanged() { refreshIconPixmapSizes(); }

View File

@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
*/
class QWindowsThreadPoolRunner
{
Q_DISABLE_COPY(QWindowsThreadPoolRunner)
Q_DISABLE_COPY_MOVE(QWindowsThreadPoolRunner)
#if QT_CONFIG(thread)
template <class RunnableFunction> // nested class implementing QRunnable to execute a function.

View File

@ -81,7 +81,7 @@ bool QWindowsVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice,
VkSurfaceKHR QWindowsVulkanInstance::createSurface(HWND win)
{
VkSurfaceKHR surface = 0;
VkSurfaceKHR surface = VK_NULL_HANDLE;
if (!m_createSurface) {
m_createSurface = reinterpret_cast<PFN_vkCreateWin32SurfaceKHR>(

View File

@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QWindowsVulkanInstance : public QBasicPlatformVulkanInstance
{
Q_DISABLE_COPY(QWindowsVulkanInstance)
Q_DISABLE_COPY_MOVE(QWindowsVulkanInstance)
public:
QWindowsVulkanInstance(QVulkanInstance *instance);

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