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

bb10
Alexandru Croitor 2019-06-06 15:35:06 +02:00
commit 6e42979518
556 changed files with 15079 additions and 10640 deletions

View File

@ -122,6 +122,7 @@ Build options:
-qtnamespace <name> .. Wrap all Qt library code in 'namespace <name> {...}'.
-qtlibinfix <infix> .. Rename all libQt5*.so to libQt5*<infix>.so.
-qtlibinfix-plugins .. Rename Qt plugins according to -qtlibinfix [no]
-testcocoon .......... Instrument with the TestCocoon code coverage tool [no]
-gcov ................ Instrument with the GCov code coverage tool [no]

View File

@ -110,6 +110,7 @@
"profile": "boolean",
"qreal": "string",
"qtlibinfix": { "type": "string", "name": "qt_libinfix" },
"qtlibinfix-plugins": { "type": "boolean", "name": "qt_libinfix_plugins" },
"qtnamespace": { "type": "string", "name": "qt_namespace" },
"reduce-exports": { "type": "boolean", "name": "reduce_exports" },
"reduce-relocations": { "type": "boolean", "name": "reduce_relocations" },
@ -638,7 +639,7 @@
"shared": {
"label": "Building shared libraries",
"autoDetect": "!config.uikit",
"condition": "!config.integrity && !config.wasm",
"condition": "!config.integrity && !config.wasm && !config.rtems",
"output": [
"shared",
"publicFeature",
@ -691,7 +692,7 @@
"autoDetect": "false",
"enable" : "input.linker == 'gold' || features.use_gold_linker_alias" ,
"disable" : "input.linker == 'bfd' || input.linker == 'lld'",
"condition": "!config.win32 && !config.integrity && !config.wasm && tests.use_gold_linker",
"condition": "!config.win32 && !config.integrity && !config.wasm && !config.rtems && tests.use_gold_linker",
"output": [ "privateConfig", "useGoldLinker" ]
},
"use_lld_linker": {
@ -824,7 +825,7 @@
},
"largefile": {
"label": "Large file support",
"condition": "!config.android && !config.integrity && !config.winrt",
"condition": "!config.android && !config.integrity && !config.winrt && !config.rtems",
"output": [
"privateConfig",
{ "type": "define", "name": "QT_LARGEFILE_SUPPORT", "value": 64 }
@ -1301,6 +1302,12 @@
"condition": "libs.libudev",
"output": [ "privateFeature" ]
},
"qt_libinfix_plugins": {
"label": "Use QT_LIBINFIX for Plugins",
"autoDetect": false,
"enable": "input.qt_libinfix != '' && input.qt_libinfix_plugins == 'yes'",
"output": [ "privateConfig" ]
},
"compile_examples": {
"label": "Compile examples",
"autoDetect": "!config.wasm",

View File

@ -71,6 +71,16 @@
\title CMake AUTOMOC Documentation
*/
/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autorcc
\title CMake AUTORCC Documentation
*/
/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autouic
\title CMake AUTOUIC Documentation
*/
/*!
\externalpage https://cmake.org/cmake/help/latest/prop_tgt/LOCATION.html
\title CMake LOCATION Documentation

View File

@ -0,0 +1,52 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//! [using qt module]
\section1 Using the Module
Using a Qt module requires linking against the module library, either
directly or through other dependencies. Several build tools have dedicated
support for this, including \l{CMake Documentation}{CMake} and
\l{qmake}.
\section2 Building with CMake
Use the \c{find_package()} command to locate the needed module components in
the \c{Qt5} package:
//! [using qt module]
//! [building with qmake]
\section2 Building with qmake
To configure the module for building with qmake, add the module as a value
of the \c QT variable in the project's .pro file:
//! [building with qmake]

View File

@ -18,6 +18,8 @@ HTML.extraimages += template/images/ico_out.png \
template/images/bullet_sq.png \
template/images/bgrContent.png
sourcedirs += includes
#specify which files in the output directory should be packed into the qch file.
qhp.extraFiles += style/offline.css \
images/ico_out.png \

View File

@ -9,4 +9,5 @@ defines += onlinedocs
#uncomment if navigation bar is not wanted
#HTML.nonavigationbar = "true"
sourcedirs += includes-online
sourcedirs += includes-online \
includes

View File

@ -255,11 +255,7 @@ public:
protected:
void resizeEvent(QResizeEvent*) {
#if defined(Q_OS_WINCE_WM)
touchDevice = true;
#else
touchDevice = false;
#endif
if (touchDevice) {
if (width() < height()) {
trackPad = QRect(0, height() / 2, width(), height() / 2);

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

@ -123,11 +123,11 @@ void RateController::transfer()
qint64 writeChunk = qMax<qint64>(1, bytesToWrite / pendingSockets.size());
qint64 readChunk = qMax<qint64>(1, bytesToRead / pendingSockets.size());
QSetIterator<PeerWireClient *> it(pendingSockets);
while (it.hasNext() && (bytesToWrite > 0 || bytesToRead > 0)) {
PeerWireClient *socket = it.next();
for (auto it = pendingSockets.begin(), end = pendingSockets.end(); it != end && (bytesToWrite > 0 || bytesToRead > 0); /*erasing*/) {
auto current = it++;
PeerWireClient *socket = *current;
if (socket->state() != QAbstractSocket::ConnectedState) {
pendingSockets.remove(socket);
pendingSockets.erase(current);
continue;
}
@ -156,7 +156,7 @@ void RateController::transfer()
if (dataTransferred && socket->canTransferMore())
canTransferMore = true;
else
pendingSockets.remove(socket);
pendingSockets.erase(current);
}
} while (canTransferMore && (bytesToWrite > 0 || bytesToRead > 0) && !pendingSockets.isEmpty());

View File

@ -720,9 +720,9 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
qint64 now = QDateTime::currentSecsSinceEpoch();
QList<TorrentPeer *> freePeers;
QMap<QString, int> connectionsPerPeer;
for (TorrentPeer *peer : d->peers) {
for (TorrentPeer *peer : qAsConst(d->peers)) {
bool busy = false;
for (PeerWireClient *client : d->connections) {
for (PeerWireClient *client : qAsConst(d->connections)) {
if (client->state() == PeerWireClient::ConnectedState
&& client->peerAddress() == peer->address
&& client->peerPort() == peer->port) {
@ -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()));
@ -1084,25 +1086,25 @@ void TorrentClient::scheduleUploads()
// seeding, we sort by upload speed. Seeds are left out; there's
// no use in unchoking them.
QList<PeerWireClient *> allClients = d->connections;
QMultiMap<int, PeerWireClient *> transferSpeeds;
QVector<QPair<qint64, PeerWireClient *>> transferSpeeds;
for (PeerWireClient *client : qAsConst(allClients)) {
if (client->state() == QAbstractSocket::ConnectedState
&& client->availablePieces().count(true) != d->pieceCount) {
if (d->state == Seeding) {
transferSpeeds.insert(client->uploadSpeed(), client);
transferSpeeds.push_back({client->uploadSpeed(), client});
} else {
transferSpeeds.insert(client->downloadSpeed(), client);
transferSpeeds.push_back({client->downloadSpeed(), client});
}
}
}
std::sort(transferSpeeds.begin(), transferSpeeds.end());
// Unchoke the top 'MaxUploads' downloaders (peers that we are
// uploading to) and choke all others.
int maxUploaders = MaxUploads;
QMapIterator<int, PeerWireClient *> it(transferSpeeds);
it.toBack();
while (it.hasPrevious()) {
PeerWireClient *client = it.previous().value();
for (auto rit = transferSpeeds.crbegin(), rend = transferSpeeds.crend(); rit != rend; ++rit) {
PeerWireClient *client = rit->second;
bool interested = (client->peerWireState() & PeerWireClient::PeerIsInterested);
if (maxUploaders) {
@ -1484,30 +1486,26 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
// of the peers that have no (or low) activity.
int maxPeers = ConnectionManager::instance()->maxConnections() * 3;
if (d->peers.size() > maxPeers) {
auto tooMany = d->peers.size() - maxPeers;
// Find what peers are currently connected & active
QSet<TorrentPeer *> activePeers;
for (TorrentPeer *peer : qAsConst(d->peers)) {
const auto firstNInactivePeers = [&tooMany, this] (TorrentPeer *peer) {
if (!tooMany)
return false;
for (const PeerWireClient *client : qAsConst(d->connections)) {
if (client->peer() == peer && (client->downloadSpeed() + client->uploadSpeed()) > 1024)
activePeers << peer;
return false;
}
}
--tooMany;
return true;
};
// Remove inactive peers from the peer list until we're below
// the max connections count.
QList<int> toRemove;
for (int i = 0; i < d->peers.size() && (d->peers.size() - toRemove.size()) > maxPeers; ++i) {
if (!activePeers.contains(d->peers.at(i)))
toRemove << i;
}
QListIterator<int> toRemoveIterator(toRemove);
toRemoveIterator.toBack();
while (toRemoveIterator.hasPrevious())
d->peers.removeAt(toRemoveIterator.previous());
d->peers.erase(std::remove_if(d->peers.begin(), d->peers.end(),
firstNInactivePeers),
d->peers.end());
// If we still have too many peers, remove the oldest ones.
while (d->peers.size() > maxPeers)
d->peers.takeFirst();
d->peers.erase(d->peers.begin(), d->peers.begin() + tooMany);
}
if (d->state != Paused && d->state != Stopping && d->state != Idle) {

View File

@ -69,11 +69,11 @@ int main(int argc, char *argv[])
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
// Request OpenGL 3.3 compatibility or OpenGL ES 3.0.
// Request OpenGL 3.3 core or OpenGL ES 3.0.
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
qDebug("Requesting 3.3 compatibility context");
qDebug("Requesting 3.3 core context");
fmt.setVersion(3, 3);
fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
fmt.setProfile(QSurfaceFormat::CoreProfile);
} else {
qDebug("Requesting 3.0 context");
fmt.setVersion(3, 0);

View File

@ -247,12 +247,8 @@ void GLWidget::createBubbles(int number)
//! [13]
void GLWidget::animate()
{
QMutableListIterator<Bubble*> iter(bubbles);
while (iter.hasNext()) {
Bubble *bubble = iter.next();
for (Bubble *bubble : qAsConst(bubbles))
bubble->move(rect());
}
update();
}
//! [13]

View File

@ -399,12 +399,9 @@ void GLWidget::paintGL()
painter.end();
QMutableListIterator<Bubble*> iter(m_bubbles);
while (iter.hasNext()) {
Bubble *bubble = iter.next();
for (Bubble *bubble : qAsConst(m_bubbles))
bubble->move(rect());
}
if (!(m_frames % 100)) {
m_time.start();
m_frames = 0;

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

@ -126,11 +126,8 @@ WordCount countWords(const QString &file)
// at a time.
void reduce(WordCount &result, const WordCount &w)
{
QMapIterator<QString, int> i(w);
while (i.hasNext()) {
i.next();
for (auto i = w.begin(), end = w.end(); i != end; ++i)
result[i.key()] += i.value();
}
}
int main(int argc, char** argv)

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

@ -287,7 +287,6 @@ Dialog::Dialog(QWidget *parent)
fileDialogOptionsWidget->addCheckBox(tr("Show directories only"), QFileDialog::ShowDirsOnly);
fileDialogOptionsWidget->addCheckBox(tr("Do not resolve symlinks"), QFileDialog::DontResolveSymlinks);
fileDialogOptionsWidget->addCheckBox(tr("Do not confirm overwrite"), QFileDialog::DontConfirmOverwrite);
fileDialogOptionsWidget->addCheckBox(tr("Do not use sheet"), QFileDialog::DontUseSheet);
fileDialogOptionsWidget->addCheckBox(tr("Readonly"), QFileDialog::ReadOnly);
fileDialogOptionsWidget->addCheckBox(tr("Hide name filter details"), QFileDialog::HideNameFilterDetails);
fileDialogOptionsWidget->addCheckBox(tr("Do not use custom directory icons (Windows)"), QFileDialog::DontUseCustomDirectoryIcons);

View File

@ -262,12 +262,7 @@
provides arrays allowing to map from enumeration value to row/column
(by using QVector::indexOf()) and back by using the array index and lists
of the matching strings. Qt's containers can be easily populated by
using C++ 11 initializer lists. If the compiler does not provide that feature,
a pattern like
\snippet widgets/icons/iconpreviewarea.cpp 43
can be used.
using C++ 11 initializer lists.
We need two public functions to set the current icon and the
icon's size. In addition the class has three private functions: We

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

@ -56,13 +56,13 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QScopedPointer<QStyle> arthurStyle(new ArthurStyle());
CompositionWidget compWidget(nullptr);
QStyle *arthurStyle = new ArthurStyle();
compWidget.setStyle(arthurStyle);
compWidget.setStyle(arthurStyle.data());
const QList<QWidget *> widgets = compWidget.findChildren<QWidget *>();
for (QWidget *w : widgets)
w->setStyle(arthurStyle);
w->setStyle(arthurStyle.data());
compWidget.show();
return app.exec();

View File

@ -72,7 +72,7 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
setPalette(pal);
} else {
setAttribute(Qt::WA_NoBackground);
setAttribute(Qt::WA_OpaquePaintEvent);
}
QPolygonF points;

View File

@ -163,11 +163,8 @@ QStringList LanguageChooser::findQmFiles()
QDir dir(":/translations");
QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files,
QDir::Name);
QMutableStringListIterator i(fileNames);
while (i.hasNext()) {
i.next();
i.setValue(dir.filePath(i.value()));
}
for (QString &fileName : fileNames)
fileName = dir.filePath(fileName);
return fileNames;
}

View File

@ -59,7 +59,7 @@ PaintArea::PaintArea(QWidget *parent) :
QWidget(parent)
{
setAttribute(Qt::WA_StaticContents);
setAttribute(Qt::WA_NoBackground);
setAttribute(Qt::WA_OpaquePaintEvent);
theImage.fill(qRgb(255, 255, 255));
}

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

@ -69,6 +69,7 @@ QMAKE_LIBDIR_OPENGL =
QMAKE_LINK_SHLIB = $$QMAKE_LINK
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
equals(ANDROID_TARGET_ARCH, x86_64) QMAKE_LFLAGS += -L$$ANDROID_PLATFORM_ROOT_PATH/usr/lib64
QMAKE_LFLAGS_APP = -Wl,--no-undefined -Wl,-z,noexecstack -shared
QMAKE_LFLAGS_SHLIB = -Wl,--no-undefined -Wl,-z,noexecstack -shared
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB

View File

@ -211,10 +211,10 @@ CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";")
mac {
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.a
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.prl
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else {
qt_framework {
@ -222,7 +222,7 @@ mac {
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}
CMAKE_BUILD_IS_FRAMEWORK = "true"
} else {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.$$eval(QT.$${MODULE}.VERSION).dylib
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib
}
}

View File

@ -120,6 +120,7 @@ breakpad {
}
c++17: CONFIG += c++1z
c++latest: CONFIG *= c++2a c++1z c++14 c++11
!c++11:!c++14:!c++1z:!c++2a {
# Qt requires C++11 since 5.7, check if we need to force a compiler option

View File

@ -50,10 +50,7 @@ builtin_resources {
# Install rules
qmldir.base = $$qmldir_path
# Tools need qmldir and plugins.qmltypes always installed on the file system
qmldir.files = $$qmldir_file
install_qml_files: qmldir.files += $$fq_qml_files
qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
INSTALLS += qmldir
@ -65,12 +62,12 @@ INSTALLS += qmlfiles
!debug_and_release|!build_all|CONFIG(release, debug|release) {
!prefix_build {
COPIES += qmldir
COPIES += qmldir qmlfiles
} else {
# For non-installed static builds, tools need qmldir and plugins.qmltypes
# files in the build dir
qmldir2build.files = $$qmldir_file $$fq_aux_qml_files
qmldir2build.path = $$DESTDIR
COPIES += qmldir2build
qml2build.files = $$qmldir_file $$fq_aux_qml_files
qml2build.path = $$DESTDIR
COPIES += qml2build
}
}

View File

@ -264,7 +264,7 @@ load(qt_installs)
load(qt_targets)
# this builds on top of qt_common
!internal_module:if(unix|mingw) {
!internal_module:if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) {
CONFIG += create_pc
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
host_build: \
@ -277,11 +277,13 @@ load(qt_targets)
} else {
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw]
QMAKE_PKGCONFIG_CFLAGS = -D$$MODULE_DEFINE -I${includedir}/$$MODULE_INCNAME
for(inc, MODULE_AUX_INCLUDES): \
QMAKE_PKGCONFIG_CFLAGS += -I${includedir}/$$section(inc, /, 1, 1)
}
QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, "Qt$$QT_MAJOR_VERSION ")
QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)
QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)$$qtPlatformTargetSuffix()
for(i, MODULE_DEPENDS): \
QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))
QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))$$qtPlatformTargetSuffix()
isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \
QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module
pclib_replace.match = $$lib_replace.match

View File

@ -91,6 +91,7 @@ CONFIG(static, static|shared)|prefix_build {
target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
INSTALLS += target
qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX
TARGET = $$qt5LibraryTarget($$TARGET)
CONFIG += create_cmake

View File

@ -67,7 +67,7 @@ contains(TEMPLATE, .*app) {
# replacing the app name placeholder with the actual app name.
apphtml.name = application main html file
apphtml.output = $$DESTDIR/$$TARGET_HTML
apphtml.commands = sed -e s/APPNAME/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML
apphtml.commands = sed -e s/@APPNAME@/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML
apphtml.input = $$WASM_PLUGIN_PATH/wasm_shell.html
apphtml.depends = $$apphtml.input
QMAKE_EXTRA_COMPILERS += apphtml

View File

@ -28,9 +28,9 @@ QOBJS = \
qmetatype.o qsystemerror.o qvariant.o \
quuid.o \
qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \
qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.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).
@ -112,7 +112,6 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qhash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \
@ -120,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 \
@ -343,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) $<
@ -442,9 +437,6 @@ qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp
qhash.o: $(SOURCE_PATH)/src/corelib/tools/qhash.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qcryptographichash.o: $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<

View File

@ -88,7 +88,6 @@ QTOBJS= \
qringbuffer.obj \
qdebug.obj \
qlist.obj \
qlinkedlist.obj \
qlocale.obj \
qlocale_tools.obj \
qlocale_win.obj \
@ -100,7 +99,6 @@ QTOBJS= \
qregexp.obj \
qutfcodec.obj \
qstring.obj \
qstring_compat.obj \
qstringlist.obj \
qstringbuilder.obj \
qsystemerror.obj \
@ -201,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

@ -974,6 +974,12 @@
the compiler does not support C++17, or can't select the C++ standard.
By default, support is disabled.
\row \li c++17 \li Same as c++1z.
\row \li c++2a \li C++2a support is enabled. This option has no effect if
the compiler does not support C++2a, or can't select the C++ standard.
By default, support is disabled.
\row \li c++latest \li Support for the latest C++ language standard is
enabled that is supported by the compiler. By default, this option is
disabled.
\row \li strict_c++ \li Disables support for C++ compiler extensions.
By default, they are enabled.
\row \li depend_includepath \li Appending the value of INCLUDEPATH to
@ -1148,8 +1154,9 @@
\target DEPENDPATH
\section1 DEPENDPATH
Specifies a list of all directories to look in to resolve dependencies. This
variable is used when crawling through \c included files.
Specifies a list of directories for qmake to scan, to resolve dependencies.
This variable is used when qmake crawls through the header files that you
\c{#include} in your source code.
\target DESTDIR
\section1 DESTDIR
@ -1160,6 +1167,10 @@
\snippet code/doc_src_qmake-manual.pro 30
\note The list of supported characters can depend on
the used build tool. In particular, parentheses do not
work with \c{make}.
\target DISTFILES
\section1 DISTFILES

View File

@ -60,11 +60,6 @@ static QString qtSha1(const QByteArray &src)
return QString::fromLatin1(digest.toHex());
}
ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator() : UnixMakefileGenerator()
{
}
bool
ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t)
{
@ -1236,9 +1231,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
<< "\t\t};\n";
QMapIterator<ProString, ProStringList> it(embedded_plugins);
while (it.hasNext()) {
it.next();
for (auto it = embedded_plugins.cbegin(), end = embedded_plugins.cend(); it != end; ++it) {
QString suffix = !it.key().isEmpty() ? (" (" + it.key() + ")") : QString();
QString grp3("Embed PlugIns" + suffix), key3 = keyFor(grp3);
project->values("QMAKE_PBX_BUILDPHASES").append(key3);

View File

@ -61,19 +61,12 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator
QString writeSettings(const QString &var, const ProStringList &vals, int flags=0, int indent_level=0);
public:
ProjectBuilderMakefileGenerator();
~ProjectBuilderMakefileGenerator();
bool supportsMetaBuild() override { return false; }
bool openOutput(QFile &, const QString &) const override;
protected:
bool doPrecompiledHeaders() const override { return false; }
bool doDepends() const override { return writingUnixMakefileGenerator && UnixMakefileGenerator::doDepends(); }
};
inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator()
{ }
QT_END_NAMESPACE
#endif // PBUILDER_PBX_H

View File

@ -94,13 +94,6 @@ bool MakefileGenerator::mkdir(const QString &in_path) const
return QDir().mkpath(path);
}
// ** base makefile generator
MakefileGenerator::MakefileGenerator() :
no_io(false), project(nullptr)
{
}
void
MakefileGenerator::verifyCompilers()
{
@ -1053,9 +1046,9 @@ MakefileGenerator::writeProjectMakefile()
//install
t << "install: ";
for(it = targets.begin(); it != targets.end(); ++it)
t << (*it)->target << "-install ";
t << Qt::endl;
for (SubTarget *s : qAsConst(targets))
t << s->target << '-';
t << "install " << Qt::endl;
//uninstall
t << "uninstall: ";
@ -1301,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") &&
@ -1323,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))));
@ -1338,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") &&
@ -1869,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)
{
@ -1998,47 +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)) {
QString indeps;
while(!feof(proc)) {
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QT_PCLOSE(proc);
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(); ) {
@ -2086,47 +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)) {
QString indeps;
while(!feof(proc)) {
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QT_PCLOSE(proc);
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) {
@ -2511,6 +2475,16 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
}
static void chopEndLines(QString *s)
{
while (!s->isEmpty()) {
const ushort c = s->at(s->size() - 1).unicode();
if (c != '\n' && c != '\r')
break;
s->chop(1);
}
}
void
MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags)
{
@ -2536,6 +2510,14 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
<< QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall");
}
struct SequentialInstallData
{
QString targetPrefix;
QString commands;
QTextStream commandsStream;
SequentialInstallData() : commandsStream(&commands) {}
};
std::unique_ptr<SequentialInstallData> sequentialInstallData;
bool dont_recurse = project->isActiveConfig("dont_recurse");
// generate target rules
@ -2604,6 +2586,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
else if(s == "make_first")
s = QString();
if (project->isActiveConfig("build_all") && s == "install") {
if (!sequentialInstallData)
sequentialInstallData.reset(new SequentialInstallData);
sequentialInstallData->targetPrefix += subtarget->target + '-';
writeSubTargetCall(sequentialInstallData->commandsStream, in_directory, in,
out_directory, out, out_directory_cdin,
makefilein + " " + s);
chopEndLines(&sequentialInstallData->commands);
}
if(flags & SubTargetOrdered) {
t << subtarget->target << "-" << targetSuffixes.at(suffix) << "-ordered:";
if(target)
@ -2623,6 +2615,11 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
}
t << Qt::endl;
if (sequentialInstallData) {
t << sequentialInstallData->targetPrefix << "install: FORCE"
<< sequentialInstallData->commands << Qt::endl << Qt::endl;
}
if (!(flags & SubTargetSkipDefaultTargets)) {
writeMakeQmake(t, true);

View File

@ -54,7 +54,7 @@ struct ReplaceExtraCompilerCacheKey;
class MakefileGenerator : protected QMakeSourceFileInfo
{
QString spec;
bool no_io;
bool no_io = false;
bool resolveDependenciesInFrameworks = false;
QHash<QString, bool> init_compiler_already;
QString makedir, chkexists;
@ -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);
@ -131,7 +134,7 @@ protected:
QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool) override;
QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &) override;
QFileInfo findFileInfo(const QMakeLocalFileName &) override;
QMakeProject *project;
QMakeProject *project = nullptr;
//escape
virtual QString escapeFilePath(const QString &path) const = 0;
@ -256,8 +259,6 @@ protected:
const QString &fixedFile);
public:
MakefileGenerator();
~MakefileGenerator();
QMakeProject *projectFile() const;
void setProjectFile(QMakeProject *p);
@ -295,9 +296,6 @@ inline QString MakefileGenerator::installRoot() const
inline bool MakefileGenerator::findLibraries(bool, bool)
{ return true; }
inline MakefileGenerator::~MakefileGenerator()
{ }
struct ReplaceExtraCompilerCacheKey
{
mutable uint hash;

View File

@ -837,7 +837,9 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
if(inc) {
if(!includes)
includes = new SourceFiles;
SourceFile *dep = includes->lookupFile(inc);
/* QTBUG-72383: Local includes "foo.h" must first be resolved relative to the
* sourceDir, only global includes <bar.h> are unique. */
SourceFile *dep = try_local ? nullptr : includes->lookupFile(inc);
if(!dep) {
bool exists = false;
QMakeLocalFileName lfn(inc);
@ -876,7 +878,11 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
dep->file = lfn;
dep->type = QMakeSourceFileInfo::TYPE_C;
files->addFile(dep);
includes->addFile(dep, inc, false);
/* QTBUG-72383: Local includes "foo.h" are keyed by the resolved
* path (stored in dep itself), only global includes <bar.h> are
* unique keys immediately. */
const char *key = try_local ? nullptr : inc;
includes->addFile(dep, key, false);
}
dep->exists = exists;
}

View File

@ -50,10 +50,6 @@ QString project_builtin_regx() //calculate the builtin regular expression..
return ret;
}
ProjectGenerator::ProjectGenerator() : MakefileGenerator()
{
}
void
ProjectGenerator::init()
{

View File

@ -46,15 +46,10 @@ protected:
QString escapeFilePath(const QString &path) const override { Q_ASSERT(false); return QString(); }
public:
ProjectGenerator();
~ProjectGenerator();
bool supportsMetaBuild() override { return false; }
bool openOutput(QFile &, const QString &) const override;
};
inline ProjectGenerator::~ProjectGenerator()
{ }
QT_END_NAMESPACE
#endif // PROJECTGENERATOR_H

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

@ -35,15 +35,11 @@ QT_BEGIN_NAMESPACE
class UnixMakefileGenerator : public MakefileGenerator
{
bool include_deps;
bool include_deps = false;
QString libtoolFileName(bool fixify=true);
void writeLibtoolFile(); // for libtool
void writePrlFile(QTextStream &) override;
public:
UnixMakefileGenerator();
~UnixMakefileGenerator();
protected:
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
@ -69,9 +65,6 @@ private:
ProStringList libdirToFlags(const ProKey &key);
};
inline UnixMakefileGenerator::~UnixMakefileGenerator()
{ }
QT_END_NAMESPACE
#endif // UNIXMAKE_H

View File

@ -39,11 +39,6 @@
QT_BEGIN_NAMESPACE
UnixMakefileGenerator::UnixMakefileGenerator() : MakefileGenerator(), include_deps(false)
{
}
void
UnixMakefileGenerator::writePrlFile(QTextStream &t)
{

View File

@ -38,10 +38,6 @@
QT_BEGIN_NAMESPACE
MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator()
{
}
QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const
{
QString ret = path;

View File

@ -35,9 +35,6 @@ QT_BEGIN_NAMESPACE
class MingwMakefileGenerator : public Win32MakefileGenerator
{
public:
MingwMakefileGenerator();
~MingwMakefileGenerator();
protected:
using MakefileGenerator::escapeDependencyPath;
QString escapeDependencyPath(const QString &path) const override;
@ -65,9 +62,6 @@ private:
QString objectsLinkLine;
};
inline MingwMakefileGenerator::~MingwMakefileGenerator()
{ }
QT_END_NAMESPACE
#endif // MINGW_MAKE_H

View File

@ -38,11 +38,6 @@
QT_BEGIN_NAMESPACE
NmakeMakefileGenerator::NmakeMakefileGenerator() : usePCH(false), usePCHC(false)
{
}
bool
NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{

View File

@ -54,17 +54,10 @@ protected:
QString var(const ProKey &value) const override;
QString precompH, precompObj, precompPch;
QString precompObjC, precompPchC;
bool usePCH, usePCHC;
public:
NmakeMakefileGenerator();
~NmakeMakefileGenerator();
bool usePCH = false;
bool usePCHC = false;
};
inline NmakeMakefileGenerator::~NmakeMakefileGenerator()
{ }
QT_END_NAMESPACE
#endif // MSVC_NMAKE_H

View File

@ -40,10 +40,6 @@
QT_BEGIN_NAMESPACE
Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator()
{
}
ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
{
if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
@ -537,29 +533,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
writeIncPart(t);
writeLibsPart(t);
t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC"))
<< Qt::endl;
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL"))
<< Qt::endl;
t << "ZIP = " << var("QMAKE_ZIP") << Qt::endl;
t << "DEF_FILE = " << fileVar("DEF_FILE") << Qt::endl;
t << "RES_FILE = " << fileVar("RES_FILE") << Qt::endl; // Not on mingw, can't see why not though...
t << "COPY = " << var("QMAKE_COPY") << Qt::endl;
t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl;
t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << Qt::endl;
t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << Qt::endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << Qt::endl;
t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl;
t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << Qt::endl;
t << "MKDIR = " << var("QMAKE_MKDIR") << Qt::endl;
t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << Qt::endl;
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << Qt::endl;
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << Qt::endl;
t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << Qt::endl;
t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << Qt::endl;
writeDefaultVariables(t);
t << Qt::endl;
t << "####### Output directory\n\n";
@ -789,6 +763,20 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
return ret;
}
void Win32MakefileGenerator::writeDefaultVariables(QTextStream &t)
{
MakefileGenerator::writeDefaultVariables(t);
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC"))
<< Qt::endl;
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL"))
<< Qt::endl;
t << "ZIP = " << var("QMAKE_ZIP") << Qt::endl;
t << "DEF_FILE = " << fileVar("DEF_FILE") << Qt::endl;
t << "RES_FILE = " << fileVar("RES_FILE") << Qt::endl; // Not on mingw, can't see why not though...
t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl;
t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl;
}
QString Win32MakefileGenerator::escapeFilePath(const QString &path) const
{
QString ret = path;

View File

@ -35,11 +35,9 @@ QT_BEGIN_NAMESPACE
class Win32MakefileGenerator : public MakefileGenerator
{
public:
Win32MakefileGenerator();
~Win32MakefileGenerator();
protected:
QString defaultInstall(const QString &) override;
void writeDefaultVariables(QTextStream &t) override;
virtual void writeCleanParts(QTextStream &t);
virtual void writeStandardParts(QTextStream &t);
virtual void writeIncPart(QTextStream &t);
@ -68,9 +66,6 @@ protected:
virtual QString getManifestFileForRcFile() const;
};
inline Win32MakefileGenerator::~Win32MakefileGenerator()
{ }
QT_END_NAMESPACE
#endif // WINMAKEFILE_H

View File

@ -1457,15 +1457,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
case T_EXPORT: {
const ProKey &var = map(args.at(0));
for (ProValueMapStack::Iterator vmi = m_valuemapStack.end();
for (ProValueMapStack::iterator vmi = m_valuemapStack.end();
--vmi != m_valuemapStack.begin(); ) {
ProValueMap::Iterator it = (*vmi).find(var);
if (it != (*vmi).end()) {
if (it->constBegin() == statics.fakeValue.constBegin()) {
// This is stupid, but qmake doesn't propagate deletions
m_valuemapStack.first()[var] = ProStringList();
m_valuemapStack.front()[var] = ProStringList();
} else {
m_valuemapStack.first()[var] = *it;
m_valuemapStack.front()[var] = *it;
}
(*vmi).erase(it);
while (--vmi != m_valuemapStack.begin())
@ -1476,7 +1476,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnTrue;
}
case T_DISCARD_FROM: {
if (m_valuemapStack.count() != 1) {
if (m_valuemapStack.size() != 1) {
evalError(fL1S("discard_from() cannot be called from functions."));
return ReturnFalse;
}
@ -1486,7 +1486,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly);
if (!pro)
return ReturnFalse;
ProValueMap &vmap = m_valuemapStack.first();
ProValueMap &vmap = m_valuemapStack.front();
for (auto vit = vmap.begin(); vit != vmap.end(); ) {
if (!vit->isEmpty()) {
auto isFrom = [pro](const ProString &s) {
@ -1514,7 +1514,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
else
++fit;
}
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
int idx = iif.indexOf(ProString(fn));
if (idx >= 0)
iif.removeAt(idx);

View File

@ -601,14 +601,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
case TokBypassNesting:
blockLen = getBlockLen(tokPtr);
if ((m_cumulative || okey != or_op) && blockLen) {
ProValueMapStack savedValuemapStack = m_valuemapStack;
ProValueMapStack savedValuemapStack = std::move(m_valuemapStack);
m_valuemapStack.clear();
m_valuemapStack.append(savedValuemapStack.takeFirst());
m_valuemapStack.splice(m_valuemapStack.end(),
savedValuemapStack, savedValuemapStack.begin());
traceMsg("visiting nesting-bypassing block");
ret = visitProBlock(tokPtr);
traceMsg("visited nesting-bypassing block");
savedValuemapStack.prepend(m_valuemapStack.first());
m_valuemapStack = savedValuemapStack;
savedValuemapStack.splice(savedValuemapStack.begin(),
m_valuemapStack, m_valuemapStack.begin());
m_valuemapStack = std::move(savedValuemapStack);
} else {
traceMsg("skipped nesting-bypassing block");
ret = ReturnTrue;
@ -1439,7 +1441,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
it != m_extraVars.constEnd(); ++it)
m_valuemapStack.first().insert(it.key(), it.value());
m_valuemapStack.front().insert(it.key(), it.value());
// In case default_pre needs to make decisions based on the current
// build pass configuration.
@ -1707,7 +1709,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
{
VisitReturn vr;
if (m_valuemapStack.count() >= 100) {
if (m_valuemapStack.size() >= 100) {
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
vr = ReturnFalse;
} else {
@ -1859,7 +1861,7 @@ static bool isFunctParam(const ProKey &variableName)
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
{
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
ProValueMapStack::iterator vmi = m_valuemapStack.end();
for (bool first = true; ; first = false) {
--vmi;
ProValueMap::Iterator it = (*vmi).find(variableName);
@ -1886,7 +1888,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
return *it;
}
if (!isFunctParam(variableName)) {
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
ProValueMapStack::iterator vmi = m_valuemapStack.end();
if (--vmi != m_valuemapStack.begin()) {
do {
--vmi;
@ -1905,7 +1907,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
{
ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd();
ProValueMapStack::const_iterator vmi = m_valuemapStack.cend();
for (bool first = true; ; first = false) {
--vmi;
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
@ -1914,7 +1916,7 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const
break;
return *it;
}
if (vmi == m_valuemapStack.constBegin())
if (vmi == m_valuemapStack.cbegin())
break;
if (first && isFunctParam(variableName))
break;
@ -1942,7 +1944,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
m_current = m_locationStack.pop();
pro->deref();
if (ok == ReturnTrue && !(flags & LoadHidden)) {
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
ProString ifn(fileName);
if (!iif.contains(ifn))
iif << ifn;
@ -2071,7 +2073,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
return ret;
*values = visitor.m_valuemapStack.top();
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
ProStringList &iif = m_valuemapStack.first()[qiif];
ProStringList &iif = m_valuemapStack.front()[qiif];
const auto ifns = values->value(qiif);
for (const ProString &ifn : ifns)
if (!iif.contains(ifn))

View File

@ -38,7 +38,6 @@
#include "ioutils.h"
#include <qlist.h>
#include <qlinkedlist.h>
#include <qmap.h>
#include <qset.h>
#include <qstack.h>
@ -54,6 +53,8 @@
# include <qmutex.h>
#endif
#include <list>
QT_BEGIN_NAMESPACE
class QMakeGlobals;
@ -94,15 +95,15 @@ public:
#endif
};
// We use a QLinkedList based stack instead of a QVector based one (QStack), so that
// We use a list-based stack instead of a vector-based one, so that
// the addresses of value maps stay constant. The qmake generators rely on that.
class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap>
class QMAKE_EXPORT ProValueMapStack : public std::list<ProValueMap>
{
public:
inline void push(const ProValueMap &t) { append(t); }
inline ProValueMap pop() { return takeLast(); }
ProValueMap &top() { return last(); }
const ProValueMap &top() const { return last(); }
inline void push(const ProValueMap &t) { push_back(t); }
inline ProValueMap pop() { auto r = std::move(back()); pop_back(); return r; }
ProValueMap &top() { return back(); }
const ProValueMap &top() const { return back(); }
};
namespace QMakeInternal { struct QMakeBuiltin; }

View File

@ -143,15 +143,15 @@ ProString QMakeProject::expand(const QString &expr, const QString &where, int li
bool QMakeProject::isEmpty(const ProKey &v) const
{
ProValueMap::ConstIterator it = m_valuemapStack.first().constFind(v);
return it == m_valuemapStack.first().constEnd() || it->isEmpty();
ProValueMap::ConstIterator it = m_valuemapStack.front().constFind(v);
return it == m_valuemapStack.front().constEnd() || it->isEmpty();
}
void QMakeProject::dump() const
{
QStringList out;
for (ProValueMap::ConstIterator it = m_valuemapStack.first().begin();
it != m_valuemapStack.first().end(); ++it) {
for (ProValueMap::ConstIterator it = m_valuemapStack.front().begin();
it != m_valuemapStack.front().end(); ++it) {
if (!it.key().startsWith('.')) {
QString str = it.key() + " =";
for (const ProString &v : it.value())

View File

@ -58,12 +58,12 @@ public:
{ m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; }
bool test(const ProKey &func, const QList<ProStringList> &args);
bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); }
bool isSet(const ProKey &v) const { return m_valuemapStack.front().contains(v); }
bool isEmpty(const ProKey &v) const;
ProStringList &values(const ProKey &v) { return valuesRef(v); }
int intValue(const ProKey &v, int defaultValue = 0) const;
const ProValueMap &variables() const { return m_valuemapStack.first(); }
ProValueMap &variables() { return m_valuemapStack.first(); }
const ProValueMap &variables() const { return m_valuemapStack.front(); }
ProValueMap &variables() { return m_valuemapStack.front(); }
bool isActiveConfig(const QString &config, bool regex = false)
{ return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); }

View File

@ -136,7 +136,6 @@ SOURCES += \
qjsonparser.cpp \
qjsonvalue.cpp \
qlibraryinfo.cpp \
qlinkedlist.cpp \
qlist.cpp \
qlocale.cpp \
qlocale_tools.cpp \
@ -148,7 +147,6 @@ SOURCES += \
qregexp.cpp \
qsettings.cpp \
qstring.cpp \
qstring_compat.cpp \
qstringlist.cpp \
qsystemerror.cpp \
qtemporaryfile.cpp \
@ -189,7 +187,6 @@ HEADERS += \
qjsonparser_p.h \
qjsonvalue.h \
qjsonwriter_p.h \
qlinkedlist.h \
qlist.h \
qlocale.h \
qlocale_tools_p.h \

View File

@ -49,6 +49,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown.
#include "PMurHash.h"
#include <stdint.h>
/* I used ugly type names in the header to avoid potential conflicts with
* application or system typedefs & defines. Since I'm not including any more
@ -208,7 +209,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le
/* This CPU does not handle unaligned word access */
/* Consume enough so that the next data byte is word aligned */
int i = -(long)ptr & 3;
int i = -(intptr_t)ptr & 3;
if(i && i <= len) {
DOBYTES(i, h1, c, n, ptr, len);
}

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

@ -0,0 +1,28 @@
From ac10063196685fe6124055feb1275e13a78f562e Mon Sep 17 00:00:00 2001
From: Mikhail Svetkin <mikhail.svetkin@qt.io>
Date: Tue, 20 Mar 2018 14:03:54 +0100
Subject: [PATCH] rtems: Fix pcre2 build (madvise undefined)
RTEMS does not have madvise. We can use only posix_madvise
Change-Id: Ia18b7cd2d7f9db84331f7e2350d060b9e85b30c8
---
src/3rdparty/pcre2/src/sljit/sljitUtils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/3rdparty/pcre2/src/sljit/sljitUtils.c b/src/3rdparty/pcre2/src/sljit/sljitUtils.c
index 5c2a838932..2ead044b1b 100644
--- a/src/3rdparty/pcre2/src/sljit/sljitUtils.c
+++ b/src/3rdparty/pcre2/src/sljit/sljitUtils.c
@@ -315,7 +315,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_st
aligned_new_start = (sljit_uw)new_start & ~sljit_page_align;
aligned_old_start = ((sljit_uw)stack->start) & ~sljit_page_align;
/* If madvise is available, we release the unnecessary space. */
-#if defined(MADV_DONTNEED)
+#if defined(MADV_DONTNEED) && !defined(__rtems__)
if (aligned_new_start > aligned_old_start)
madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, MADV_DONTNEED);
#elif defined(POSIX_MADV_DONTNEED)
--
2.21.0

View File

@ -315,7 +315,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_st
aligned_new_start = (sljit_uw)new_start & ~sljit_page_align;
aligned_old_start = ((sljit_uw)stack->start) & ~sljit_page_align;
/* If madvise is available, we release the unnecessary space. */
#if defined(MADV_DONTNEED)
#if defined(MADV_DONTNEED) && !defined(__rtems__)
if (aligned_new_start > aligned_old_start)
madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, MADV_DONTNEED);
#elif defined(POSIX_MADV_DONTNEED)

BIN
src/3rdparty/wasm/DejaVuSansMono.ttf vendored Normal file

Binary file not shown.

View File

@ -20,7 +20,7 @@
"Name": "DejaVu Fonts",
"QDocModule": "qtgui",
"QtUsage": "Used for WebAssembly platform.",
"Files": "DejaVuSans.ttf",
"Files": "DejaVuSans.ttf, DejaVuSansMono.ttf",
"Description": "The DejaVu fonts are a font family based on the Vera Fonts.",
"Homepage": "https://dejavu-fonts.github.io/",

View File

@ -41,6 +41,7 @@ package org.qtproject.qt5.android;
import android.content.Context;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@ -73,7 +74,7 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
m_buttonId = stringId;
setText(stringId);
setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
ViewGroup.LayoutParams.WRAP_CONTENT, 1));
setGravity(Gravity.CENTER);
setTextColor(getResources().getColor(R.color.widget_edittext_dark));
EditContextView.this.setBackground(getResources().getDrawable(R.drawable.editbox_background_normal));
@ -81,6 +82,8 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
int hPadding = (int)(16 * scale + 0.5f);
int vPadding = (int)(8 * scale + 0.5f);
setPadding(hPadding, vPadding, hPadding, vPadding);
setSingleLine();
setEllipsize(TextUtils.TruncateAt.END);
setOnClickListener(EditContextView.this);
}
}

View File

@ -0,0 +1,35 @@
From e7ff4aa4ef2221aa02d39bdead7f35008016994e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 26 Apr 2019 14:57:01 +0300
Subject: [PATCH] ANGLE: Backport fix for compilation on mingw/64bit with clang
This backports the following upstream fix from angle:
https://github.com/google/angle/commit/63cc351fbad06c6241d1c7372fe76f74e1d09a10
---
.../angle/src/common/third_party/smhasher/src/PMurHash.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
index 071bc31539..93b48713cd 100644
--- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
+++ b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
@@ -49,6 +49,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown.
#include "PMurHash.h"
+#include <stdint.h>
/* I used ugly type names in the header to avoid potential conflicts with
* application or system typedefs & defines. Since I'm not including any more
@@ -208,7 +209,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le
/* This CPU does not handle unaligned word access */
/* Consume enough so that the next data byte is word aligned */
- int i = -(long)ptr & 3;
+ int i = -(intptr_t)ptr & 3;
if(i && i <= len) {
DOBYTES(i, h1, c, n, ptr, len);
}
--
2.20.1 (Apple Git-117)

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

@ -399,7 +399,7 @@ static QBasicMutex registeredInterpolatorsMutex;
Registers a custom interpolator \a func for the template type \c{T}.
The interpolator has to be registered before the animation is constructed.
To unregister (and use the default interpolator) set \a func to 0.
To unregister (and use the default interpolator) set \a func to \nullptr.
*/
/*!
@ -416,7 +416,7 @@ static QBasicMutex registeredInterpolatorsMutex;
* \internal
* Registers a custom interpolator \a func for the specific \a interpolationType.
* The interpolator has to be registered before the animation is constructed.
* To unregister (and use the default interpolator) set \a func to 0.
* To unregister (and use the default interpolator) set \a func to \nullptr.
*/
void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator func, int interpolationType)
{

View File

@ -678,7 +678,7 @@ QList<int> QTextCodec::availableMibs()
\nonreentrant
Set the codec to \a c; this will be returned by
codecForLocale(). If \a c is a null pointer, the codec is reset to
codecForLocale(). If \a c is \nullptr, the codec is reset to
the default.
This might be needed for some applications that want to use their

View File

@ -851,7 +851,7 @@
"purpose": "Provides a general counting system semaphore.",
"section": "Kernel",
"condition": [
"!config.integrity && !config.vxworks",
"!config.integrity && !config.vxworks && !config.rtems",
"config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix"
],
"output": [ "publicFeature", "feature" ]
@ -893,14 +893,14 @@
"label": "QProcess",
"purpose": "Supports external process invocation.",
"section": "File I/O",
"condition": "features.processenvironment && !config.winrt && !config.uikit && !config.integrity && !config.vxworks",
"condition": "features.processenvironment && !config.winrt && !config.uikit && !config.integrity && !config.vxworks && !config.rtems",
"output": [ "publicFeature", "feature" ]
},
"processenvironment": {
"label": "QProcessEnvironment",
"purpose": "Provides a higher-level abstraction of environment variables.",
"section": "File I/O",
"condition": "!config.winrt && !config.integrity",
"condition": "!config.winrt && !config.integrity && !config.rtems",
"output": [ "publicFeature" ]
},
"temporaryfile": {

View File

@ -0,0 +1,26 @@
#! [qt5_wrap_cpp]
set(SOURCES myapp.cpp main.cpp)
qt5_wrap_cpp(SOURCES myapp.h)
add_executable(myapp ${SOURCES})
#! [qt5_wrap_cpp]
#! [qt5_add_resources]
set(SOURCES main.cpp)
qt5_add_resources(SOURCES example.qrc)
add_executable(myapp ${SOURCES})
#! [qt5_add_resources]
#! [qt5_add_big_resources]
set(SOURCES main.cpp)
qt5_add_big_resources(SOURCES big_resource.qrc)
add_executable(myapp ${SOURCES})
#! [qt5_add_big_resources]
#! [qt5_add_binary_resources]
qt5_add_binary_resources(resources project.qrc OPTIONS -no-compress)
add_dependencies(myapp resources)
#! [qt5_add_binary_resources]
#! [qt5_generate_moc]
qt5_generate_moc(main.cpp main.moc TARGET myapp)
#! [qt5_generate_moc]

View File

@ -1,53 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
#include <QtCore>
//! [0]

View File

@ -133,10 +133,10 @@ while (*data) {
//! [9]
QByteArray ba;
for (int i = 0; i < 10; ++i)
ba[i] = 'A' + i;
// ba == "ABCDEFGHIJ"
QByteArray ba("Hello, world");
cout << ba[0]; // prints H
ba[7] = 'W';
// ba == "Hello, World"
//! [9]

View File

@ -0,0 +1,2 @@
find_package(Qt5 COMPONENTS Core REQUIRED)
target_link_libraries(mytarget Qt5::Core)

View File

@ -0,0 +1,212 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtcore-cmake-qt5-wrap-cpp.html
\ingroup cmake-macros-qtcore
\title qt5_wrap_cpp
\brief Creates \c{.moc} files from sources.
\section1 Synopsis
\badcode
qt5_wrap_cpp(<VAR> src_file1 [src_file2 ...]
[TARGET target]
[OPTIONS ...]
[DEPENDS ...])
\endcode
\section1 Description
Creates rules for calling \l{moc}{Meta-Object Compiler (moc)} on the given
source files. For each input file, an output file is generated in the build
directory. The paths of the generated files are added to\c{<VAR>}.
\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a
more convenient way to let source files be processed with \c{moc}.
\section1 Options
You can set an explicit \c{TARGET}. This will make sure that the target
properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used
when scanning the source files with \c{moc}.
You can set additional \c{OPTIONS} that should be added to the \c{moc} calls.
You can find possible options in the \l{moc}{moc documentation}.
\c{DEPENDS} allows you to add additional dependencies for recreation of the
generated files. This is useful when the sources have implicit dependencies,
like code for a Qt plugin that includes a \c{.json} file using the
Q_PLUGIN_METADATA() macro.
\section1 Examples
\snippet cmake-macros/examples.cmake qt5_wrap_cpp
*/
/*!
\page qtcore-cmake-qt5-add-resources.html
\ingroup cmake-macros-qtcore
\title qt5_add_resources
\brief Compiles binary resources into source code.
\section1 Synopsis
\badcode
qt5_add_resources(<VAR> file1.qrc [file2.qrc ...]
[OPTIONS ...])
\endcode
\section1 Description
Creates source code from Qt resource files using the
\l{Resource Compiler (rcc)}. Paths to the generated source files are added to
\c{<VAR>}.
\note This is a low-level macro. See the \l{CMake AUTORCC Documentation} for a
more convenient way to let Qt resource files be processed with \c{rcc}.
For embedding bigger resources, see \l qt5_add_big_resources.
\section1 Arguments
You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls.
You can find possible options in the \l{rcc}{rcc documentation}.
\section1 Examples
\snippet cmake-macros/examples.cmake qt5_add_resources
*/
/*!
\page qtcore-cmake-qt5-add-big-resources.html
\ingroup cmake-macros-qtcore
\title qt5_add_big_resources
\brief Compiles big binary resources into object code.
\section1 Synopsis
\badcode
qt5_add_big_resources(<VAR> file1.qrc [file2.qrc ...]
[OPTIONS ...])
\endcode
\section1 Description
Creates compiled object files from Qt resource files using the
\l{Resource Compiler (rcc)}. Paths to the generated files are added to
\c{<VAR>}.
This is similar to \l qt5_add_resources, but directly generates object
files (\c .o, \c .obj) files instead of C++ source code. This allows to
embed bigger resources, where compiling to C++ sources and then to
binaries would be too time consuming or memory intensive.
\section1 Arguments
You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls.
You can find possible options in the \l{rcc}{rcc documentation}.
\section1 Examples
\snippet cmake-macros/examples.cmake qt5_add_big_resources
*/
/*!
\page qtcore-cmake-qt5_add_binary_resources.html
\ingroup cmake-macros-qtcore
\title qt5_add_binary_resources
\brief Creates an \c{RCC} file from a list of Qt resource files.
\section1 Synopsis
\badcode
qt5_add_binary_resources(target file1.qrc [file2.qrc ...]
[DESTINATION ...]
[OPTIONS ...])
\endcode
\section1 Description
Adds a custom \c target that compiles Qt resource files into a binary \c{.rcc}
file.
\section1 Arguments
\c{DESTINATION} sets the path of the generated \c{.rcc} file. The default is
\c{${CMAKE_CURRENT_BINARY_DIR}/${target}.rcc}.
You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls.
You can find possible options in the \l{rcc}{rcc documentation}.
\section1 Examples
\snippet cmake-macros/examples.cmake qt5_add_binary_resources
*/
/*!
\page qtcore-cmake-qt5-generate-moc.html
\ingroup cmake-macros-qtcore
\title qt5_generate_moc
\brief Calls moc on an input file.
\section1 Synopsis
\badcode
qt5_generate_moc(src_file dest_file
[TARGET target])
\endcode
\section1 Description
Creates a rule to call the \l{moc}{Meta-Object Compiler (moc)} on \c src_file
and store the output in \c dest_file.
\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a
more convenient way to let source files be processed with \c{moc}.
\l qt5_wrap_cpp is also similar, but automatically generates a temporary file
path for you.
\section1 Arguments
You can set an explicit \c{TARGET}. This will make sure that the target
properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used
when scanning the source files with \c{moc}.
\section1 Examples
\snippet cmake-macros/examples.cmake qt5_generate_moc
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@ -31,17 +31,9 @@
\brief The Qt Core module is part of Qt's essential modules.
\section1 Getting Started
All other Qt modules rely on this module. To include the
definitions of the module's classes, use the following directive:
\snippet code/doc_src_qtcore.cpp 0
If you use \l qmake to build your projects, Qt Core is included by default.
\section1 Core Functionalities
Qt adds these features to C++:
Qt Core adds these features to C++:
\list
\li a very powerful mechanism for seamless object communication called
@ -61,6 +53,15 @@
\li \l{Signals & Slots}
\endlist
\include module-use.qdocinc using qt module
\quotefile overview/using-qt-core.cmake
See also the \l[QtDoc]{Building with CMake} overview.
\section2 Building with qmake
If you use \l qmake to build your projects, Qt5Core is linked by default.
\section1 Threading and Concurrent Programming
Qt provides thread support in the form of platform-independent \l{Threading

View File

@ -33,12 +33,5 @@
\brief Provides core non-GUI functionality.
All other Qt modules rely on this module. To include the
definitions of the module's classes, use the following directive:
\snippet code/doc_src_qtcore.cpp 0
If you use \l qmake to build your projects, \l{Qt Core} is included by
default.
All other Qt modules rely on this module.
*/

View File

@ -7,6 +7,7 @@ HEADERS += \
global/qsystemdetection.h \
global/qcompilerdetection.h \
global/qprocessordetection.h \
global/qmemory_p.h \
global/qnamespace.h \
global/qendian.h \
global/qendian_p.h \

View File

@ -66,6 +66,19 @@ QT_BEGIN_NAMESPACE
\since 5.9
*/
/*!
\macro QT_NO_FLOAT16_OPERATORS
\relates <QFloat16>
\since 5.12.4
Defining this macro disables the arithmetic operators for qfloat16.
This is only necessary on Visual Studio 2017 (and earlier) when including
\c {<QFloat16>} and \c{<bitset>} in the same translation unit, which would
otherwise cause a compilation error due to a toolchain bug (see
[QTBUG-72073]).
*/
/*!
\fn bool qIsInf(qfloat16 f)
\relates <QFloat16>

View File

@ -106,7 +106,9 @@ private:
Q_CORE_EXPORT static const quint32 shifttable[];
friend bool qIsNull(qfloat16 f) noexcept;
#if !defined(QT_NO_FLOAT16_OPERATORS)
friend qfloat16 operator-(qfloat16 a) noexcept;
#endif
};
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
@ -191,6 +193,7 @@ inline qfloat16::operator float() const noexcept
}
#endif
#if !defined(QT_NO_FLOAT16_OPERATORS)
inline qfloat16 operator-(qfloat16 a) noexcept
{
qfloat16 f;
@ -272,6 +275,7 @@ QF16_MAKE_BOOL_OP_INT(!=)
#undef QF16_MAKE_BOOL_OP_INT
QT_WARNING_POP
#endif // QT_NO_FLOAT16_OPERATORS
/*!
\internal

View File

@ -1425,6 +1425,13 @@ bool qSharedBuild() noexcept
\l Q_OS_WIN32, \l Q_OS_WIN64, or \l Q_OS_WINRT is defined.
*/
/*!
\macro Q_OS_WINDOWS
\relates <QtGlobal>
This is a synonym for Q_OS_WIN.
*/
/*!
\macro Q_OS_WIN32
\relates <QtGlobal>
@ -3798,6 +3805,56 @@ bool qunsetenv(const char *varName)
\snippet code/src_corelib_global_qglobal.cpp as-const-4
*/
/*!
\fn template <typename T, typename U = T> T qExchange(T &obj, U &&newValue)
\relates <QtGlobal>
\since 5.14
Replaces the value of \a obj with \a newValue and returns the old value of \a obj.
This is Qt's implementation of std::exchange(). It differs from std::exchange()
only in that it is \c constexpr already in C++14, and available on all supported
compilers.
Here is how to use qExchange() to implement move constructors:
\code
MyClass(MyClass &&other)
: m_pointer{qExchange(other.m_pointer, nullptr)},
m_int{qExchange(other.m_int, 0)},
m_vector{std::move(other.m_vector)},
...
\endcode
For members of class type, we can use std::move(), as their move-constructor will
do the right thing. But for scalar types such as raw pointers or integer type, move
is the same as copy, which, particularly for pointers, is not what we expect. So, we
cannot use std::move() for such types, but we can use std::exchange()/qExchange() to
make sure the source object's member is already reset by the time we get to the
initialization of our next data member, which might come in handy if the constructor
exits with an exception.
Here is how to use qExchange() to write a loop that consumes the collection it
iterates over:
\code
for (auto &e : qExchange(collection, {})
doSomethingWith(e);
\endcode
Which is equivalent to the following, much more verbose code:
\code
{
auto tmp = std::move(collection);
collection = {}; // or collection.clear()
for (auto &e : tmp)
doSomethingWith(e);
} // destroys 'tmp'
\endcode
This is perfectly safe, as the for-loop keeps the result of qExchange() alive for as
long as the loop runs, saving the declaration of a temporary variable. Be aware, though,
that qExchange() returns a non-const object, so Qt containers may detach.
*/
/*!
\macro QT_TR_NOOP(sourceText)
\relates <QtGlobal>

View File

@ -380,7 +380,7 @@ typedef double qreal;
#define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text)
#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major(minor, text)
#define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor()
#define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor
#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major(minor)
/*
@ -1009,6 +1009,15 @@ Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { ret
template <typename T>
void qAsConst(const T &&) = delete;
// like std::exchange
template <typename T, typename U = T>
Q_DECL_RELAXED_CONSTEXPR T qExchange(T &t, U &&newValue)
{
T old = std::move(t);
t = std::forward<U>(newValue);
return old;
}
#ifndef QT_NO_FOREACH
namespace QtPrivate {

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

@ -0,0 +1,71 @@
/****************************************************************************
**
** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMEMORY_P_H
#define QMEMORY_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qglobal.h>
#include <memory>
#include <type_traits>
#include <utility>
QT_BEGIN_NAMESPACE
// Like std::make_unique, but less ambitious, so keep as private API, for use in Qt itself:
template <typename T, typename... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
qt_make_unique(Args &&...args)
{
return std::unique_ptr<T>{new T(std::forward<Args>(args)...)};
}
QT_END_NAMESPACE
#endif /* QMEMORY_P_H */

View File

@ -194,6 +194,13 @@ public:
DescendingOrder
};
enum SplitBehaviorFlags {
KeepEmptyParts = 0,
SkipEmptyParts = 0x1,
};
Q_DECLARE_FLAGS(SplitBehavior, SplitBehaviorFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(SplitBehavior)
enum TileRule {
StretchTile,
RepeatTile,
@ -351,14 +358,18 @@ public:
WA_MouseTracking = 2,
WA_ContentsPropagated = 3, // ## deprecated
WA_OpaquePaintEvent = 4,
WA_NoBackground = WA_OpaquePaintEvent, // ## deprecated
#if QT_DEPRECATED_SINCE(5, 14)
WA_NoBackground Q_DECL_ENUMERATOR_DEPRECATED = WA_OpaquePaintEvent,
#endif
WA_StaticContents = 5,
WA_LaidOut = 7,
WA_PaintOnScreen = 8,
WA_NoSystemBackground = 9,
WA_UpdatesDisabled = 10,
WA_Mapped = 11,
WA_MacNoClickThrough = 12, // Mac only
#if QT_DEPRECATED_SINCE(5, 14)
WA_MacNoClickThrough Q_DECL_ENUMERATOR_DEPRECATED = 12,
#endif
WA_InputMethodEnabled = 14,
WA_WState_Visible = 15,
WA_WState_Hidden = 16,
@ -376,8 +387,10 @@ public:
WA_Moved = 43,
WA_PendingUpdate = 44,
WA_InvalidSize = 45,
WA_MacBrushedMetal = 46, // Mac only
WA_MacMetalStyle = WA_MacBrushedMetal, // obsolete
#if QT_DEPRECATED_SINCE(5, 14)
WA_MacBrushedMetal Q_DECL_ENUMERATOR_DEPRECATED = 46,
WA_MacMetalStyle Q_DECL_ENUMERATOR_DEPRECATED = 46,
#endif
WA_CustomWhatsThis = 47,
WA_LayoutOnEntireRect = 48,
WA_OutsideWSRange = 49,
@ -434,7 +447,9 @@ public:
WA_LayoutUsesWidgetRect = 92,
WA_StyledBackground = 93, // internal
WA_MSWindowsUseDirect3D = 94, // Win only
#if QT_DEPRECATED_SINCE(5, 14)
WA_MSWindowsUseDirect3D Q_DECL_ENUMERATOR_DEPRECATED = 94,
#endif
WA_CanHostQMdiSubWindowTitleBar = 95, // Internal
WA_MacAlwaysShowToolWindow = 96, // Mac only
@ -466,9 +481,9 @@ public:
WA_X11NetWmWindowTypeNotification = 114,
WA_X11NetWmWindowTypeCombo = 115,
WA_X11NetWmWindowTypeDND = 116,
WA_MacFrameworkScaled = 117,
#if QT_DEPRECATED_SINCE(5, 14)
WA_MacFrameworkScaled Q_DECL_ENUMERATOR_DEPRECATED = 117,
#endif
WA_SetWindowModality = 118,
WA_WState_WindowOpacitySet = 119, // internal
WA_TranslucentBackground = 120,
@ -495,7 +510,9 @@ public:
enum ApplicationAttribute
{
AA_ImmediateWidgetCreation = 0,
AA_MSWindowsUseDirect3DByDefault = 1, // Win only
#if QT_DEPRECATED_SINCE(5, 14)
AA_MSWindowsUseDirect3DByDefault Q_DECL_ENUMERATOR_DEPRECATED = 1,
#endif
AA_DontShowIconsInMenus = 2,
AA_NativeWindows = 3,
AA_DontCreateNativeWidgetSiblings = 4,
@ -506,7 +523,9 @@ public:
AA_DontUseNativeMenuBar = 6,
AA_MacDontSwapCtrlAndMeta = 7,
AA_Use96Dpi = 8,
AA_X11InitThreads = 10,
#if QT_DEPRECATED_SINCE(5, 14)
AA_X11InitThreads Q_DECL_ENUMERATOR_DEPRECATED = 10,
#endif
AA_SynthesizeTouchForUnhandledMouseEvents = 11,
AA_SynthesizeMouseForUnhandledTouchEvents = 12,
AA_UseHighDpiPixmaps = 13,
@ -527,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
@ -1380,7 +1400,9 @@ public:
enum InputMethodQuery {
ImEnabled = 0x1,
ImCursorRectangle = 0x2,
ImMicroFocus = 0x2, // deprecated
#if QT_DEPRECATED_SINCE(5, 14)
ImMicroFocus Q_DECL_ENUMERATOR_DEPRECATED = 0x2,
#endif
ImFont = 0x4,
ImCursorPosition = 0x8,
ImSurroundingText = 0x10,
@ -1758,6 +1780,7 @@ public:
QT_Q_FLAG(Alignment)
QT_Q_ENUM(TextFlag)
QT_Q_FLAG(Orientations)
QT_Q_FLAG(SplitBehavior)
QT_Q_FLAG(DropActions)
QT_Q_FLAG(Edges)
QT_Q_FLAG(DockWidgetAreas)

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
@ -2361,6 +2368,19 @@
'ZZZ' ends with 'AAA' in Latin-1 locales
*/
/*!
\enum Qt::SplitBehavior
\since 5.14
This enum specifies how the split() functions should behave with
respect to empty strings.
\value KeepEmptyParts If a field is empty, keep it in the result.
\value SkipEmptyParts If a field is empty, don't include it in the result.
\sa QString::split()
*/
/*!
\enum Qt::ClipOperation
@ -2464,6 +2484,9 @@
\value AutoText The text string is interpreted as for
Qt::RichText if Qt::mightBeRichText() returns \c true, otherwise
as Qt::PlainText.
\value MarkdownText The text string is interpreted as Markdown-formatted text.
This enum value was added in Qt 5.14.
*/
/*!

View File

@ -84,7 +84,6 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
#define pGetModuleHandle GetModuleHandleW
#endif
#ifndef Q_OS_WINCE
HMODULE ntdll = pGetModuleHandle(L"ntdll.dll");
if (Q_UNLIKELY(!ntdll))
return result;
@ -104,9 +103,6 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
// GetVersionEx() has been deprecated in Windows 8.1 and will return
// only Windows 8 from that version on, so use the kernel API function.
pRtlGetVersion(reinterpret_cast<LPOSVERSIONINFO>(&result)); // always returns STATUS_SUCCESS
#else // !Q_OS_WINCE
GetVersionEx(&result);
#endif
return result;
}

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__)
@ -176,6 +178,7 @@
#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
# define Q_OS_WINDOWS
# define Q_OS_WIN
#endif

View File

@ -213,7 +213,6 @@ Q_DECLARE_MOVABLE_CONTAINER(QList);
Q_DECLARE_MOVABLE_CONTAINER(QVector);
Q_DECLARE_MOVABLE_CONTAINER(QQueue);
Q_DECLARE_MOVABLE_CONTAINER(QStack);
Q_DECLARE_MOVABLE_CONTAINER(QLinkedList);
Q_DECLARE_MOVABLE_CONTAINER(QSet);
#undef Q_DECLARE_MOVABLE_CONTAINER

View File

@ -61,6 +61,13 @@
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 +331,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 +916,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 +986,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 +1043,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

@ -695,52 +695,36 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
Q_UNUSED(data);
return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
#else
char *ret = 0;
# if defined(Q_OS_DARWIN)
ret = (char*)malloc(PATH_MAX + 1);
if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
const int savedErrno = errno; // errno is checked below, and free() might change it
free(ret);
errno = savedErrno;
ret = 0;
}
# elif defined(Q_OS_ANDROID)
// On some Android versions, realpath() will return a path even if it does not exist
// To work around this, we check existence in advance.
char stack_result[PATH_MAX+1];
char *resolved_name = nullptr;
# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID)
// On some Android and macOS versions, realpath() will return a path even if
// it does not exist. To work around this, we check existence in advance.
if (!data.hasFlags(QFileSystemMetaData::ExistsAttribute))
fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute);
if (!data.exists()) {
ret = 0;
errno = ENOENT;
} else {
ret = (char*)malloc(PATH_MAX + 1);
if (realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
const int savedErrno = errno; // errno is checked below, and free() might change it
free(ret);
errno = savedErrno;
ret = 0;
}
resolved_name = stack_result;
}
if (resolved_name && realpath(entry.nativeFilePath().constData(), resolved_name) == nullptr)
resolved_name = nullptr;
# else
# if _POSIX_VERSION >= 200801L
ret = realpath(entry.nativeFilePath().constData(), (char*)0);
# if _POSIX_VERSION >= 200801L // ask realpath to allocate memory
resolved_name = realpath(entry.nativeFilePath().constData(), nullptr);
# else
ret = (char*)malloc(PATH_MAX + 1);
if (realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
const int savedErrno = errno; // errno is checked below, and free() might change it
free(ret);
errno = savedErrno;
ret = 0;
}
resolved_name = stack_result;
if (realpath(entry.nativeFilePath().constData(), resolved_name) == nullptr)
resolved_name = nullptr;
# endif
# endif
if (ret) {
if (resolved_name) {
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
QString canonicalPath = QDir::cleanPath(QFile::decodeName(ret));
free(ret);
QString canonicalPath = QDir::cleanPath(QFile::decodeName(resolved_name));
if (resolved_name != stack_result)
free(resolved_name);
return QFileSystemEntry(canonicalPath);
} else if (errno == ENOENT || errno == ENOTDIR) { // file doesn't exist
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;

View File

@ -311,6 +311,17 @@ bool QFileSystemWatcher::addPath(const QString &path)
return paths.isEmpty();
}
static QStringList empty_paths_pruned(const QStringList &paths)
{
QStringList p;
p.reserve(paths.size());
const auto isEmpty = [](const QString &s) { return s.isEmpty(); };
std::remove_copy_if(paths.begin(), paths.end(),
std::back_inserter(p),
isEmpty);
return p;
}
/*!
Adds each path in \a paths to the file system watcher. Paths are
not added if they not exist, or if they are already being
@ -338,47 +349,41 @@ QStringList QFileSystemWatcher::addPaths(const QStringList &paths)
{
Q_D(QFileSystemWatcher);
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
const QString &path = it.next();
if (path.isEmpty())
it.remove();
}
QStringList p = empty_paths_pruned(paths);
if (p.isEmpty()) {
qWarning("QFileSystemWatcher::addPaths: list is empty");
return QStringList();
return p;
}
QFileSystemWatcherEngine *engine = 0;
const auto selectEngine = [this, d]() -> QFileSystemWatcherEngine* {
#ifdef QT_BUILD_INTERNAL
const QString on = objectName();
const QString on = objectName();
if (!on.startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
if (Q_UNLIKELY(on.startsWith(QLatin1String("_qt_autotest_force_engine_")))) {
// Autotest override case - use the explicitly selected engine only
const QStringRef forceName = on.midRef(26);
if (forceName == QLatin1String("poller")) {
qDebug("QFileSystemWatcher: skipping native engine, using only polling engine");
d_func()->initPollerEngine();
return d->poller;
} else if (forceName == QLatin1String("native")) {
qDebug("QFileSystemWatcher: skipping polling engine, using only native engine");
return d->native;
}
return nullptr;
}
#endif
// Normal runtime case - search intelligently for best engine
if(d->native) {
engine = d->native;
return d->native;
} else {
d_func()->initPollerEngine();
engine = d->poller;
return d->poller;
}
};
} else {
// Autotest override case - use the explicitly selected engine only
const QStringRef forceName = on.midRef(26);
if(forceName == QLatin1String("poller")) {
qDebug("QFileSystemWatcher: skipping native engine, using only polling engine");
d_func()->initPollerEngine();
engine = d->poller;
} else if(forceName == QLatin1String("native")) {
qDebug("QFileSystemWatcher: skipping polling engine, using only native engine");
engine = d->native;
}
}
if(engine)
if (auto engine = selectEngine())
p = engine->addPaths(p, &d->files, &d->directories);
return p;
@ -420,18 +425,11 @@ QStringList QFileSystemWatcher::removePaths(const QStringList &paths)
{
Q_D(QFileSystemWatcher);
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
const QString &path = it.next();
if (path.isEmpty())
it.remove();
}
QStringList p = empty_paths_pruned(paths);
if (p.isEmpty()) {
qWarning("QFileSystemWatcher::removePaths: list is empty");
return QStringList();
return p;
}
if (d->native)

View File

@ -46,6 +46,7 @@
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qscopeguard.h>
#include <qsocketnotifier.h>
#include <qvarlengtharray.h>
@ -268,12 +269,11 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
QFileInfo fi(path);
bool isDir = fi.isDir();
auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
if (isDir) {
if (directories->contains(path))
continue;
@ -305,7 +305,7 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
continue;
}
it.remove();
sg.dismiss();
int id = isDir ? -wd : wd;
if (id < 0) {
@ -318,19 +318,19 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
idToPath.insert(id, path);
}
return p;
return unhandled;
}
QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
int id = pathToID.take(path);
auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
// Multiple paths could be associated to the same watch descriptor
// when a file is moved and added with the new name.
// So we should find and delete the correct one by using
@ -349,7 +349,8 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
inotify_rm_watch(inotifyFd, wd);
}
it.remove();
sg.dismiss();
if (id < 0) {
directories->removeAll(path);
} else {
@ -357,7 +358,7 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
}
}
return p;
return unhandled;
}
void QInotifyFileSystemWatcherEngine::readFromInotify()

View File

@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qfile.h>
#include <qscopeguard.h>
#include <qsocketnotifier.h>
#include <qvarlengtharray.h>
@ -94,10 +95,9 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
auto sg = qScopeGuard([&]{unhandled.push_back(path);});
int fd;
#if defined(O_EVTONLY)
fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
@ -149,7 +149,8 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
continue;
}
it.remove();
sg.dismiss();
if (id < 0) {
DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
directories->append(path);
@ -162,20 +163,19 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
idToPath.insert(id, path);
}
return p;
return unhandled;
}
QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
if (pathToID.isEmpty())
return p;
return paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
auto sg = qScopeGuard([&]{unhandled.push_back(path);});
int id = pathToID.take(path);
QString x = idToPath.take(id);
if (x.isEmpty() || x != path)
@ -183,14 +183,15 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
::close(id < 0 ? -id : id);
it.remove();
sg.dismiss();
if (id < 0)
directories->removeAll(path);
else
files->removeAll(path);
}
return p;
return unhandled;
}
void QKqueueFileSystemWatcherEngine::readFromKqueue()

View File

@ -38,6 +38,7 @@
****************************************************************************/
#include "qfilesystemwatcher_polling_p.h"
#include <QtCore/qscopeguard.h>
#include <QtCore/qtimer.h>
QT_BEGIN_NAMESPACE
@ -53,10 +54,9 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
QFileInfo fi(path);
if (!fi.exists())
continue;
@ -73,7 +73,7 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
files->append(path);
this->files.insert(path, fi);
}
it.remove();
sg.dismiss();
}
if ((!this->files.isEmpty() ||
@ -82,23 +82,21 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
timer.start(PollingInterval);
}
return p;
return unhandled;
}
QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
if (this->directories.remove(path)) {
directories->removeAll(path);
it.remove();
} else if (this->files.remove(path)) {
files->removeAll(path);
it.remove();
} else {
unhandled.push_back(path);
}
}
@ -107,7 +105,7 @@ QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &path
timer.stop();
}
return p;
return unhandled;
}
void QPollingFileSystemWatcherEngine::timeout()

View File

@ -44,6 +44,7 @@
#include <qfileinfo.h>
#include <qstringlist.h>
#include <qset.h>
#include <qscopeguard.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qtextstream.h>
@ -305,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;
}
@ -323,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;
}
@ -377,10 +376,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *directories)
{
DEBUG() << "Adding" << paths.count() << "to existing" << (files->count() + directories->count()) << "watchers";
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
auto sg = qScopeGuard([&] { unhandled.push_back(path); });
QString normalPath = path;
if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/")))
|| (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) {
@ -463,7 +461,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
else
files->append(path);
}
it.remove();
sg.dismiss();
thread->wakeup();
break;
}
@ -493,7 +491,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
else
files->append(path);
it.remove();
sg.dismiss();
found = true;
thread->wakeup();
break;
@ -519,7 +517,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
thread->msg = '@';
thread->start();
threads.append(thread);
it.remove();
sg.dismiss();
}
}
}
@ -527,12 +525,12 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
#ifndef Q_OS_WINRT
if (Q_LIKELY(m_driveListener)) {
for (const QString &path : paths) {
if (!p.contains(path))
if (!unhandled.contains(path))
m_driveListener->addPath(path);
}
}
#endif // !Q_OS_WINRT
return p;
return unhandled;
}
QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &paths,
@ -540,10 +538,9 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
QStringList *directories)
{
DEBUG() << "removePaths" << paths;
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
QString path = it.next();
QStringList unhandled;
for (const QString &path : paths) {
auto sg = qScopeGuard([&] { unhandled.push_back(path); });
QString normalPath = path;
if (normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
normalPath.chop(1);
@ -572,7 +569,7 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
// ###
files->removeAll(path);
directories->removeAll(path);
it.remove();
sg.dismiss();
if (h.isEmpty()) {
DEBUG() << "Closing handle" << handle.handle;
@ -613,7 +610,7 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
}
threads.removeAll(0);
return p;
return unhandled;
}
///////////
@ -642,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()
@ -696,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
}

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