Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
This commit is contained in:
commit
6b2535ea15
@ -189,7 +189,7 @@ macro(qt_build_tests)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manual/CMakeLists.txt")
|
||||
add_subdirectory(manual)
|
||||
# add_subdirectory(manual) don't build manual tests for now, because qmake doesn't.
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -136,8 +136,10 @@ Build options:
|
||||
for example, -sanitize address cannot be combined with
|
||||
-sanitize thread.
|
||||
|
||||
-coverage {trace-pc-guard}
|
||||
Add code coverage instrumentation (Clang only)
|
||||
-coverage {trace-pc-guard|source-based}
|
||||
Specify the 'trace-pc-guard' coverage instrumentation for
|
||||
sanitizers or generate instrumented code to collect execution
|
||||
counts and enable code coverage analysis, respectively. (Clang only)
|
||||
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11]
|
||||
(Not supported with MSVC 2015)
|
||||
|
@ -15,7 +15,7 @@ qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev)
|
||||
|
||||
#### Tests
|
||||
|
||||
# c++14
|
||||
# cxx14
|
||||
qt_config_compile_test(cxx14
|
||||
LABEL "C++14 support"
|
||||
CODE
|
||||
@ -38,7 +38,7 @@ int main(int argc, char **argv)
|
||||
CXX_STANDARD 14
|
||||
)
|
||||
|
||||
# c++17
|
||||
# cxx17
|
||||
qt_config_compile_test(cxx17
|
||||
LABEL "C++17 support"
|
||||
CODE
|
||||
@ -65,7 +65,7 @@ std::visit([](const auto &) { return 1; }, v);
|
||||
CXX_STANDARD 17
|
||||
)
|
||||
|
||||
# c++2a
|
||||
# cxx2a
|
||||
qt_config_compile_test(cxx2a
|
||||
LABEL "C++2a support"
|
||||
CODE
|
||||
@ -398,9 +398,14 @@ qt_feature("coverage_trace_pc_guard"
|
||||
AUTODETECT OFF
|
||||
)
|
||||
qt_feature_config("coverage_trace_pc_guard" QMAKE_PUBLIC_CONFIG)
|
||||
qt_feature("coverage_source_based"
|
||||
LABEL "source-based"
|
||||
AUTODETECT OFF
|
||||
)
|
||||
qt_feature_config("coverage_source_based" QMAKE_PUBLIC_CONFIG)
|
||||
qt_feature("coverage"
|
||||
LABEL "Code Coverage Instrumentation"
|
||||
CONDITION QT_FEATURE_coverage_trace_pc_guard
|
||||
CONDITION QT_FEATURE_coverage_trace_pc_guard OR QT_FEATURE_coverage_source_based
|
||||
)
|
||||
qt_feature_config("coverage" QMAKE_PUBLIC_CONFIG)
|
||||
qt_feature("plugin-manifests"
|
||||
|
@ -321,7 +321,7 @@
|
||||
"qmake": "CONFIG += c11"
|
||||
}
|
||||
},
|
||||
"c++14": {
|
||||
"cxx14": {
|
||||
"label": "C++14 support",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
@ -335,7 +335,7 @@
|
||||
"qmake": "CONFIG += c++11 c++14"
|
||||
}
|
||||
},
|
||||
"c++17": {
|
||||
"cxx17": {
|
||||
"label": "C++17 support",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
@ -356,7 +356,7 @@
|
||||
"qmake": "CONFIG += c++11 c++14 c++17"
|
||||
}
|
||||
},
|
||||
"c++2a": {
|
||||
"cxx2a": {
|
||||
"label": "C++2a support",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
@ -915,9 +915,14 @@
|
||||
"autoDetect": false,
|
||||
"output": [ "publicConfig" ]
|
||||
},
|
||||
"coverage_source_based": {
|
||||
"label": "source-based",
|
||||
"autoDetect": false,
|
||||
"output": [ "publicConfig" ]
|
||||
},
|
||||
"coverage": {
|
||||
"label": "Code Coverage Instrumentation",
|
||||
"condition": "features.coverage_trace_pc_guard",
|
||||
"condition": "features.coverage_trace_pc_guard || features.coverage_source_based",
|
||||
"output": [ "publicConfig" ]
|
||||
},
|
||||
"GNUmake": {
|
||||
@ -957,12 +962,12 @@
|
||||
},
|
||||
"c++14": {
|
||||
"label": "C++14",
|
||||
"condition": "features.c++11 && tests.c++14",
|
||||
"condition": "features.c++11 && tests.cxx14",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c++17": {
|
||||
"label": "C++17",
|
||||
"condition": "features.c++14 && tests.c++17",
|
||||
"condition": "features.c++14 && tests.cxx17",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c++1z": {
|
||||
@ -973,7 +978,7 @@
|
||||
"c++2a": {
|
||||
"label": "C++2a",
|
||||
"autoDetect": false,
|
||||
"condition": "features.c++17 && tests.c++2a",
|
||||
"condition": "features.c++17 && tests.cxx2a",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c89": {
|
||||
@ -1606,7 +1611,7 @@
|
||||
{
|
||||
"message": "Code Coverage Instrumentation",
|
||||
"type": "firstAvailableFeature",
|
||||
"args": "coverage_trace_pc_guard",
|
||||
"args": "coverage_trace_pc_guard coverage_source_based",
|
||||
"condition": "features.coverage"
|
||||
},
|
||||
{
|
||||
|
@ -72,7 +72,9 @@ defineTest(qtConfCommandline_coverage) {
|
||||
!contains(val, "^-.*"):!isEmpty(val) {
|
||||
equals(val, "trace-pc-guard") {
|
||||
qtConfCommandlineSetInput("coverage_trace_pc_guard", "yes")
|
||||
} else {
|
||||
} else: equals(val, "source-based") {
|
||||
qtConfCommandlineSetInput("coverage_source_based", "yes")
|
||||
} else: {
|
||||
qtConfAddError("Invalid argument $$val to command line parameter $$arg")
|
||||
}
|
||||
} else {
|
||||
|
74
dist/changes-5.14.1
vendored
Normal file
74
dist/changes-5.14.1
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
Qt 5.14.1 is a bug-fix release. It maintains both forward and backward
|
||||
compatibility (source and binary) with Qt 5.14.0.
|
||||
|
||||
For more details, refer to the online documentation included in this
|
||||
distribution. The documentation is also available online:
|
||||
|
||||
https://doc.qt.io/qt-5/index.html
|
||||
|
||||
The Qt version 5.14 series is binary compatible with the 5.13.x series.
|
||||
Applications compiled for 5.13 will continue to run with 5.14.
|
||||
|
||||
Some of the changes listed in this file include issue tracking numbers
|
||||
corresponding to tasks in the Qt Bug Tracker:
|
||||
|
||||
https://bugreports.qt.io/
|
||||
|
||||
Each of these identifiers can be entered in the bug tracker to obtain more
|
||||
information about a particular change.
|
||||
|
||||
****************************************************************************
|
||||
* MinGW *
|
||||
****************************************************************************
|
||||
|
||||
- Qt will by default be built in release mode. Use -debug-or-release to
|
||||
force the pre 5.14.0 default.
|
||||
|
||||
****************************************************************************
|
||||
* QtCore *
|
||||
****************************************************************************
|
||||
|
||||
- QCborValue:
|
||||
* The constructor taking a CBOR tag and a value to be tagged now
|
||||
attempts to convert to a QCborValue extended type. For example, if the
|
||||
tag is 0 (UnixTime_t) and the payload is a number, the resulting
|
||||
object will become tag 1 (DateTime) and the payload will be the the
|
||||
ISO-8601 date/time string.
|
||||
|
||||
- QDateTime:
|
||||
* ISO 8601: parsing of dates now requires a punctuator as separator (it
|
||||
previously allowed any non-digit; officially only a dash should be
|
||||
allowed) and parsing of date-times no longer tolerates spaces in the
|
||||
numeric fields: an internal space is only allowed in an ISO 8601
|
||||
date-time as replacement for the T between date and time.
|
||||
|
||||
****************************************************************************
|
||||
* QtGui *
|
||||
****************************************************************************
|
||||
|
||||
- QGuiApplication:
|
||||
* [QTBUG-80934] Fixed High DPI scaling factors to be equal to pre 5.14.
|
||||
|
||||
****************************************************************************
|
||||
* QtWidgets *
|
||||
****************************************************************************
|
||||
|
||||
- QApplication:
|
||||
* [QTBUG-81107] Fixed an exit hang related to QGraphicsProxyWidget.
|
||||
- QToolTip:
|
||||
* Make sure that the tooltip is not obscured by very large mouse
|
||||
pointers on Windows and macOS.
|
||||
|
||||
****************************************************************************
|
||||
* Tools *
|
||||
****************************************************************************
|
||||
|
||||
- rcc:
|
||||
* rcc now generates correct code when using the --namespace option.
|
||||
|
||||
****************************************************************************
|
||||
* macOS/iOS *
|
||||
****************************************************************************
|
||||
|
||||
- Fixed a bug where QFontDatabase::systemFont() would return the wrong
|
||||
fonts on macOS 10.15 and iOS 13.
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
@ -482,6 +482,11 @@
|
||||
\title Khronos OpenGL ES API Registry
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage https://www.khronos.org/opengl/wiki/Array_Texture
|
||||
\title Array Texture
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage https://github.com/iksaif/qsslkey-p11
|
||||
\title qsslkey example
|
||||
|
@ -83,8 +83,7 @@ Client::Client(QWidget *parent)
|
||||
this, &Client::requestNewFortune);
|
||||
connect(quitButton, &QPushButton::clicked, this, &Client::close);
|
||||
connect(socket, &QLocalSocket::readyRead, this, &Client::readFortune);
|
||||
connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
|
||||
this, &Client::displayError);
|
||||
connect(socket, &QLocalSocket::errorOccurred, this, &Client::displayError);
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout(this);
|
||||
mainLayout->addWidget(hostLabel, 0, 0);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
@ -198,7 +198,7 @@ private slots:
|
||||
|
||||
public slots:
|
||||
|
||||
void request(const QString &flightCode, const QDate &date) {
|
||||
void request(const QString &flightCode, QDate date) {
|
||||
|
||||
setWindowTitle("Loading...");
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
@ -71,7 +71,7 @@ QVariant addGenre(QSqlQuery &q, const QString &name)
|
||||
return q.lastInsertId();
|
||||
}
|
||||
|
||||
QVariant addAuthor(QSqlQuery &q, const QString &name, const QDate &birthdate)
|
||||
QVariant addAuthor(QSqlQuery &q, const QString &name, QDate birthdate)
|
||||
{
|
||||
q.addBindValue(name);
|
||||
q.addBindValue(birthdate);
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/*!
|
||||
\example hellovulkancubes
|
||||
\meta installpath vulkan
|
||||
\title Hello Vulkan Cubes Example
|
||||
\ingroup examples-vulkan
|
||||
\brief Shows the basics of using QVulkanWindow.
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/*!
|
||||
\example hellovulkantexture
|
||||
\meta installpath vulkan
|
||||
\ingroup examples-vulkan
|
||||
\title Hello Vulkan Texture Vulkan Example
|
||||
\brief Shows the basics of rendering with textures in a QVulkanWindow.
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/*!
|
||||
\example hellovulkantriangle
|
||||
\meta installpath vulkan
|
||||
\ingroup examples-vulkan
|
||||
\title Hello Vulkan Triangle Example
|
||||
\brief Shows the basics of rendering with QVulkanWindow and the Vulkan API.
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/*!
|
||||
\example hellovulkanwidget
|
||||
\meta installpath vulkan
|
||||
\ingroup examples-vulkan
|
||||
\title Hello Vulkan Widget Example
|
||||
\brief Shows the usage of QVulkanWindow in QWidget applications.
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/*!
|
||||
\example hellovulkanwindow
|
||||
\meta installpath vulkan
|
||||
\title Hello Vulkan Window Example
|
||||
\ingroup examples-vulkan
|
||||
\brief Shows the basics of using QVulkanWindow.
|
||||
|
@ -109,7 +109,7 @@ void Screenshot::resizeEvent(QResizeEvent * /* event */)
|
||||
{
|
||||
QSize scaledSize = originalPixmap.size();
|
||||
scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio);
|
||||
if (!screenshotLabel->pixmap() || scaledSize != screenshotLabel->pixmap()->size())
|
||||
if (scaledSize != screenshotLabel->pixmap(Qt::ReturnByValue).size())
|
||||
updateScreenshotLabel();
|
||||
}
|
||||
//! [1]
|
||||
|
@ -369,7 +369,7 @@ void ConclusionPage::setVisible(bool visible)
|
||||
|
||||
void ConclusionPage::printButtonClicked()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QPrinter printer;
|
||||
QPrintDialog dialog(&printer, this);
|
||||
if (dialog.exec())
|
||||
|
@ -329,7 +329,8 @@ void Dialog::setDouble()
|
||||
//! [1]
|
||||
bool ok;
|
||||
double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
|
||||
tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
|
||||
tr("Amount:"), 37.56, -10000, 10000, 2, &ok,
|
||||
Qt::WindowFlags(), 1);
|
||||
if (ok)
|
||||
doubleLabel->setText(QString("$%1").arg(d));
|
||||
//! [1]
|
||||
|
@ -175,8 +175,8 @@
|
||||
will expand to
|
||||
|
||||
\code
|
||||
if (!imageLabel->pixmap())
|
||||
qFatal("ASSERT: "imageLabel->pixmap()" in file ...");
|
||||
if (imageLabel->pixmap(Qt::ReturnByValue).isNull())
|
||||
qFatal("ASSERT: "imageLabel->pixmap(Qt::ReturnByValue).isNull()" in file ...");
|
||||
\endcode
|
||||
|
||||
In release mode, the macro simply disappear. The mode can be set
|
||||
|
@ -142,7 +142,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
QPixmap pixmap = *child->pixmap();
|
||||
QPixmap pixmap = child->pixmap(Qt::ReturnByValue);
|
||||
|
||||
QByteArray itemData;
|
||||
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
|
||||
|
@ -208,7 +208,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
|
||||
//! [16]
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
drag->setPixmap(*child->pixmap());
|
||||
drag->setPixmap(child->pixmap(Qt::ReturnByValue));
|
||||
drag->setHotSpot(hotSpot);
|
||||
|
||||
child->hide();
|
||||
|
@ -243,7 +243,7 @@ void View::toggleAntialiasing()
|
||||
|
||||
void View::print()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QPrinter printer;
|
||||
QPrintDialog dialog(&printer, this);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -60,7 +60,7 @@ MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
|
||||
void MySortFilterProxyModel::setFilterMinimumDate(QDate date)
|
||||
{
|
||||
minDate = date;
|
||||
invalidateFilter();
|
||||
@ -68,7 +68,7 @@ void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date)
|
||||
void MySortFilterProxyModel::setFilterMaximumDate(QDate date)
|
||||
{
|
||||
maxDate = date;
|
||||
invalidateFilter();
|
||||
@ -122,7 +122,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
|
||||
//! [5] //! [6]
|
||||
|
||||
//! [7]
|
||||
bool MySortFilterProxyModel::dateInRange(const QDate &date) const
|
||||
bool MySortFilterProxyModel::dateInRange(QDate date) const
|
||||
{
|
||||
return (!minDate.isValid() || date > minDate)
|
||||
&& (!maxDate.isValid() || date < maxDate);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -63,17 +63,17 @@ public:
|
||||
MySortFilterProxyModel(QObject *parent = 0);
|
||||
|
||||
QDate filterMinimumDate() const { return minDate; }
|
||||
void setFilterMinimumDate(const QDate &date);
|
||||
void setFilterMinimumDate(QDate date);
|
||||
|
||||
QDate filterMaximumDate() const { return maxDate; }
|
||||
void setFilterMaximumDate(const QDate &date);
|
||||
void setFilterMaximumDate(QDate date);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
private:
|
||||
bool dateInRange(const QDate &date) const;
|
||||
bool dateInRange(QDate date) const;
|
||||
|
||||
QDate minDate;
|
||||
QDate maxDate;
|
||||
|
@ -167,7 +167,7 @@ void MainWindow::openImage(const QString &fileName)
|
||||
|
||||
void MainWindow::printImage()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
|
||||
QMessageBox::StandardButton answer;
|
||||
answer = QMessageBox::question(this, tr("Large Image Size"),
|
||||
|
@ -128,7 +128,7 @@ void MainWindow::newLetter()
|
||||
//! [3]
|
||||
void MainWindow::print()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QTextDocument *document = textEdit->document();
|
||||
QPrinter printer;
|
||||
|
||||
|
@ -248,7 +248,7 @@ void MainWindow::openDialog()
|
||||
//! [17]
|
||||
void MainWindow::printFile()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
|
||||
//! [18]
|
||||
QPrinter printer;
|
||||
|
@ -419,18 +419,18 @@ bool TextEdit::load(const QString &f)
|
||||
QByteArray data = file.readAll();
|
||||
QTextCodec *codec = Qt::codecForHtml(data);
|
||||
QString str = codec->toUnicode(data);
|
||||
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
|
||||
textEdit->document()->setBaseUrl(baseUrl);
|
||||
if (Qt::mightBeRichText(str)) {
|
||||
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
|
||||
textEdit->document()->setBaseUrl(baseUrl);
|
||||
textEdit->setHtml(str);
|
||||
} else {
|
||||
#if QT_CONFIG(textmarkdownreader)
|
||||
QMimeDatabase db;
|
||||
if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown"))
|
||||
textEdit->setMarkdown(str);
|
||||
textEdit->setMarkdown(QString::fromUtf8(data));
|
||||
else
|
||||
#endif
|
||||
textEdit->setPlainText(QString::fromLocal8Bit(data));
|
||||
textEdit->setPlainText(QString::fromUtf8(data));
|
||||
}
|
||||
|
||||
setCurrentFileName(f);
|
||||
@ -545,7 +545,7 @@ bool TextEdit::fileSaveAs()
|
||||
|
||||
void TextEdit::filePrint()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
||||
if (textEdit->textCursor().hasSelection())
|
||||
|
@ -170,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
|
||||
//! [21]
|
||||
void ScribbleArea::print()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
|
||||
QPrintDialog printDialog(&printer, this);
|
||||
|
@ -92,7 +92,7 @@ Notepad::Notepad(QWidget *parent) :
|
||||
connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
|
||||
|
||||
// Disable menu actions for unavailable features
|
||||
#if !QT_CONFIG(printer)
|
||||
#if !defined(QT_PRINTSUPPORT_LIB) || !QT_CONFIG(printer)
|
||||
ui->actionPrint->setEnabled(false);
|
||||
#endif
|
||||
|
||||
@ -171,7 +171,7 @@ void Notepad::saveAs()
|
||||
|
||||
void Notepad::print()
|
||||
{
|
||||
#if QT_CONFIG(printer)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
|
||||
QPrinter printDev;
|
||||
#if QT_CONFIG(printdialog)
|
||||
QPrintDialog dialog(&printDev, this);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -126,7 +126,7 @@ void Window::selectedDateChanged()
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
void Window::minimumDateChanged(const QDate &date)
|
||||
void Window::minimumDateChanged(QDate date)
|
||||
{
|
||||
calendar->setMinimumDate(date);
|
||||
maximumDateEdit->setDate(calendar->maximumDate());
|
||||
@ -134,7 +134,7 @@ void Window::minimumDateChanged(const QDate &date)
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
void Window::maximumDateChanged(const QDate &date)
|
||||
void Window::maximumDateChanged(QDate date)
|
||||
{
|
||||
calendar->setMaximumDate(date);
|
||||
minimumDateEdit->setDate(calendar->minimumDate());
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -52,6 +52,7 @@
|
||||
#define WINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDateTime>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCalendarWidget;
|
||||
@ -79,8 +80,8 @@ private slots:
|
||||
void horizontalHeaderChanged(int index);
|
||||
void verticalHeaderChanged(int index);
|
||||
void selectedDateChanged();
|
||||
void minimumDateChanged(const QDate &date);
|
||||
void maximumDateChanged(const QDate &date);
|
||||
void minimumDateChanged(QDate date);
|
||||
void maximumDateChanged(QDate date);
|
||||
void weekdayFormatChanged();
|
||||
void weekendFormatChanged();
|
||||
void reformatHeaders();
|
||||
|
@ -200,19 +200,20 @@ void ImageViewer::saveAs()
|
||||
void ImageViewer::print()
|
||||
//! [5] //! [6]
|
||||
{
|
||||
Q_ASSERT(imageLabel->pixmap());
|
||||
#if QT_CONFIG(printdialog)
|
||||
Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull());
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
//! [6] //! [7]
|
||||
QPrintDialog dialog(&printer, this);
|
||||
//! [7] //! [8]
|
||||
if (dialog.exec()) {
|
||||
QPainter painter(&printer);
|
||||
QPixmap pixmap = imageLabel->pixmap(Qt::ReturnByValue);
|
||||
QRect rect = painter.viewport();
|
||||
QSize size = imageLabel->pixmap()->size();
|
||||
QSize size = pixmap.size();
|
||||
size.scale(rect.size(), Qt::KeepAspectRatio);
|
||||
painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
|
||||
painter.setWindow(imageLabel->pixmap()->rect());
|
||||
painter.drawPixmap(0, 0, *imageLabel->pixmap());
|
||||
painter.setWindow(pixmap.rect());
|
||||
painter.drawPixmap(0, 0, pixmap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -383,9 +384,8 @@ void ImageViewer::updateActions()
|
||||
void ImageViewer::scaleImage(double factor)
|
||||
//! [23] //! [24]
|
||||
{
|
||||
Q_ASSERT(imageLabel->pixmap());
|
||||
scaleFactor *= factor;
|
||||
imageLabel->resize(scaleFactor * imageLabel->pixmap()->size());
|
||||
imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
|
||||
|
||||
adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
|
||||
adjustScrollBar(scrollArea->verticalScrollBar(), factor);
|
||||
|
@ -210,7 +210,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
|
||||
//! [21]
|
||||
void ScribbleArea::print()
|
||||
{
|
||||
#if QT_CONFIG(printdialog)
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
|
||||
QPrintDialog printDialog(&printer, this);
|
||||
|
@ -54,3 +54,7 @@ QMAKE_RANLIB_LTCG = true # No need to run, since llvm-ar has "s"
|
||||
QMAKE_CFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
QMAKE_LFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
|
||||
QMAKE_CFLAGS_COVERAGE_SOURCE_BASED = -fprofile-instr-generate -fcoverage-mapping
|
||||
QMAKE_CXXFLAGS_COVERAGE_SOURCE_BASED = -fprofile-instr-generate -fcoverage-mapping
|
||||
QMAKE_LFLAGS_COVERAGE_SOURCE_BASED = -fprofile-instr-generate -fcoverage-mapping
|
||||
|
@ -105,8 +105,15 @@ QMAKE_CFLAGS_AVX512BW += -mavx512bw
|
||||
QMAKE_CFLAGS_AVX512VL += -mavx512vl
|
||||
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
||||
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
|
||||
QMAKE_CFLAGS_AVX512VNNI += -mavx512vnni
|
||||
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
||||
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
|
||||
QMAKE_CFLAGS_AVX512VBMI2 += -mavx512vbmi2
|
||||
QMAKE_CFLAGS_AVX512BITALG += -mavx512bitalg
|
||||
QMAKE_CFLAGS_AVX512POPCNTDQ += -mavx512vpopcntd
|
||||
QMAKE_CFLAGS_AESNI += -maes
|
||||
QMAKE_CFLAGS_SHANI += -msha
|
||||
QMAKE_CFLAGS_VAES += -mvaes
|
||||
QMAKE_CFLAGS_NEON += -mfpu=neon
|
||||
QMAKE_CFLAGS_MIPS_DSP += -mdsp
|
||||
QMAKE_CFLAGS_MIPS_DSPR2 += -mdspr2
|
||||
|
@ -48,11 +48,18 @@ QMAKE_CFLAGS_AVX512PF += -march=knl
|
||||
QMAKE_CFLAGS_AVX512DQ += -march=skylake-avx512
|
||||
QMAKE_CFLAGS_AVX512BW += -march=skylake-avx512
|
||||
QMAKE_CFLAGS_AVX512VL += -march=skylake-avx512
|
||||
QMAKE_CFLAGS_AVX512VNNI += -march=cascadelake
|
||||
QMAKE_CFLAGS_AVX512IFMA += -march=icelake-client # technically, cannonlake
|
||||
QMAKE_CFLAGS_AVX512VBMI += -march=icelake-client # ditto
|
||||
QMAKE_CFLAGS_AVX512VBMI2 += -march=icelake-client
|
||||
QMAKE_CFLAGS_AVX512BITALG += -march=icelake-client
|
||||
QMAKE_CFLAGS_AVX512POPCNTDQ += -march=icelake-client
|
||||
QMAKE_CFLAGS_AESNI += -maes
|
||||
QMAKE_CFLAGS_F16C += $$QMAKE_CFLAGS_AVX2
|
||||
QMAKE_CFLAGS_RDRND += -mrdrnd
|
||||
QMAKE_CFLAGS_RDSEED += -mrdseed
|
||||
QMAKE_CFLAGS_SHANI += -msha
|
||||
QMAKE_CFLAGS_VAES += -mvaes
|
||||
|
||||
QMAKE_CXX = icpc
|
||||
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
|
||||
|
@ -36,7 +36,7 @@ build_pass {
|
||||
}
|
||||
}
|
||||
} else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install {
|
||||
tmpvar = $$str_member(TARGET, -$$str_size(QT_ARCH), -1)
|
||||
tmpvar = $$str_member($$TARGET, -$$str_size($${QT_ARCH}), -1)
|
||||
!equals(tmpvar, $${QT_ARCH}): TARGET = $${TARGET}_$${QT_ARCH}
|
||||
target.path = /libs/$$ANDROID_TARGET_ARCH/
|
||||
INSTALLS *= target
|
||||
|
@ -5,3 +5,9 @@ coverage_trace_pc_guard {
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||
}
|
||||
|
||||
coverage_source_based {
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_COVERAGE_SOURCE_BASED
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_COVERAGE_SOURCE_BASED
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_COVERAGE_SOURCE_BASED
|
||||
}
|
||||
|
@ -212,17 +212,20 @@ contains(CONFIG, plugin) {
|
||||
CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _)
|
||||
|
||||
win32 {
|
||||
!mingw|qtConfig(debug_and_release): debug_suffix="d"
|
||||
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.prl
|
||||
|
||||
isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.dll
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.dll
|
||||
} else:mingw {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}$${debug_suffix}.a
|
||||
} else { # MSVC static
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.lib
|
||||
}
|
||||
} else {
|
||||
mac {
|
||||
@ -313,27 +316,29 @@ mac {
|
||||
CMAKE_WINDOWS_BUILD = "true"
|
||||
CMAKE_FIND_OTHER_LIBRARY_BUILD = "true"
|
||||
|
||||
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.dll
|
||||
!mingw|qtConfig(debug_and_release): debug_suffix="d"
|
||||
|
||||
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.dll
|
||||
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll
|
||||
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_STATIC_WINDOWS_BUILD = "true"
|
||||
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
|
||||
}
|
||||
|
||||
mingw {
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}$${debug_suffix}.a
|
||||
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
|
||||
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}$${debug_suffix}.a
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
|
||||
} else {
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}$${debug_suffix}.lib
|
||||
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
|
||||
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.lib
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
|
||||
}
|
||||
} else {
|
||||
|
@ -72,6 +72,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
||||
string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends \"${_prl_strings}\")
|
||||
string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
|
||||
set(_search_paths)
|
||||
set(_fw_search_paths)
|
||||
set(_framework_flag)
|
||||
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
|
||||
foreach(_flag ${_static_depends})
|
||||
@ -79,10 +80,13 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
||||
if(_flag MATCHES \"^-framework$\")
|
||||
# Handle the next flag as framework name
|
||||
set(_framework_flag 1)
|
||||
elseif(_flag MATCHES \"^-F(.*)$\")
|
||||
# Handle -F/foo/bar flags by recording the framework search paths to be used
|
||||
# by find_library.
|
||||
list(APPEND _fw_search_paths \"${CMAKE_MATCH_1}\")
|
||||
elseif(_framework_flag OR _flag MATCHES \"^-l(.*)$\")
|
||||
if(_framework_flag)
|
||||
# Handle Darwin framework bundles passed as -framework Foo
|
||||
unset(_framework_flag)
|
||||
set(_lib ${_flag})
|
||||
else()
|
||||
# Handle normal libraries passed as -lfoo
|
||||
@ -100,10 +104,14 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
||||
find_package(Threads REQUIRED)
|
||||
list(APPEND _lib_deps Threads::Threads)
|
||||
else()
|
||||
if(_search_paths)
|
||||
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${_search_paths} NO_DEFAULT_PATH)
|
||||
set(current_search_paths \"${_search_paths}\")
|
||||
if(_framework_flag)
|
||||
set(current_search_paths \"${_fw_search_paths}\")
|
||||
endif()
|
||||
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib})
|
||||
if(current_search_paths)
|
||||
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${current_search_paths} NO_DEFAULT_PATH)
|
||||
endif()
|
||||
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
|
||||
mark_as_advanced(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||||
if(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||||
list(APPEND _lib_deps
|
||||
@ -112,6 +120,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
||||
else()
|
||||
message(FATAL_ERROR \"Library not found: ${_lib}\")
|
||||
endif()
|
||||
unset(_framework_flag)
|
||||
endif()
|
||||
elseif(EXISTS \"${_flag}\")
|
||||
# The flag is an absolute path to an existing library
|
||||
|
@ -1,7 +1,5 @@
|
||||
qtPrepareTool(MOC_COLLECT_JSON, moc)
|
||||
|
||||
load(qt_build_paths)
|
||||
|
||||
QMAKE_MOC_OPTIONS += --output-json
|
||||
|
||||
MOC_JSON_H_BASE = $${QMAKE_H_MOD_MOC}
|
||||
@ -39,6 +37,7 @@ install_metatypes {
|
||||
do_install_metatypes.path = $$[QT_INSTALL_LIBS]/metatypes
|
||||
do_install_metatypes.files = $$OUT_PWD/$$MOC_COLLECT_JSON_OUTPUT
|
||||
prefix_build {
|
||||
load(qt_build_paths)
|
||||
!isEmpty(MODULE_BASE_OUTDIR) {
|
||||
metatypes_to_builddir.files = $$do_install_metatypes.files
|
||||
metatypes_to_builddir.path = $$MODULE_BASE_OUTDIR/lib/metatypes
|
||||
|
@ -46,8 +46,8 @@ build_pass:!isEmpty(QT_ARCH): {
|
||||
EXTENDS = $$section(LIB_FILE, ":", 1, 1)
|
||||
!isEmpty(EXTENDS): EXTENDS = "extends=\"$$EXTENDS\""
|
||||
LIB_FILE = $$section(LIB_FILE, ":", 0, 0)
|
||||
LIB_FILE = $$replace(LIB_FILE,".so", "_$${QT_ARCH}.so")
|
||||
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,".so", "_$${QT_ARCH}.so")
|
||||
LIB_FILE = $$replace(LIB_FILE,"\.so", "_$${QT_ARCH}.so")
|
||||
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,"\.so", "_$${QT_ARCH}.so")
|
||||
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" $$EXTENDS />"
|
||||
}
|
||||
}
|
||||
@ -56,14 +56,14 @@ build_pass:!isEmpty(QT_ARCH): {
|
||||
for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
|
||||
REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
|
||||
LIB_FILE = $$section(REPLACEMENT, ":", 1, 1)
|
||||
REPLACEMENT_FILE = $$replace(REPLACEMENT_FILE,".so", "_$${QT_ARCH}.so")
|
||||
REPLACEMENT_FILE = $$replace(REPLACEMENT_FILE,"\.so", "_$${QT_ARCH}.so")
|
||||
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" replaces=\"$$REPLACEMENT_FILE\" />"
|
||||
}
|
||||
}
|
||||
|
||||
!isEmpty(ANDROID_BUNDLED_FILES) {
|
||||
for (BUNDLED_FILE, ANDROID_BUNDLED_FILES) {
|
||||
BUNDLED_FILE = $$replace(BUNDLED_FILE,".so", "_$${QT_ARCH}.so")
|
||||
BUNDLED_FILE = $$replace(BUNDLED_FILE,"\.so", "_$${QT_ARCH}.so")
|
||||
FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />"
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,21 @@
|
||||
defineReplace(qtPlatformTargetSuffix) {
|
||||
suffix =
|
||||
android: return($${suffix}_$${QT_ARCH})
|
||||
else: CONFIG(debug, debug|release) {
|
||||
!debug_and_release|build_pass {
|
||||
mac: return($${suffix}_debug)
|
||||
win32: return($${suffix}d)
|
||||
win32 {
|
||||
CONFIG(debug, debug|release) {
|
||||
mingw {
|
||||
qtConfig(debug_and_release):build_pass: \
|
||||
return($${suffix}d)
|
||||
} else {
|
||||
!debug_and_release|build_pass: \
|
||||
return($${suffix}d)
|
||||
}
|
||||
}
|
||||
}
|
||||
darwin {
|
||||
CONFIG(debug, debug|release) {
|
||||
!debug_and_release|build_pass: \
|
||||
return($${suffix}_debug)
|
||||
}
|
||||
}
|
||||
return($$suffix)
|
||||
|
@ -1,6 +1,5 @@
|
||||
qtPrepareTool(QMAKE_RCC, rcc, _DEP)
|
||||
|
||||
isEmpty(RCC_DIR):RCC_DIR = .
|
||||
isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
|
||||
|
||||
!contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT
|
||||
@ -8,39 +7,7 @@ isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
|
||||
|
||||
load(resources_functions)
|
||||
qtFlattenResources()
|
||||
|
||||
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
|
||||
pluginBaseName = $$basename(TARGET)
|
||||
pluginName = $$lower($$replace(pluginBaseName, [-], _))
|
||||
resource_init_function = $${pluginName}_plugin_resource_init
|
||||
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
|
||||
RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
|
||||
|
||||
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
|
||||
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
|
||||
|
||||
isEmpty(BUILDS)|build_pass {
|
||||
RESOURCE_INIT_CONT = \
|
||||
"// This file is autogenerated by qmake. It contains a function that" \
|
||||
"// references all resources the plugin includes and the function is" \
|
||||
"// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \
|
||||
"// the statically linked plugin." \
|
||||
"$${LITERAL_HASH}include <QtCore/qglobal.h>" \
|
||||
"void $${resource_init_function}() " \
|
||||
"{" \
|
||||
|
||||
for (resource, RESOURCES) {
|
||||
resource_name = $$section($$list($$basename(resource)), ., 0, 0)
|
||||
resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _)
|
||||
RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);"
|
||||
}
|
||||
|
||||
RESOURCE_INIT_CONT += \
|
||||
"}"
|
||||
|
||||
write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error()
|
||||
}
|
||||
}
|
||||
qtEnsurePluginResourcesCpp()
|
||||
|
||||
rcc.input = RESOURCES
|
||||
rcc.name = RCC ${QMAKE_FILE_IN}
|
||||
|
@ -9,6 +9,7 @@ defineReplace(xml_escape) {
|
||||
}
|
||||
|
||||
defineTest(qtFlattenResources) {
|
||||
isEmpty(RCC_DIR):RCC_DIR = .
|
||||
immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR
|
||||
defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \
|
||||
QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1)
|
||||
@ -33,7 +34,18 @@ defineTest(qtFlattenResources) {
|
||||
next()
|
||||
}
|
||||
|
||||
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD)
|
||||
RESOURCES -= $$resource
|
||||
!android|isEmpty(BUILDS)|build_pass {
|
||||
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD)
|
||||
RESOURCES += $$resource_file
|
||||
} else {
|
||||
# Android will need a resource file for each architecture make sure it is placed
|
||||
# correctly for other functions that need the right paths for these files
|
||||
for (arch, ANDROID_ABIS) {
|
||||
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD/$$arch)
|
||||
RESOURCES += $$resource_file
|
||||
}
|
||||
}
|
||||
|
||||
isEmpty(BUILDS)|build_pass {
|
||||
# Collection of files, generate qrc file
|
||||
@ -68,13 +80,54 @@ defineTest(qtFlattenResources) {
|
||||
!write_file($$resource_file, resource_file_content): \
|
||||
error()
|
||||
}
|
||||
|
||||
RESOURCES -= $$resource
|
||||
RESOURCES += $$resource_file
|
||||
}
|
||||
export(RCC_DIR)
|
||||
export(QMAKE_RESOURCES_IMMEDIATE_NR)
|
||||
export(RESOURCES)
|
||||
export(OTHER_FILES)
|
||||
export($${immediate}.files)
|
||||
return(true)
|
||||
}
|
||||
|
||||
defineTest(qtEnsurePluginResourcesCpp) {
|
||||
contains(DEFINES, QT_PLUGIN_RESOURCE_INIT_FUNCTION=.*): \
|
||||
return(true)
|
||||
|
||||
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
|
||||
pluginBaseName = $$basename(TARGET)
|
||||
pluginName = $$lower($$replace(pluginBaseName, [-], _))
|
||||
resource_init_function = $${pluginName}_plugin_resource_init
|
||||
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
|
||||
RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
|
||||
|
||||
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
|
||||
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
|
||||
|
||||
isEmpty(BUILDS)|build_pass {
|
||||
RESOURCE_INIT_CONT = \
|
||||
"// This file is autogenerated by qmake. It contains a function that" \
|
||||
"// references all resources the plugin includes and the function is" \
|
||||
"// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \
|
||||
"// the statically linked plugin." \
|
||||
"$${LITERAL_HASH}include <QtCore/qglobal.h>" \
|
||||
"void $${resource_init_function}() " \
|
||||
"{" \
|
||||
|
||||
for (resource, RESOURCES) {
|
||||
resource_name = $$replace($$list($$basename(resource)),\.qrc$, )
|
||||
resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _)
|
||||
RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);"
|
||||
}
|
||||
|
||||
RESOURCE_INIT_CONT += \
|
||||
"}"
|
||||
|
||||
write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error()
|
||||
}
|
||||
|
||||
export(DEFINES)
|
||||
export(GENERATED_SOURCES)
|
||||
export(QMAKE_DISTCLEAN)
|
||||
}
|
||||
return(true)
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ addSimdCompiler(sse4_1)
|
||||
addSimdCompiler(sse4_2)
|
||||
addSimdCompiler(aesni)
|
||||
addSimdCompiler(shani)
|
||||
addSimdCompiler(vaes)
|
||||
addSimdCompiler(avx)
|
||||
addSimdCompiler(avx2)
|
||||
addSimdCompiler(avx512f)
|
||||
@ -133,8 +134,12 @@ addSimdCompiler(avx512pf)
|
||||
addSimdCompiler(avx512dq)
|
||||
addSimdCompiler(avx512bw)
|
||||
addSimdCompiler(avx512vl)
|
||||
addSimdCompiler(avx512vnni)
|
||||
addSimdCompiler(avx512ifma)
|
||||
addSimdCompiler(avx512vbmi)
|
||||
addSimdCompiler(avx512vbmi2)
|
||||
addSimdCompiler(avx512bitalg)
|
||||
addSimdCompiler(avx512vpopcntd)
|
||||
addSimdCompiler(f16c)
|
||||
addSimdCompiler(rdrnd)
|
||||
addSimdCompiler(rdseed)
|
||||
|
@ -30,8 +30,8 @@ defineReplace(yaccCommands) {
|
||||
commands = \
|
||||
-$(DEL_FILE) $${hpp_output} $${cpp_output}$$escape_expand(\\n\\t) \
|
||||
$${yacc_call}$$escape_expand(\\n\\t) \
|
||||
$(MOVE) $${YACC_DIR}/$${QMAKE_YACC_HEADER} $${hpp_output}$$escape_expand(\\n\\t) \
|
||||
$(MOVE) $${YACC_DIR}/$${QMAKE_YACC_SOURCE} $${cpp_output}$$escape_expand(\\n\\t)
|
||||
$(MOVE) $$shell_path($${YACC_DIR}/$${QMAKE_YACC_HEADER}) $${hpp_output}$$escape_expand(\\n\\t) \
|
||||
$(MOVE) $$shell_path($${YACC_DIR}/$${QMAKE_YACC_SOURCE}) $${cpp_output}$$escape_expand(\\n\\t)
|
||||
|
||||
silent: commands = @echo Yacc $$1 && $$commands
|
||||
return($$commands)
|
||||
|
@ -51,34 +51,8 @@ EMCC_COMMON_LFLAGS_DEBUG = \
|
||||
# -s SOCKET_DEBUG \ #print out socket,network data transfer
|
||||
-s GL_DEBUG=1
|
||||
|
||||
# Set up debug/optimization flags
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
equals(WASM_OBJECT_FILES, 1) {
|
||||
QMAKE_LFLAGS_DEBUG += -g
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += -O3
|
||||
QMAKE_CFLAGS_RELEASE += -O3
|
||||
QMAKE_LFLAGS_RELEASE += -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE += -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE_FULL += -Oz
|
||||
} else {
|
||||
# Practical debugging setup:
|
||||
# "-g4" preserves function names for stack traces
|
||||
# "-Os" produces reasonably sized binaries
|
||||
QMAKE_CFLAGS_DEBUG -= -g
|
||||
QMAKE_CXXFLAGS_DEBUG -= -g
|
||||
QMAKE_CFLAGS_DEBUG += -Os -g4
|
||||
QMAKE_CXXFLAGS_DEBUG += -Os -g4
|
||||
QMAKE_LFLAGS_DEBUG += -Os -g4
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += -O3
|
||||
QMAKE_CFLAGS_RELEASE += -O3
|
||||
QMAKE_LFLAGS_RELEASE += -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE += -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE_FULL += -Oz
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS_DEBUG += -g
|
||||
QMAKE_LFLAGS_RELEASE += -O2
|
||||
|
||||
QMAKE_COMPILER += emscripten
|
||||
|
||||
|
@ -38,6 +38,12 @@ QMAKE_CFLAGS_AVX512PF += -QxMIC-AVX512
|
||||
QMAKE_CFLAGS_AVX512DQ += -QxCORE-AVX512
|
||||
QMAKE_CFLAGS_AVX512BW += -QxCORE-AVX512
|
||||
QMAKE_CFLAGS_AVX512VL += -QxCORE-AVX512
|
||||
QMAKE_CFLAGS_AVX512VNNI += -QxCASCADELAKE
|
||||
QMAKE_CFLAGS_AVX512IFMA += -QxICELAKE-CLIENT # technically, cannonlake
|
||||
QMAKE_CFLAGS_AVX512VBMI += -QxICELAKE-CLIENT # ditto
|
||||
QMAKE_CFLAGS_AVX512VBMI2 += QxICELAKE-CLIENT
|
||||
QMAKE_CFLAGS_AVX512BITALG += QxICELAKE-CLIENT
|
||||
QMAKE_CFLAGS_AVX512POPCNTDQ += QxICELAKE-CLIENT
|
||||
QMAKE_CFLAGS_F16C = $$QMAKE_CFLAGS_AVX2
|
||||
QMAKE_CFLAGS_RDRND = $$QMAKE_CFLAGS_AVX2
|
||||
# ICC on Windows lacks the mrdseed compiler option that sets the RDSEED macro
|
||||
@ -46,6 +52,7 @@ QMAKE_CFLAGS_ARCH_HASWELL = $$QMAKE_CFLAGS_AVX2
|
||||
|
||||
QMAKE_CFLAGS_AESNI = -QxSSE2
|
||||
QMAKE_CFLAGS_SHANI = -QxSSE4.2
|
||||
QMAKE_CFLAGS_VAES = -QxCORE-AVX512
|
||||
|
||||
QMAKE_CXX = $$QMAKE_CC
|
||||
QMAKE_CXXFLAGS += -Qprec -Zm200 -Zc:forScope
|
||||
|
@ -917,7 +917,7 @@
|
||||
Specifies project configuration and compiler options. The values are
|
||||
recognized internally by qmake and have special meaning.
|
||||
|
||||
The following \c CONFIG values control compilation flags:
|
||||
The following \c CONFIG values control compiler and linker flags:
|
||||
|
||||
\table
|
||||
\header \li Option \li Description
|
||||
@ -948,6 +948,8 @@
|
||||
\row \li warn_off \li The compiler should output as few warnings as possible.
|
||||
\row \li exceptions \li Exception support is enabled. Set by default.
|
||||
\row \li exceptions_off \li Exception support is disabled.
|
||||
\row \li ltcg \li Link time code generation is enabled.
|
||||
This option is off by default.
|
||||
\row \li rtti \li RTTI support is enabled. By default, the compiler
|
||||
default is used.
|
||||
\row \li rtti_off \li RTTI support is disabled. By default, the compiler
|
||||
|
@ -310,7 +310,7 @@ static QString commandLinesForOutput(QStringList commands)
|
||||
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
|
||||
commands.insert(i + 1, errchk);
|
||||
}
|
||||
return commands.join('\n');
|
||||
return commands.join("\r\n");
|
||||
}
|
||||
|
||||
static QString unquote(const QString &value)
|
||||
|
1
src/3rdparty/md4c.pri
vendored
1
src/3rdparty/md4c.pri
vendored
@ -1,3 +1,4 @@
|
||||
INCLUDEPATH += $$PWD/md4c
|
||||
HEADERS += $$PWD/md4c/md4c.h
|
||||
SOURCES += $$PWD/md4c/md4c.c
|
||||
DEFINES += MD4C_USE_UTF8
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 676425e522e08eb0e7dfaacdac79a5de27542322 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shaw <andy.shaw@qt.io>
|
||||
Date: Wed, 11 Dec 2019 10:51:22 +0100
|
||||
Subject: [PATCH 53/53] Fix CVE-2019-19244 in SQLite
|
||||
|
||||
Fixes: QTBUG-80635
|
||||
Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd
|
||||
---
|
||||
src/3rdparty/sqlite/sqlite3.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
|
||||
index 8fd740b300..bd647ca1c2 100644
|
||||
--- a/src/3rdparty/sqlite/sqlite3.c
|
||||
+++ b/src/3rdparty/sqlite/sqlite3.c
|
||||
@@ -131679,6 +131679,7 @@ SQLITE_PRIVATE int sqlite3Select(
|
||||
*/
|
||||
if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
|
||||
&& sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0
|
||||
+ && p->pWin==0
|
||||
){
|
||||
p->selFlags &= ~SF_Distinct;
|
||||
pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0);
|
||||
--
|
||||
2.21.0 (Apple Git-122.2)
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 7905740b8e79479298e83d8e559fc49b46cf980e Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shaw <andy.shaw@qt.io>
|
||||
Date: Thu, 19 Dec 2019 21:59:09 +0100
|
||||
Subject: [PATCH] Fix CVE-2019-19242 in SQLite
|
||||
|
||||
Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6
|
||||
---
|
||||
src/3rdparty/sqlite/sqlite3.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
|
||||
index bd647ca1c2..d3e0c065b6 100644
|
||||
--- a/src/3rdparty/sqlite/sqlite3.c
|
||||
+++ b/src/3rdparty/sqlite/sqlite3.c
|
||||
@@ -101055,7 +101055,12 @@ expr_code_doover:
|
||||
** constant.
|
||||
*/
|
||||
int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
|
||||
- int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
|
||||
+ int aff;
|
||||
+ if( pExpr->y.pTab ){
|
||||
+ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
|
||||
+ }else{
|
||||
+ aff = pExpr->affExpr;
|
||||
+ }
|
||||
if( aff>SQLITE_AFF_BLOB ){
|
||||
static const char zAff[] = "B\000C\000D\000E";
|
||||
assert( SQLITE_AFF_BLOB=='A' );
|
||||
--
|
||||
2.21.0 (Apple Git-122.2)
|
||||
|
@ -1,95 +0,0 @@
|
||||
From 11a2f4647b67494fb731a6fd793f1b28074631d3 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shaw <andy.shaw@qt.io>
|
||||
Date: Thu, 19 Dec 2019 22:31:15 +0100
|
||||
Subject: [PATCH] Fix CVE-2019-19603 in SQLite
|
||||
|
||||
This includes the patch needed to fix this CVE and a supporting one to
|
||||
include a new function added that it depends on.
|
||||
|
||||
Task-number: QTBUG-80903
|
||||
Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72
|
||||
---
|
||||
src/3rdparty/sqlite/sqlite3.c | 32 ++++++++++++++++++++++++++------
|
||||
1 file changed, 26 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
|
||||
index d3e0c065b6..a430554db7 100644
|
||||
--- a/src/3rdparty/sqlite/sqlite3.c
|
||||
+++ b/src/3rdparty/sqlite/sqlite3.c
|
||||
@@ -19519,6 +19519,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
|
||||
);
|
||||
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
|
||||
#endif
|
||||
+SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db);
|
||||
+#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
+SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
|
||||
+#else
|
||||
+# define sqlite3ShadowTableName(A,B) 0
|
||||
+#endif
|
||||
SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*);
|
||||
SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
|
||||
SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
|
||||
@@ -108483,6 +108489,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){
|
||||
return (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==SQLITE_WriteSchema;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ ** Return TRUE if shadow tables should be read-only in the current
|
||||
+ ** context.
|
||||
+ */
|
||||
+int sqlite3ReadOnlyShadowTables(sqlite3 *db){
|
||||
+#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
+ if( (db->flags & SQLITE_Defensive)!=0
|
||||
+ && db->pVtabCtx==0
|
||||
+ && db->nVdbeExec==0
|
||||
+ ){
|
||||
+ return 1;
|
||||
+ }
|
||||
+#endif
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
** This routine is used to check if the UTF-8 string zName is a legal
|
||||
** unqualified name for a new schema object (table, index, view or
|
||||
@@ -108516,8 +108538,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName(
|
||||
}
|
||||
}
|
||||
}else{
|
||||
- if( pParse->nested==0
|
||||
- && 0==sqlite3StrNICmp(zName, "sqlite_", 7)
|
||||
+ if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7))
|
||||
+ || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName))
|
||||
){
|
||||
sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s",
|
||||
zName);
|
||||
@@ -109662,7 +109684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
||||
** zName is temporarily modified while this routine is running, but is
|
||||
** restored to its original value prior to this routine returning.
|
||||
*/
|
||||
-static int isShadowTableName(sqlite3 *db, char *zName){
|
||||
+int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
|
||||
char *zTail; /* Pointer to the last "_" in zName */
|
||||
Table *pTab; /* Table that zName is a shadow of */
|
||||
Module *pMod; /* Module for the virtual table */
|
||||
@@ -109680,8 +109702,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){
|
||||
if( pMod->pModule->xShadowName==0 ) return 0;
|
||||
return pMod->pModule->xShadowName(zTail+1);
|
||||
}
|
||||
-#else
|
||||
-# define isShadowTableName(x,y) 0
|
||||
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
|
||||
|
||||
/*
|
||||
@@ -109723,7 +109743,7 @@ SQLITE_PRIVATE void sqlite3EndTable(
|
||||
p = pParse->pNewTable;
|
||||
if( p==0 ) return;
|
||||
|
||||
- if( pSelect==0 && isShadowTableName(db, p->zName) ){
|
||||
+ if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){
|
||||
p->tabFlags |= TF_Shadow;
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0 (Apple Git-122.2)
|
||||
|
@ -1,29 +0,0 @@
|
||||
From a83bbce4d6f31d93ea4d2a681aa52c148f148e26 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shaw <andy.shaw@qt.io>
|
||||
Date: Thu, 2 Jan 2020 09:07:08 +0100
|
||||
Subject: [PATCH] Fix CVE-2019-19646 in SQLite
|
||||
|
||||
Task-number: QTBUG-81020
|
||||
Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343
|
||||
---
|
||||
src/3rdparty/sqlite/sqlite3.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
|
||||
index 57e61b8313..980a149b1a 100644
|
||||
--- a/src/3rdparty/sqlite/sqlite3.c
|
||||
+++ b/src/3rdparty/sqlite/sqlite3.c
|
||||
@@ -123765,7 +123765,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
if( j==pTab->iPKey ) continue;
|
||||
if( pTab->aCol[j].notNull==0 ) continue;
|
||||
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
|
||||
- sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
|
||||
+ if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){
|
||||
+ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
|
||||
+ }
|
||||
jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
|
||||
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
|
||||
pTab->aCol[j].zName);
|
||||
--
|
||||
2.21.0 (Apple Git-122.2)
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 78c972eec5bab03a408b8ba1373572bcfe2db630 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shaw <andy.shaw@qt.io>
|
||||
Date: Thu, 2 Jan 2020 08:47:23 +0100
|
||||
Subject: [PATCH] Fix CVE-2019-19645 in SQLite
|
||||
|
||||
Task-number: QTBUG-81020
|
||||
Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970
|
||||
---
|
||||
src/3rdparty/sqlite/sqlite3.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
|
||||
index d3e0c065b6..57e61b8313 100644
|
||||
--- a/src/3rdparty/sqlite/sqlite3.c
|
||||
+++ b/src/3rdparty/sqlite/sqlite3.c
|
||||
@@ -17946,6 +17946,7 @@ struct Select {
|
||||
#define SF_IncludeHidden 0x20000 /* Include hidden columns in output */
|
||||
#define SF_ComplexResult 0x40000 /* Result contains subquery or function */
|
||||
#define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */
|
||||
+#define SF_View 0x0200000 /* SELECT statement is a view */
|
||||
|
||||
/*
|
||||
** The results of a SELECT can be distributed in several ways, as defined
|
||||
@@ -103920,6 +103921,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
|
||||
static int renameUnmapSelectCb(Walker *pWalker, Select *p){
|
||||
Parse *pParse = pWalker->pParse;
|
||||
int i;
|
||||
+ if( p->selFlags & SF_View ) return WRC_Prune;
|
||||
if( ALWAYS(p->pEList) ){
|
||||
ExprList *pList = p->pEList;
|
||||
for(i=0; i<pList->nExpr; i++){
|
||||
@@ -104024,6 +104026,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
|
||||
** descend into sub-select statements.
|
||||
*/
|
||||
static int renameColumnSelectCb(Walker *pWalker, Select *p){
|
||||
+ if( p->selFlags & SF_View ) return WRC_Prune;
|
||||
renameWalkWith(pWalker, p);
|
||||
return WRC_Continue;
|
||||
}
|
||||
@@ -104489,8 +104492,9 @@ static void renameColumnFunc(
|
||||
if( sParse.pNewTable ){
|
||||
Select *pSelect = sParse.pNewTable->pSelect;
|
||||
if( pSelect ){
|
||||
+ pSelect->selFlags &= ~SF_View;
|
||||
sParse.rc = SQLITE_OK;
|
||||
- sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0);
|
||||
+ sqlite3SelectPrep(&sParse, pSelect, 0);
|
||||
rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3WalkSelect(&sWalker, pSelect);
|
||||
@@ -104602,6 +104606,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
|
||||
int i;
|
||||
RenameCtx *p = pWalker->u.pRename;
|
||||
SrcList *pSrc = pSelect->pSrc;
|
||||
+ if( pSelect->selFlags & SF_View ) return WRC_Prune;
|
||||
if( pSrc==0 ){
|
||||
assert( pWalker->pParse->db->mallocFailed );
|
||||
return WRC_Abort;
|
||||
@@ -104681,10 +104686,13 @@ static void renameTableFunc(
|
||||
|
||||
if( pTab->pSelect ){
|
||||
if( isLegacy==0 ){
|
||||
+ Select *pSelect = pTab->pSelect;
|
||||
NameContext sNC;
|
||||
memset(&sNC, 0, sizeof(sNC));
|
||||
sNC.pParse = &sParse;
|
||||
|
||||
+ assert( pSelect->selFlags & SF_View );
|
||||
+ pSelect->selFlags &= ~SF_View;
|
||||
sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
|
||||
if( sParse.nErr ) rc = sParse.rc;
|
||||
sqlite3WalkSelect(&sWalker, pTab->pSelect);
|
||||
@@ -109994,6 +110002,7 @@ SQLITE_PRIVATE void sqlite3CreateView(
|
||||
** allocated rather than point to the input string - which means that
|
||||
** they will persist after the current sqlite3_exec() call returns.
|
||||
*/
|
||||
+ pSelect->selFlags |= SF_View;
|
||||
if( IN_RENAME_OBJECT ){
|
||||
p->pSelect = pSelect;
|
||||
pSelect = 0;
|
||||
--
|
||||
2.21.0 (Apple Git-122.2)
|
||||
|
4
src/3rdparty/sqlite/qt_attribution.json
vendored
4
src/3rdparty/sqlite/qt_attribution.json
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
"Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
|
||||
"Homepage": "https://www.sqlite.org/",
|
||||
"Version": "3.30.1",
|
||||
"DownloadLocation": "https://www.sqlite.org/2019/sqlite-amalgamation-3300100.zip",
|
||||
"Version": "3.31.1",
|
||||
"DownloadLocation": "https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip",
|
||||
"License": "Public Domain",
|
||||
"Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
|
||||
}
|
||||
|
13924
src/3rdparty/sqlite/sqlite3.c
vendored
13924
src/3rdparty/sqlite/sqlite3.c
vendored
File diff suppressed because it is too large
Load Diff
541
src/3rdparty/sqlite/sqlite3.h
vendored
541
src/3rdparty/sqlite/sqlite3.h
vendored
File diff suppressed because it is too large
Load Diff
@ -740,54 +740,66 @@ public class QtNative
|
||||
|
||||
public static boolean hasClipboardText()
|
||||
{
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getText() != null)
|
||||
return true;
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getText() != null)
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String getClipboardText()
|
||||
{
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getText() != null)
|
||||
return primaryClip.getItemAt(i).getText().toString();
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getText() != null)
|
||||
return primaryClip.getItemAt(i).getText().toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static void updatePrimaryClip(ClipData clipData)
|
||||
{
|
||||
if (m_usePrimaryClip) {
|
||||
ClipData clip = m_clipboardManager.getPrimaryClip();
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (m_addItemMethod == null) {
|
||||
Class[] cArg = new Class[2];
|
||||
cArg[0] = ContentResolver.class;
|
||||
cArg[1] = ClipData.Item.class;
|
||||
try {
|
||||
m_addItemMethod = m_clipboardManager.getClass().getMethod("addItem", cArg);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
if (m_usePrimaryClip) {
|
||||
ClipData clip = m_clipboardManager.getPrimaryClip();
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (m_addItemMethod == null) {
|
||||
Class[] cArg = new Class[2];
|
||||
cArg[0] = ContentResolver.class;
|
||||
cArg[1] = ClipData.Item.class;
|
||||
try {
|
||||
m_addItemMethod = m_clipboardManager.getClass().getMethod("addItem", cArg);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_addItemMethod != null) {
|
||||
try {
|
||||
m_addItemMethod.invoke(m_activity.getContentResolver(), clipData.getItemAt(0));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (m_addItemMethod != null) {
|
||||
try {
|
||||
m_addItemMethod.invoke(m_activity.getContentResolver(), clipData.getItemAt(0));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
clip.addItem(clipData.getItemAt(0));
|
||||
}
|
||||
m_clipboardManager.setPrimaryClip(clip);
|
||||
} else {
|
||||
clip.addItem(clipData.getItemAt(0));
|
||||
m_clipboardManager.setPrimaryClip(clipData);
|
||||
m_usePrimaryClip = true;
|
||||
}
|
||||
m_clipboardManager.setPrimaryClip(clip);
|
||||
} else {
|
||||
m_clipboardManager.setPrimaryClip(clipData);
|
||||
m_usePrimaryClip = true;
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to set clipboard data", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,22 +813,30 @@ public class QtNative
|
||||
|
||||
public static boolean hasClipboardHtml()
|
||||
{
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
||||
return true;
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String getClipboardHtml()
|
||||
{
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
||||
return primaryClip.getItemAt(i).getHtmlText().toString();
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
||||
return primaryClip.getItemAt(i).getHtmlText().toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -832,11 +852,15 @@ public class QtNative
|
||||
|
||||
public static boolean hasClipboardUri()
|
||||
{
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getUri() != null)
|
||||
return true;
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getUri() != null)
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -844,11 +868,15 @@ public class QtNative
|
||||
private static String[] getClipboardUris()
|
||||
{
|
||||
ArrayList<String> uris = new ArrayList<String>();
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getUri() != null)
|
||||
uris.add(primaryClip.getItemAt(i).getUri().toString());
|
||||
try {
|
||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||
if (primaryClip.getItemAt(i).getUri() != null)
|
||||
uris.add(primaryClip.getItemAt(i).getUri().toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||
}
|
||||
String[] strings = new String[uris.size()];
|
||||
strings = uris.toArray(strings);
|
||||
|
@ -62,7 +62,7 @@ public class QtActivityLoader extends QtLoader {
|
||||
protected void downloadUpgradeMinistro(String msg) {
|
||||
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity);
|
||||
downloadDialog.setMessage(msg);
|
||||
downloadDialog.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
downloadDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
try {
|
||||
@ -76,7 +76,7 @@ public class QtActivityLoader extends QtLoader {
|
||||
}
|
||||
});
|
||||
|
||||
downloadDialog.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
downloadDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
m_activity.finish();
|
||||
|
@ -385,6 +385,7 @@ qt_extend_target(Core CONDITION WIN32 AND NOT WINRT
|
||||
qt_extend_target(Core CONDITION APPLE
|
||||
SOURCES
|
||||
global/qoperatingsystemversion_darwin.mm
|
||||
io/qfilesystemengine_mac.mm
|
||||
io/qstandardpaths_mac.mm
|
||||
io/qstorageinfo_mac.cpp
|
||||
kernel/qcfsocketnotifier.cpp kernel/qcfsocketnotifier_p.h
|
||||
|
@ -492,6 +492,7 @@ qt_extend_target(Core CONDITION WIN32 AND NOT WINRT
|
||||
qt_extend_target(Core CONDITION APPLE
|
||||
SOURCES
|
||||
global/qoperatingsystemversion_darwin.mm
|
||||
io/qfilesystemengine_mac.mm
|
||||
io/qstandardpaths_mac.mm
|
||||
io/qstorageinfo_mac.cpp
|
||||
kernel/qcfsocketnotifier.cpp kernel/qcfsocketnotifier_p.h
|
||||
|
@ -59,7 +59,14 @@ macro(qt6_make_output_file infile prefix ext outfile )
|
||||
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
|
||||
string(REPLACE ".." "__" _outfile ${_outfile})
|
||||
get_filename_component(outpath ${_outfile} PATH)
|
||||
get_filename_component(_outfile ${_outfile} NAME_WE)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.14")
|
||||
get_filename_component(_outfile_ext ${_outfile} EXT)
|
||||
get_filename_component(_outfile_ext ${_outfile_ext} NAME_WE)
|
||||
get_filename_component(_outfile ${_outfile} NAME_WE)
|
||||
string(APPEND _outfile ${_outfile_ext})
|
||||
else()
|
||||
get_filename_component(_outfile ${_outfile} NAME_WLE)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${outpath})
|
||||
set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
|
||||
endmacro()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
@ -135,7 +135,7 @@ class Employee
|
||||
{
|
||||
public:
|
||||
Employee() {}
|
||||
Employee(const QString &name, const QDate &dateOfBirth);
|
||||
Employee(const QString &name, QDate dateOfBirth);
|
||||
...
|
||||
|
||||
private:
|
||||
|
@ -151,7 +151,7 @@ class Employee
|
||||
{
|
||||
public:
|
||||
Employee() {}
|
||||
Employee(const QString &name, const QDate &dateOfBirth);
|
||||
Employee(const QString &name, QDate dateOfBirth);
|
||||
...
|
||||
|
||||
private:
|
||||
|
@ -61,14 +61,13 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
|
||||
QGridLayout *gridLayout = new QGridLayout;
|
||||
for (int i = 0; i < texts.size(); ++i) {
|
||||
QPushButton *button = new QPushButton(texts[i]);
|
||||
connect(button, &QPushButton::clicked,
|
||||
signalMapper, &QSignalMapper::map);
|
||||
connect(button, &QPushButton::clicked, signalMapper, &QSignalMapper::map);
|
||||
//! [0] //! [1]
|
||||
signalMapper->setMapping(button, texts[i]);
|
||||
gridLayout->addWidget(button, i / 3, i % 3);
|
||||
}
|
||||
|
||||
connect(signalMapper, QOverload<const QString &>::of(&QSignalMapper::mapped),
|
||||
connect(signalMapper, &QSignalMapper::mappedString,
|
||||
//! [1] //! [2]
|
||||
this, &ButtonWidget::clicked);
|
||||
|
||||
|
@ -213,7 +213,7 @@ f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype
|
||||
#undef f16cextern
|
||||
}
|
||||
|
||||
#elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) && (__ARM_FP & 2)
|
||||
static inline bool hasFastF16()
|
||||
{
|
||||
return true;
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if !defined(__F16C__) && !defined(__ARM_FP16_FORMAT_IEEE)
|
||||
#if !defined(__ARM_FP16_FORMAT_IEEE)
|
||||
|
||||
const quint32 qfloat16::mantissatable[2048] = {
|
||||
0,
|
||||
|
@ -1669,14 +1669,34 @@ static bool android_default_message_handler(QtMsgType type,
|
||||
#endif //Q_OS_ANDROID
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static void win_outputDebugString_helper(QStringView message)
|
||||
{
|
||||
const int maxOutputStringLength = 32766;
|
||||
static QBasicMutex m;
|
||||
auto locker = qt_unique_lock(m);
|
||||
// fast path: Avoid string copies if one output is enough
|
||||
if (message.length() <= maxOutputStringLength) {
|
||||
OutputDebugString(reinterpret_cast<const wchar_t *>(message.utf16()));
|
||||
} else {
|
||||
wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1];
|
||||
for (int i = 0; i < message.length(); i += maxOutputStringLength ) {
|
||||
const int length = std::min(message.length() - i, maxOutputStringLength );
|
||||
const int len = message.mid(i, length).toWCharArray(messagePart);
|
||||
Q_ASSERT(len == length);
|
||||
messagePart[len] = 0;
|
||||
OutputDebugString(messagePart);
|
||||
}
|
||||
delete[] messagePart;
|
||||
}
|
||||
}
|
||||
|
||||
static bool win_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message)
|
||||
{
|
||||
if (shouldLogToStderr())
|
||||
return false; // Leave logging up to stderr handler
|
||||
|
||||
QString formattedMessage = qFormatLogMessage(type, context, message);
|
||||
formattedMessage.append(QLatin1Char('\n'));
|
||||
OutputDebugString(reinterpret_cast<const wchar_t *>(formattedMessage.utf16()));
|
||||
const QString formattedMessage = qFormatLogMessage(type, context, message).append('\n');
|
||||
win_outputDebugString_helper(formattedMessage);
|
||||
|
||||
return true; // Prevent further output to stderr
|
||||
}
|
||||
@ -1832,11 +1852,11 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
|
||||
static void qt_message_print(const QString &message)
|
||||
{
|
||||
#if defined(Q_OS_WINRT)
|
||||
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16()));
|
||||
win_outputDebugString_helper(message);
|
||||
return;
|
||||
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
|
||||
if (!shouldLogToStderr()) {
|
||||
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16()));
|
||||
win_outputDebugString_helper(message);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -1249,14 +1249,16 @@ namespace Qt {
|
||||
enum DateFormat {
|
||||
TextDate, // default Qt
|
||||
ISODate, // ISO 8601
|
||||
SystemLocaleDate, // deprecated
|
||||
LocalDate = SystemLocaleDate, // deprecated
|
||||
LocaleDate, // deprecated
|
||||
SystemLocaleShortDate,
|
||||
SystemLocaleLongDate,
|
||||
DefaultLocaleShortDate,
|
||||
DefaultLocaleLongDate,
|
||||
RFC2822Date, // RFC 2822 (+ 850 and 1036 during parsing)
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
SystemLocaleDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
LocalDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale") = 2, // i.e. SystemLocaleDate
|
||||
LocaleDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
SystemLocaleShortDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
SystemLocaleLongDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
DefaultLocaleShortDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
DefaultLocaleLongDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||
#endif
|
||||
RFC2822Date = 8, // RFC 2822 (+ 850 and 1036 during parsing)
|
||||
ISODateWithMs
|
||||
};
|
||||
|
||||
@ -1750,7 +1752,7 @@ namespace Qt {
|
||||
};
|
||||
|
||||
// QTBUG-48701
|
||||
enum ReturnByValue_t { ReturnByValue }; // ### Qt 7: Remove me
|
||||
enum ReturnByValueConstant { ReturnByValue }; // ### Qt 7: Remove me
|
||||
|
||||
#ifndef Q_QDOC
|
||||
// NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
@ -709,26 +709,38 @@
|
||||
|
||||
\value ISODateWithMs \l{ISO 8601} extended format, including milliseconds if applicable.
|
||||
|
||||
\value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used
|
||||
by the \l{QLocale::system()}{operating system}.
|
||||
\value SystemLocaleShortDate \e{This enum value is deprecated and
|
||||
shall be removed in Qt 6.} Use QLocale's methods for converting
|
||||
dates and times to and from strings, with the
|
||||
\l{QLocale::ShortFormat}{short format} of
|
||||
\l{QLocale::system()}{the locale used by the operating system}.
|
||||
|
||||
\value SystemLocaleLongDate The \l{QLocale::LongFormat}{long format} used
|
||||
by the \l{QLocale::system()}{operating system}.
|
||||
\value SystemLocaleLongDate \e{This enum value is deprecated and
|
||||
shall be removed in Qt 6.} Use QLocale's methods for converting
|
||||
dates and times to and from strings, with the
|
||||
\l{QLocale::LongFormat}{long format} of \l{QLocale::system()}{the
|
||||
locale used by the operating system}.
|
||||
|
||||
\value DefaultLocaleShortDate The \l{QLocale::ShortFormat}{short format} specified
|
||||
by the \l{QLocale::setDefault()}{application's locale}.
|
||||
\value DefaultLocaleShortDate \e{This enum value is deprecated and
|
||||
shall be removed in Qt 6.} Use QLocale's methods for converting
|
||||
dates and times to and from strings, with the
|
||||
\l{QLocale::ShortFormat}{short format} of
|
||||
\l{QLocale::setDefault()}{the application's locale}.
|
||||
|
||||
\value DefaultLocaleLongDate The \l{QLocale::LongFormat}{long format} used
|
||||
by the \l{QLocale::setDefault()}{application's locale}.
|
||||
\value DefaultLocaleLongDate \e{This enum value is deprecated and
|
||||
shall be removed in Qt 6.} Use QLocale's methods for converting
|
||||
dates and times to and from strings, with the
|
||||
\l{QLocale::LongFormat}{long format} \l{QLocale::setDefault()}{the
|
||||
application's locale}.
|
||||
|
||||
\value SystemLocaleDate \e{This enum value is deprecated.} Use Qt::SystemLocaleShortDate
|
||||
instead (or Qt::SystemLocaleLongDate if you want long dates).
|
||||
\value SystemLocaleDate \e{This enum value is deprecated and shall
|
||||
be removed in Qt 6.} It is equivalent to SystemLocaleShortDate.
|
||||
|
||||
\value LocaleDate \e{This enum value is deprecated.} Use Qt::DefaultLocaleShortDate
|
||||
instead (or Qt::DefaultLocaleLongDate if you want long dates).
|
||||
\value LocaleDate \e{This enum value is deprecated and shall be
|
||||
removed in Qt 6.} It is equivalent to DefaultLocaleShortDate.
|
||||
|
||||
\value LocalDate \e{This enum value is deprecated.} Use Qt::SystemLocaleShortDate
|
||||
instead (or Qt::SystemLocaleLongDate if you want long dates).
|
||||
\value LocalDate \e{This enum value is deprecated and shall be
|
||||
removed in Qt 6.} It is equivalent to SystemLocaleShortDate.
|
||||
|
||||
\value RFC2822Date \l{RFC 2822}, \l{RFC 850} and \l{RFC 1036} format:
|
||||
either \c{[ddd,] dd MMM yyyy [hh:mm[:ss]][ ±tzoff]}
|
||||
@ -1187,6 +1199,7 @@
|
||||
|
||||
\value WA_StyleSheetTarget Indicates that the widget appearance was modified
|
||||
by a \l{Qt Style Sheets}{style sheet}. WA_StyleSheet will also be set.
|
||||
This value was introduced in Qt 5.12.
|
||||
|
||||
\value WA_TabletTracking Indicates that the widget has tablet
|
||||
tracking enabled. See QWidget::tabletTracking.
|
||||
@ -3321,7 +3334,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qt::ReturnByValue_t
|
||||
\enum Qt::ReturnByValueConstant
|
||||
\since 5.15
|
||||
|
||||
This is a dummy type, designed to help users transition from certain deprecated APIs to their replacement APIs.
|
||||
|
@ -183,7 +183,9 @@ win32 {
|
||||
SOURCES += io/qstorageinfo_mac.cpp
|
||||
qtConfig(processenvironment): \
|
||||
OBJECTIVE_SOURCES += io/qprocess_darwin.mm
|
||||
OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm
|
||||
OBJECTIVE_SOURCES += \
|
||||
io/qstandardpaths_mac.mm \
|
||||
io/qfilesystemengine_mac.mm
|
||||
osx {
|
||||
LIBS += -framework DiskArbitration -framework IOKit
|
||||
} else {
|
||||
|
@ -551,6 +551,66 @@ QFile::remove(const QString &fileName)
|
||||
return QFile(fileName).remove();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Moves the file specified by fileName() to the trash. Returns \c true if successful,
|
||||
and sets the fileName() to the path at which the file can be found within the trash;
|
||||
otherwise returns \c false.
|
||||
|
||||
\note On systems where the system API doesn't report the location of the file in the
|
||||
trash, fileName() will be set to the null string once the file has been moved. On
|
||||
systems that don't have a trash can, this function always returns false.
|
||||
*/
|
||||
bool
|
||||
QFile::moveToTrash()
|
||||
{
|
||||
Q_D(QFile);
|
||||
if (d->fileName.isEmpty() &&
|
||||
!static_cast<QFSFileEngine *>(d->engine())->isUnnamedFile()) {
|
||||
qWarning("QFile::remove: Empty or null file name");
|
||||
return false;
|
||||
}
|
||||
unsetError();
|
||||
close();
|
||||
if (error() == QFile::NoError) {
|
||||
QFileSystemEntry fileEntry(d->fileName);
|
||||
QFileSystemEntry trashEntry;
|
||||
QSystemError error;
|
||||
if (QFileSystemEngine::moveFileToTrash(fileEntry, trashEntry, error)) {
|
||||
setFileName(trashEntry.filePath());
|
||||
unsetError();
|
||||
return true;
|
||||
}
|
||||
d->setError(QFile::RenameError, error.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
\overload
|
||||
|
||||
Moves the file specified by fileName() to the trash. Returns \c true if successful,
|
||||
and sets \a pathInTrash (if provided) to the path at which the file can be found within
|
||||
the trash; otherwise returns \c false.
|
||||
|
||||
\note On systems where the system API doesn't report the path of the file in the
|
||||
trash, \a pathInTrash will be set to the null string once the file has been moved.
|
||||
On systems that don't have a trash can, this function always returns false.
|
||||
*/
|
||||
bool
|
||||
QFile::moveToTrash(const QString &fileName, QString *pathInTrash)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.moveToTrash()) {
|
||||
if (pathInTrash)
|
||||
*pathInTrash = file.fileName();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Renames the file currently specified by fileName() to \a newName.
|
||||
Returns \c true if successful; otherwise returns \c false.
|
||||
|
@ -125,6 +125,9 @@ public:
|
||||
bool remove();
|
||||
static bool remove(const QString &fileName);
|
||||
|
||||
bool moveToTrash();
|
||||
static bool moveToTrash(const QString &fileName, QString *pathInTrash = nullptr);
|
||||
|
||||
bool rename(const QString &newName);
|
||||
static bool rename(const QString &oldName, const QString &newName);
|
||||
|
||||
|
@ -1147,6 +1147,8 @@ bool QFileInfo::isShortcut() const
|
||||
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns \c true if the object points to a junction;
|
||||
otherwise returns \c false.
|
||||
|
||||
|
83
src/corelib/io/qfilesystemengine_mac.mm
Normal file
83
src/corelib/io/qfilesystemengine_mac.mm
Normal file
@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qplatformdefs.h"
|
||||
#include "qfilesystemengine_p.h"
|
||||
#include "qfile.h"
|
||||
#include "qurl.h"
|
||||
|
||||
#include <QtCore/private/qcore_mac_p.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*
|
||||
This implementation does not enable the "put back" option in Finder
|
||||
for the trashed object. The only way to get this is to use Finder automation,
|
||||
which would query the user for permission to access Finder using a modal,
|
||||
blocking dialog - which we definitely can't have in a console application.
|
||||
|
||||
Using Finder would also play the trash sound, which we don't want either in
|
||||
such a core API; applications that want that can play the sound themselves.
|
||||
*/
|
||||
//static
|
||||
bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
||||
QFileSystemEntry &newLocation, QSystemError &error)
|
||||
{
|
||||
#ifdef Q_OS_MACOS // desktop macOS has a trash can
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
QFileInfo info(source.filePath());
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
NSURL *fileurl = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||
NSURL *resultingUrl = nil;
|
||||
NSError *nserror = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
if ([fm trashItemAtURL:fileurl resultingItemURL:&resultingUrl error:&nserror] != YES) {
|
||||
error = QSystemError(nserror.code, QSystemError::NativeError);
|
||||
return false;
|
||||
}
|
||||
newLocation = QFileSystemEntry(QUrl::fromNSURL(resultingUrl).path());
|
||||
return true;
|
||||
#else // watch, tv, iOS don't have a trash can
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -88,7 +88,7 @@ inline bool qIsFilenameBroken(const QFileSystemEntry &entry)
|
||||
Q_RETURN_ON_INVALID_FILENAME("Broken filename passed to function", (result)); \
|
||||
} while (false)
|
||||
|
||||
class QFileSystemEngine
|
||||
class Q_AUTOTEST_EXPORT QFileSystemEngine
|
||||
{
|
||||
public:
|
||||
static bool isCaseSensitive()
|
||||
@ -155,6 +155,7 @@ public:
|
||||
static bool createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||
|
||||
static bool copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||
static bool moveFileToTrash(const QFileSystemEntry &source, QFileSystemEntry &newLocation, QSystemError &error);
|
||||
static bool renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||
static bool renameOverwriteFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||
static bool removeFile(const QFileSystemEntry &entry, QSystemError &error);
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include "qplatformdefs.h"
|
||||
#include "qfilesystemengine_p.h"
|
||||
#include "qfile.h"
|
||||
#include "qstorageinfo.h"
|
||||
#include "qtextstream.h"
|
||||
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
#include <QtCore/private/qcore_unix_p.h>
|
||||
@ -1197,6 +1199,216 @@ bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSy
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_DARWIN
|
||||
/*
|
||||
Implementing as per https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html
|
||||
*/
|
||||
|
||||
// bootstrapped tools don't need this, and we don't want QStorageInfo
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
static QString freeDesktopTrashLocation(const QString &sourcePath)
|
||||
{
|
||||
auto makeTrashDir = [](const QDir &topDir, const QString &trashDir) -> QString {
|
||||
auto ownerPerms = QFileDevice::ReadOwner
|
||||
| QFileDevice::WriteOwner
|
||||
| QFileDevice::ExeOwner;
|
||||
QString targetDir = topDir.filePath(trashDir);
|
||||
if (topDir.mkdir(trashDir))
|
||||
QFile::setPermissions(targetDir, ownerPerms);
|
||||
if (QFileInfo(targetDir).isDir())
|
||||
return targetDir;
|
||||
return QString();
|
||||
};
|
||||
auto isSticky = [](const QFileInfo &fileInfo) -> bool {
|
||||
struct stat st;
|
||||
if (stat(QFile::encodeName(fileInfo.absoluteFilePath()).constData(), &st) == 0)
|
||||
return st.st_mode & S_ISVTX;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
QString trash;
|
||||
const QLatin1String dotTrash(".Trash");
|
||||
const QStorageInfo sourceStorage(sourcePath);
|
||||
const QStorageInfo homeStorage(QDir::home());
|
||||
// We support trashing of files outside the users home partition
|
||||
if (sourceStorage != homeStorage) {
|
||||
QDir topDir(sourceStorage.rootPath());
|
||||
/*
|
||||
Method 1:
|
||||
"An administrator can create an $topdir/.Trash directory. The permissions on this
|
||||
directories should permit all users who can trash files at all to write in it;
|
||||
and the “sticky bit” in the permissions must be set, if the file system supports
|
||||
it.
|
||||
When trashing a file from a non-home partition/device, an implementation
|
||||
(if it supports trashing in top directories) MUST check for the presence
|
||||
of $topdir/.Trash."
|
||||
*/
|
||||
const QString userID = QString::number(::getuid());
|
||||
if (topDir.cd(dotTrash)) {
|
||||
const QFileInfo trashInfo(topDir.path());
|
||||
|
||||
// we MUST check that the sticky bit is set, and that it is not a symlink
|
||||
if (trashInfo.isSymLink()) {
|
||||
// we SHOULD report the failed check to the administrator
|
||||
qCritical("Warning: '%s' is a symlink to '%s'",
|
||||
trashInfo.absoluteFilePath().toLocal8Bit().constData(),
|
||||
trashInfo.symLinkTarget().toLatin1().constData());
|
||||
} else if (!isSticky(trashInfo)) {
|
||||
// we SHOULD report the failed check to the administrator
|
||||
qCritical("Warning: '%s' doesn't have sticky bit set!",
|
||||
trashInfo.absoluteFilePath().toLocal8Bit().constData());
|
||||
} else if (trashInfo.isDir()) {
|
||||
/*
|
||||
"If the directory exists and passes the checks, a subdirectory of the
|
||||
$topdir/.Trash directory is to be used as the user's trash directory
|
||||
for this partition/device. The name of this subdirectory is the numeric
|
||||
identifier of the current user ($topdir/.Trash/$uid).
|
||||
When trashing a file, if this directory does not exist for the current user,
|
||||
the implementation MUST immediately create it, without any warnings or
|
||||
delays for the user."
|
||||
*/
|
||||
trash = makeTrashDir(topDir, userID);
|
||||
}
|
||||
}
|
||||
/*
|
||||
Method 2:
|
||||
"If an $topdir/.Trash directory is absent, an $topdir/.Trash-$uid directory is to be
|
||||
used as the user's trash directory for this device/partition. [...] When trashing a
|
||||
file, if an $topdir/.Trash-$uid directory does not exist, the implementation MUST
|
||||
immediately create it, without any warnings or delays for the user."
|
||||
*/
|
||||
if (trash.isEmpty()) {
|
||||
topDir = QDir(sourceStorage.rootPath());
|
||||
const QString userTrashDir = dotTrash + QLatin1Char('-') + userID;
|
||||
trash = makeTrashDir(topDir, userTrashDir);
|
||||
}
|
||||
}
|
||||
/*
|
||||
"If both (1) and (2) fail [...], the implementation MUST either trash the
|
||||
file into the user's “home trash” or refuse to trash it."
|
||||
|
||||
We trash the file into the user's home trash.
|
||||
*/
|
||||
if (trash.isEmpty()) {
|
||||
QDir topDir = QDir::home();
|
||||
trash = makeTrashDir(topDir, dotTrash);
|
||||
if (!QFileInfo(trash).isDir()) {
|
||||
qWarning("Unable to establish trash directory %s in %s",
|
||||
dotTrash.latin1(), topDir.path().toLocal8Bit().constData());
|
||||
}
|
||||
}
|
||||
|
||||
return trash;
|
||||
}
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
//static
|
||||
bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
||||
QFileSystemEntry &newLocation, QSystemError &error)
|
||||
{
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
Q_UNUSED(source);
|
||||
Q_UNUSED(newLocation);
|
||||
error = QSystemError(ENOSYS, QSystemError::StandardLibraryError);
|
||||
return false;
|
||||
#else
|
||||
const QFileInfo sourceInfo(source.filePath());
|
||||
if (!sourceInfo.exists()) {
|
||||
error = QSystemError(ENOENT, QSystemError::StandardLibraryError);
|
||||
return false;
|
||||
}
|
||||
const QString sourcePath = sourceInfo.absoluteFilePath();
|
||||
|
||||
QDir trashDir(freeDesktopTrashLocation(sourcePath));
|
||||
if (!trashDir.exists())
|
||||
return false;
|
||||
/*
|
||||
"A trash directory contains two subdirectories, named info and files."
|
||||
*/
|
||||
const QLatin1String filesDir("files");
|
||||
const QLatin1String infoDir("info");
|
||||
trashDir.mkdir(filesDir);
|
||||
int savedErrno = errno;
|
||||
trashDir.mkdir(infoDir);
|
||||
if (!savedErrno)
|
||||
savedErrno = errno;
|
||||
if (!trashDir.exists(filesDir) || !trashDir.exists(infoDir)) {
|
||||
error = QSystemError(savedErrno, QSystemError::StandardLibraryError);
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
"The $trash/files directory contains the files and directories that were trashed.
|
||||
The names of files in this directory are to be determined by the implementation;
|
||||
the only limitation is that they must be unique within the directory. Even if a
|
||||
file with the same name and location gets trashed many times, each subsequent
|
||||
trashing must not overwrite a previous copy."
|
||||
*/
|
||||
const QString trashedName = sourceInfo.isDir()
|
||||
? QDir(sourcePath).dirName()
|
||||
: sourceInfo.fileName();
|
||||
QString uniqueTrashedName = QLatin1Char('/') + trashedName;
|
||||
QString infoFileName;
|
||||
int counter = 0;
|
||||
QFile infoFile;
|
||||
auto makeUniqueTrashedName = [trashedName, &counter]() -> QString {
|
||||
++counter;
|
||||
return QString(QLatin1String("/%1-%2"))
|
||||
.arg(trashedName)
|
||||
.arg(counter, 4, 10, QLatin1Char('0'));
|
||||
};
|
||||
do {
|
||||
while (QFile::exists(trashDir.filePath(filesDir) + uniqueTrashedName))
|
||||
uniqueTrashedName = makeUniqueTrashedName();
|
||||
/*
|
||||
"The $trash/info directory contains an "information file" for every file and directory
|
||||
in $trash/files. This file MUST have exactly the same name as the file or directory in
|
||||
$trash/files, plus the extension ".trashinfo"
|
||||
[...]
|
||||
When trashing a file or directory, the implementation MUST create the corresponding
|
||||
file in $trash/info first. Moreover, it MUST try to do this in an atomic fashion,
|
||||
so that if two processes try to trash files with the same filename this will result
|
||||
in two different trash files. On Unix-like systems this is done by generating a
|
||||
filename, and then opening with O_EXCL. If that succeeds the creation was atomic
|
||||
(at least on the same machine), if it fails you need to pick another filename."
|
||||
*/
|
||||
infoFileName = trashDir.filePath(infoDir)
|
||||
+ uniqueTrashedName + QLatin1String(".trashinfo");
|
||||
infoFile.setFileName(infoFileName);
|
||||
if (!infoFile.open(QIODevice::NewOnly | QIODevice::WriteOnly | QIODevice::Text))
|
||||
uniqueTrashedName = makeUniqueTrashedName();
|
||||
} while (!infoFile.isOpen());
|
||||
|
||||
const QString targetPath = trashDir.filePath(filesDir) + uniqueTrashedName;
|
||||
const QFileSystemEntry target(targetPath);
|
||||
|
||||
/*
|
||||
We might fail to rename if source and target are on different file systems.
|
||||
In that case, we don't try further, i.e. copying and removing the original
|
||||
is usually not what the user would expect to happen.
|
||||
*/
|
||||
if (!renameFile(source, target, error)) {
|
||||
infoFile.close();
|
||||
infoFile.remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream out(&infoFile);
|
||||
#if QT_CONFIG(textcodec)
|
||||
out.setCodec("UTF-8");
|
||||
#endif
|
||||
out << "[Trash Info]" << Qt::endl;
|
||||
out << "Path=" << sourcePath << Qt::endl;
|
||||
out << "DeletionDate="
|
||||
<< QDateTime::currentDateTime().toString(QLatin1String("yyyy-MM-ddThh:mm:ss")) << Qt::endl;
|
||||
infoFile.close();
|
||||
|
||||
newLocation = QFileSystemEntry(targetPath);
|
||||
return true;
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
}
|
||||
#endif // Q_OS_DARWIN
|
||||
|
||||
//static
|
||||
bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
|
||||
{
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "qoperatingsystemversion.h"
|
||||
#include "qplatformdefs.h"
|
||||
#include "qsysinfo.h"
|
||||
#include "qscopeguard.h"
|
||||
#include "private/qabstractfileengine_p.h"
|
||||
#include "private/qfsfileengine_p.h"
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
@ -59,6 +60,8 @@
|
||||
#include <objbase.h>
|
||||
#ifndef Q_OS_WINRT
|
||||
# include <shlobj.h>
|
||||
# include <shobjidl.h>
|
||||
# include <shellapi.h>
|
||||
# include <lm.h>
|
||||
# include <accctrl.h>
|
||||
#endif
|
||||
@ -422,6 +425,104 @@ static inline bool getFindData(QString path, WIN32_FIND_DATA &findData)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__IFileOperation_INTERFACE_DEFINED__)
|
||||
class FileOperationProgressSink : public IFileOperationProgressSink
|
||||
{
|
||||
public:
|
||||
FileOperationProgressSink()
|
||||
: ref(1)
|
||||
{}
|
||||
virtual ~FileOperationProgressSink() {}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return ++ref;
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
if (--ref == 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
|
||||
{
|
||||
if (!ppvObject)
|
||||
return E_POINTER;
|
||||
|
||||
*ppvObject = nullptr;
|
||||
|
||||
if (iid == __uuidof(IUnknown)) {
|
||||
*ppvObject = static_cast<IUnknown*>(this);
|
||||
} else if (iid == __uuidof(IFileOperationProgressSink)) {
|
||||
*ppvObject = static_cast<IFileOperationProgressSink*>(this);
|
||||
}
|
||||
|
||||
if (*ppvObject) {
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE StartOperations()
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE FinishOperations(HRESULT)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PreRenameItem(DWORD, IShellItem *, LPCWSTR)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PostRenameItem(DWORD, IShellItem *, LPCWSTR, HRESULT, IShellItem *)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PreMoveItem(DWORD, IShellItem *, IShellItem *, LPCWSTR)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PostMoveItem(DWORD, IShellItem *, IShellItem *, LPCWSTR, HRESULT,
|
||||
IShellItem *)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PreCopyItem(DWORD, IShellItem *, IShellItem *, LPCWSTR )
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PostCopyItem(DWORD, IShellItem *, IShellItem *, LPCWSTR, HRESULT,
|
||||
IShellItem *)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PreDeleteItem(DWORD dwFlags, IShellItem *)
|
||||
{
|
||||
// stop the operation if the file will be deleted rather than trashed
|
||||
return (dwFlags & TSF_DELETE_RECYCLE_IF_POSSIBLE) ? S_OK : E_FAIL;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE PostDeleteItem(DWORD /* dwFlags */, IShellItem * /* psiItem */,
|
||||
HRESULT /* hrDelete */, IShellItem *psiNewlyCreated)
|
||||
{
|
||||
if (psiNewlyCreated) {
|
||||
wchar_t *pszName = nullptr;
|
||||
psiNewlyCreated->GetDisplayName(SIGDN_FILESYSPATH, &pszName);
|
||||
if (pszName) {
|
||||
targetPath = QString::fromWCharArray(pszName);
|
||||
CoTaskMemFree(pszName);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE PreNewItem(DWORD, IShellItem *, LPCWSTR)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PostNewItem(DWORD, IShellItem *, LPCWSTR, LPCWSTR, DWORD, HRESULT,
|
||||
IShellItem *)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE UpdateProgress(UINT,UINT)
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE ResetTimer()
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE PauseTimer()
|
||||
{ return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE ResumeTimer()
|
||||
{ return S_OK; }
|
||||
|
||||
QString targetPath;
|
||||
private:
|
||||
ULONG ref;
|
||||
};
|
||||
#endif
|
||||
|
||||
bool QFileSystemEngine::uncListSharesOnServer(const QString &server, QStringList *list)
|
||||
{
|
||||
DWORD res = ERROR_NOT_SUPPORTED;
|
||||
@ -1431,6 +1532,103 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
If possible, we use the IFileOperation implementation, which allows us to determine
|
||||
the location of the object in the trash.
|
||||
If not (likely on mingw), we fall back to the old API, which won't allow us to know
|
||||
that.
|
||||
*/
|
||||
//static
|
||||
bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source,
|
||||
QFileSystemEntry &newLocation, QSystemError &error)
|
||||
{
|
||||
#ifndef Q_OS_WINRT
|
||||
// we need the "display name" of the file, so can't use nativeFilePath
|
||||
const QString sourcePath = QDir::toNativeSeparators(source.filePath());
|
||||
|
||||
/*
|
||||
Windows 7 insists on showing confirmation dialogs and ignores the respective
|
||||
flags set on IFileOperation. Fall back to SHFileOperation, even if it doesn't
|
||||
give us the new location of the file.
|
||||
*/
|
||||
if (QOperatingSystemVersion::current() > QOperatingSystemVersion::Windows7) {
|
||||
# if defined(__IFileOperation_INTERFACE_DEFINED__)
|
||||
CoInitialize(NULL);
|
||||
IFileOperation *pfo = nullptr;
|
||||
IShellItem *deleteItem = nullptr;
|
||||
FileOperationProgressSink *sink = nullptr;
|
||||
HRESULT hres = E_FAIL;
|
||||
|
||||
auto coUninitialize = qScopeGuard([&](){
|
||||
if (sink)
|
||||
sink->Release();
|
||||
if (deleteItem)
|
||||
deleteItem->Release();
|
||||
if (pfo)
|
||||
pfo->Release();
|
||||
CoUninitialize();
|
||||
if (!SUCCEEDED(hres))
|
||||
error = QSystemError(hres, QSystemError::NativeError);
|
||||
});
|
||||
|
||||
hres = CoCreateInstance(CLSID_FileOperation, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&pfo));
|
||||
if (!pfo)
|
||||
return false;
|
||||
pfo->SetOperationFlags(FOF_ALLOWUNDO | FOFX_RECYCLEONDELETE | FOF_NOCONFIRMATION
|
||||
| FOF_SILENT | FOF_NOERRORUI);
|
||||
hres = SHCreateItemFromParsingName(reinterpret_cast<const wchar_t*>(sourcePath.utf16()),
|
||||
nullptr, IID_PPV_ARGS(&deleteItem));
|
||||
if (!deleteItem)
|
||||
return false;
|
||||
sink = new FileOperationProgressSink;
|
||||
hres = pfo->DeleteItem(deleteItem, static_cast<IFileOperationProgressSink*>(sink));
|
||||
if (!SUCCEEDED(hres))
|
||||
return false;
|
||||
hres = pfo->PerformOperations();
|
||||
if (!SUCCEEDED(hres))
|
||||
return false;
|
||||
newLocation = QFileSystemEntry(sink->targetPath);
|
||||
|
||||
# endif // no IFileOperation in SDK (mingw, likely) - fall back to SHFileOperation
|
||||
} else {
|
||||
// double null termination needed, so can't use QString::utf16
|
||||
QVarLengthArray<wchar_t, MAX_PATH + 1> winFile(sourcePath.length() + 2);
|
||||
sourcePath.toWCharArray(winFile.data());
|
||||
winFile[sourcePath.length()] = wchar_t{};
|
||||
winFile[sourcePath.length() + 1] = wchar_t{};
|
||||
|
||||
SHFILEOPSTRUCTW operation;
|
||||
operation.hwnd = nullptr;
|
||||
operation.wFunc = FO_DELETE;
|
||||
operation.pFrom = winFile.constData();
|
||||
operation.pTo = nullptr;
|
||||
operation.fFlags = FOF_ALLOWUNDO | FOF_NO_UI;
|
||||
operation.fAnyOperationsAborted = FALSE;
|
||||
operation.hNameMappings = nullptr;
|
||||
operation.lpszProgressTitle = nullptr;
|
||||
|
||||
int result = SHFileOperation(&operation);
|
||||
if (result != 0) {
|
||||
error = QSystemError(result, QSystemError::NativeError);
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
This implementation doesn't let us know where the file ended up, even if
|
||||
we would specify FOF_WANTMAPPINGHANDLE | FOF_RENAMEONCOLLISION, as
|
||||
FOF_RENAMEONCOLLISION has no effect unless files are moved, copied, or renamed.
|
||||
*/
|
||||
Q_UNUSED(newLocation);
|
||||
}
|
||||
return true;
|
||||
|
||||
#else // Q_OS_WINRT
|
||||
Q_UNUSED(source);
|
||||
Q_UNUSED(newLocation);
|
||||
Q_UNUSED(error);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//static
|
||||
bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error,
|
||||
QFileSystemMetaData *data)
|
||||
|
@ -714,7 +714,7 @@ void QIODevicePrivate::setReadChannelCount(int count)
|
||||
/*!
|
||||
\since 5.7
|
||||
|
||||
Returns the the index of the current write channel.
|
||||
Returns the index of the current write channel.
|
||||
|
||||
\sa setCurrentWriteChannel(), writeChannelCount()
|
||||
*/
|
||||
|
@ -58,7 +58,8 @@
|
||||
#include <sys/file.h> // flock
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_RTEMS)
|
||||
#if defined(Q_OS_RTEMS) || defined(Q_OS_QNX)
|
||||
// flock() does not work in these OSes and produce warnings when we try to use
|
||||
# undef LOCK_EX
|
||||
# undef LOCK_NB
|
||||
#endif
|
||||
|
@ -60,6 +60,7 @@
|
||||
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
|
||||
# include <mntent.h>
|
||||
# include <sys/statvfs.h>
|
||||
# include <sys/sysmacros.h>
|
||||
#elif defined(Q_OS_SOLARIS)
|
||||
# include <sys/mnttab.h>
|
||||
# include <sys/statvfs.h>
|
||||
@ -152,7 +153,7 @@ private:
|
||||
//(2) parent ID: the ID of the parent mount (or of self for the top of the mount tree).
|
||||
// int parent_id;
|
||||
//(3) major:minor: the value of st_dev for files on this filesystem (see stat(2)).
|
||||
// dev_t rdev;
|
||||
dev_t rdev;
|
||||
//(4) root: the pathname of the directory in the filesystem which forms the root of this mount.
|
||||
char *subvolume;
|
||||
//(5) mount point: the pathname of the mount point relative to the process's root directory.
|
||||
@ -503,8 +504,7 @@ inline bool QStorageIterator::next()
|
||||
int rdevminor = qstrtoll(ptr + 1, const_cast<const char **>(&ptr), 10, &ok);
|
||||
if (!ptr || !ok)
|
||||
return false;
|
||||
Q_UNUSED(rdevmajor);
|
||||
Q_UNUSED(rdevminor);
|
||||
mnt.rdev = makedev(rdevmajor, rdevminor);
|
||||
|
||||
if (*ptr != ' ')
|
||||
return false;
|
||||
@ -566,6 +566,21 @@ inline QByteArray QStorageIterator::fileSystemType() const
|
||||
|
||||
inline QByteArray QStorageIterator::device() const
|
||||
{
|
||||
// check that the device exists
|
||||
if (mnt.mnt_fsname[0] == '/' && access(mnt.mnt_fsname, F_OK) != 0) {
|
||||
// It doesn't, so let's try to resolve the dev_t from /dev/block.
|
||||
// Note how strlen("4294967295") == digits10 + 1, so we need to add 1
|
||||
// for each number, plus the ':'.
|
||||
char buf[sizeof("/dev/block/") + 2 * std::numeric_limits<unsigned>::digits10 + 3];
|
||||
QByteArray dev(PATH_MAX, Qt::Uninitialized);
|
||||
char *devdata = dev.data();
|
||||
|
||||
snprintf(buf, sizeof(buf), "/dev/block/%u:%u", major(mnt.rdev), minor(mnt.rdev));
|
||||
if (realpath(buf, devdata)) {
|
||||
dev.truncate(strlen(devdata));
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
return QByteArray(mnt.mnt_fsname);
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@
|
||||
#include "qhash.h"
|
||||
#include "qdir.h" // for QDir::fromNativeSeparators
|
||||
#include "qdatastream.h"
|
||||
#if QT_CONFIG(topleveldomain)
|
||||
#if QT_CONFIG(topleveldomain) // ### Qt6: Remove section
|
||||
#include "qtldurl_p.h"
|
||||
#endif
|
||||
#include "private/qipaddress_p.h"
|
||||
@ -3149,10 +3149,13 @@ bool QUrl::hasFragment() const
|
||||
return d->hasFragment();
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
#if QT_CONFIG(topleveldomain)
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
\deprecated
|
||||
|
||||
Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net).
|
||||
Note that the return value is prefixed with a '.' unless the
|
||||
URL does not contain a valid TLD, in which case the function returns
|
||||
@ -3185,7 +3188,7 @@ QString QUrl::topLevelDomain(ComponentFormattingOptions options) const
|
||||
return tld;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
Returns the result of the merge of this URL with \a relative. This
|
||||
URL is used as a base to convert \a relative to an absolute URL.
|
||||
|
@ -233,9 +233,11 @@ public:
|
||||
|
||||
void setHost(const QString &host, ParsingMode mode = DecodedMode);
|
||||
QString host(ComponentFormattingOptions = FullyDecoded) const;
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
#if QT_CONFIG(topleveldomain)
|
||||
QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const;
|
||||
QT_DEPRECATED QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const;
|
||||
#endif
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
void setPort(int port);
|
||||
int port(int defaultPort = -1) const;
|
||||
|
@ -108,6 +108,9 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
|
||||
It is good practice to check that persistent model indexes are valid
|
||||
before using them.
|
||||
|
||||
\note You cannot store a QStandardItemModel's QPersistentModelIndex
|
||||
in one of the model's items.
|
||||
|
||||
\sa {Model/View Programming}, QModelIndex, QAbstractItemModel
|
||||
*/
|
||||
|
||||
|
@ -247,7 +247,7 @@ AppleApplication *qt_apple_sharedApplication()
|
||||
qWarning() << "accessing the shared" << [AppleApplication class]
|
||||
<< "is not allowed in application extensions";
|
||||
|
||||
// In practice the application is actually available, but the the App
|
||||
// In practice the application is actually available, but the App
|
||||
// review process will likely catch uses of it, so we return nil just
|
||||
// in case, unless we don't care about being App Store compliant.
|
||||
#if QT_CONFIG(appstore_compliant)
|
||||
|
@ -988,6 +988,30 @@ enum IteratorCapability
|
||||
RandomAccessCapability = 4
|
||||
};
|
||||
|
||||
enum ContainerCapability
|
||||
{
|
||||
ContainerIsAppendable = 1
|
||||
};
|
||||
|
||||
template<typename Container, typename T = void>
|
||||
struct ContainerCapabilitiesImpl
|
||||
{
|
||||
enum {ContainerCapabilities = 0};
|
||||
using appendFunction = void(*)(const void *container, const void *newElement);
|
||||
static constexpr const appendFunction appendImpl = nullptr;
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
struct ContainerCapabilitiesImpl<Container, decltype(std::declval<Container>().push_back(std::declval<typename Container::value_type>()))>
|
||||
{
|
||||
enum {ContainerCapabilities = ContainerIsAppendable};
|
||||
|
||||
// The code below invokes undefined behavior if and only if the pointer passed into QSequentialIterableImpl
|
||||
// pointed to a const object to begin with
|
||||
static void appendImpl(const void *container, const void *value)
|
||||
{ static_cast<Container *>(const_cast<void *>(container))->push_back(*static_cast<const typename Container::value_type *>(value)); }
|
||||
};
|
||||
|
||||
template<typename T, typename Category = typename std::iterator_traits<typename T::const_iterator>::iterator_category>
|
||||
struct CapabilitiesImpl;
|
||||
|
||||
@ -1019,6 +1043,12 @@ template<typename T>
|
||||
struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> >
|
||||
{ static int size(const std::list<T> *t) { return int(t->size()); } };
|
||||
|
||||
/*
|
||||
revision 0: _iteratorCapabilities is simply a uint, where the bits at _revision were never set
|
||||
revision 1: _iteratorCapabilties is treated as a bitfield, the remaining bits are used to introduce
|
||||
_revision, _containerCapabilities and _unused. The latter contains 21 bits that are
|
||||
not used yet
|
||||
*/
|
||||
class QSequentialIterableImpl
|
||||
{
|
||||
public:
|
||||
@ -1027,19 +1057,37 @@ public:
|
||||
int _metaType_id;
|
||||
uint _metaType_flags;
|
||||
uint _iteratorCapabilities;
|
||||
// Iterator capabilities looks actually like
|
||||
// uint _iteratorCapabilities:4;
|
||||
// uint _revision:3;
|
||||
// uint _containerCapabilities:4;
|
||||
// uint _unused:21;*/
|
||||
typedef int(*sizeFunc)(const void *p);
|
||||
typedef const void * (*atFunc)(const void *p, int);
|
||||
typedef void (*moveIteratorFunc)(const void *p, void **);
|
||||
enum Position { ToBegin, ToEnd };
|
||||
typedef void (*moveIteratorFunc2)(const void *p, void **, Position position);
|
||||
typedef void (*advanceFunc)(void **p, int);
|
||||
typedef VariantData (*getFunc)( void * const *p, int metaTypeId, uint flags);
|
||||
typedef void (*destroyIterFunc)(void **p);
|
||||
typedef bool (*equalIterFunc)(void * const *p, void * const *other);
|
||||
typedef void (*copyIterFunc)(void **, void * const *);
|
||||
typedef void(*appendFunction)(const void *container, const void *newElement);
|
||||
|
||||
IteratorCapability iteratorCapabilities() {return static_cast<IteratorCapability>(_iteratorCapabilities & 0xF);}
|
||||
uint revision() {return _iteratorCapabilities >> 4 & 0x7;}
|
||||
uint containerCapabilities() {return _iteratorCapabilities >> 7 & 0xF;}
|
||||
|
||||
sizeFunc _size;
|
||||
atFunc _at;
|
||||
moveIteratorFunc _moveToBegin;
|
||||
moveIteratorFunc _moveToEnd;
|
||||
union {
|
||||
moveIteratorFunc _moveToBegin;
|
||||
moveIteratorFunc2 _moveTo;
|
||||
};
|
||||
union {
|
||||
moveIteratorFunc _moveToEnd;
|
||||
appendFunction _append;
|
||||
};
|
||||
advanceFunc _advance;
|
||||
getFunc _get;
|
||||
destroyIterFunc _destroyIter;
|
||||
@ -1066,6 +1114,15 @@ public:
|
||||
static void moveToEndImpl(const void *container, void **iterator)
|
||||
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->end()); }
|
||||
|
||||
template<class Container>
|
||||
static void moveToImpl(const void *container, void **iterator, Position position)
|
||||
{
|
||||
if (position == ToBegin)
|
||||
moveToBeginImpl<Container>(container, iterator);
|
||||
else
|
||||
moveToEndImpl<Container>(container, iterator);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
|
||||
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
|
||||
@ -1076,11 +1133,11 @@ public:
|
||||
, _iterator(nullptr)
|
||||
, _metaType_id(qMetaTypeId<typename T::value_type>())
|
||||
, _metaType_flags(QTypeInfo<typename T::value_type>::isPointer)
|
||||
, _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities)
|
||||
, _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities | (1 << 4) | (ContainerCapabilitiesImpl<T>::ContainerCapabilities << (4+3)))
|
||||
, _size(sizeImpl<T>)
|
||||
, _at(atImpl<T>)
|
||||
, _moveToBegin(moveToBeginImpl<T>)
|
||||
, _moveToEnd(moveToEndImpl<T>)
|
||||
, _moveTo(moveToImpl<T>)
|
||||
, _append(ContainerCapabilitiesImpl<T>::appendImpl)
|
||||
, _advance(IteratorOwner<typename T::const_iterator>::advance)
|
||||
, _get(getImpl<T>)
|
||||
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
|
||||
@ -1094,7 +1151,7 @@ public:
|
||||
, _iterator(nullptr)
|
||||
, _metaType_id(QMetaType::UnknownType)
|
||||
, _metaType_flags(0)
|
||||
, _iteratorCapabilities(0)
|
||||
, _iteratorCapabilities(0 | (1 << 4) ) // no iterator capabilities, revision 1
|
||||
, _size(nullptr)
|
||||
, _at(nullptr)
|
||||
, _moveToBegin(nullptr)
|
||||
@ -1107,8 +1164,18 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
inline void moveToBegin() { _moveToBegin(_iterable, &_iterator); }
|
||||
inline void moveToEnd() { _moveToEnd(_iterable, &_iterator); }
|
||||
inline void moveToBegin() {
|
||||
if (revision() == 0)
|
||||
_moveToBegin(_iterable, &_iterator);
|
||||
else
|
||||
_moveTo(_iterable, &_iterator, ToBegin);
|
||||
}
|
||||
inline void moveToEnd() {
|
||||
if (revision() == 0)
|
||||
_moveToEnd(_iterable, &_iterator);
|
||||
else
|
||||
_moveTo(_iterable, &_iterator, ToEnd);
|
||||
}
|
||||
inline bool equal(const QSequentialIterableImpl&other) const { return _equalIter(&_iterator, &other._iterator); }
|
||||
inline QSequentialIterableImpl &advance(int i) {
|
||||
Q_ASSERT(i > 0 || _iteratorCapabilities & BiDirectionalCapability);
|
||||
@ -1116,6 +1183,11 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void append(const void *newElement) {
|
||||
if (containerCapabilities() & ContainerIsAppendable)
|
||||
_append(_iterable, newElement);
|
||||
}
|
||||
|
||||
inline VariantData getCurrent() const { return _get(&_iterator, _metaType_id, _metaType_flags); }
|
||||
|
||||
VariantData at(int idx) const
|
||||
|
@ -72,40 +72,44 @@ public:
|
||||
|
||||
QVariant retrieveTypedData(const QString &format, QMetaType::Type type) const;
|
||||
|
||||
QVector<QMimeDataStruct> dataList;
|
||||
std::vector<QMimeDataStruct>::iterator find(const QString &format) noexcept {
|
||||
const auto formatEquals = [](const QString &format) {
|
||||
return [&format](const QMimeDataStruct &s) { return s.format == format; };
|
||||
};
|
||||
return std::find_if(dataList.begin(), dataList.end(), formatEquals(format));
|
||||
}
|
||||
|
||||
std::vector<QMimeDataStruct>::const_iterator find(const QString &format) const noexcept {
|
||||
return const_cast<QMimeDataPrivate*>(this)->find(format);
|
||||
}
|
||||
|
||||
std::vector<QMimeDataStruct> dataList;
|
||||
};
|
||||
|
||||
void QMimeDataPrivate::removeData(const QString &format)
|
||||
{
|
||||
for (int i=0; i<dataList.size(); i++) {
|
||||
if (dataList.at(i).format == format) {
|
||||
dataList.removeAt(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const auto it = find(format);
|
||||
if (it != dataList.end())
|
||||
dataList.erase(it);
|
||||
}
|
||||
|
||||
void QMimeDataPrivate::setData(const QString &format, const QVariant &data)
|
||||
{
|
||||
// remove it first if the format is already here.
|
||||
removeData(format);
|
||||
QMimeDataStruct mimeData;
|
||||
mimeData.format = format;
|
||||
mimeData.data = data;
|
||||
dataList += mimeData;
|
||||
const auto it = find(format);
|
||||
if (it == dataList.end())
|
||||
dataList.push_back({format, data});
|
||||
else
|
||||
it->data = data;
|
||||
}
|
||||
|
||||
|
||||
QVariant QMimeDataPrivate::getData(const QString &format) const
|
||||
{
|
||||
QVariant data;
|
||||
for (int i=0; i<dataList.size(); i++) {
|
||||
if (dataList.at(i).format == format) {
|
||||
data = dataList.at(i).data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
const auto it = find(format);
|
||||
if (it == dataList.cend())
|
||||
return {};
|
||||
else
|
||||
return it->data;
|
||||
}
|
||||
|
||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const
|
||||
@ -635,10 +639,9 @@ QStringList QMimeData::formats() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QStringList list;
|
||||
const int size = d->dataList.size();
|
||||
list.reserve(size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
list += d->dataList.at(i).format;
|
||||
list.reserve(static_cast<int>(d->dataList.size()));
|
||||
for (auto &e : d->dataList)
|
||||
list += e.format;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,36 @@ public:
|
||||
Q_Q(QSignalMapper);
|
||||
q->removeMappings(q->sender());
|
||||
}
|
||||
|
||||
template <class Signal, class Container>
|
||||
void emitMappedValue(QObject *sender, Signal signal, const Container &mappedValues)
|
||||
{
|
||||
Q_Q(QSignalMapper);
|
||||
|
||||
auto it = mappedValues.find(sender);
|
||||
if (it != mappedValues.end()) {
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
Q_EMIT q->mapped(*it);
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
Q_EMIT (q->*signal)(*it);
|
||||
}
|
||||
}
|
||||
|
||||
void emitMappedValues(QObject *sender)
|
||||
{
|
||||
emitMappedValue(sender, &QSignalMapper::mappedInt, intHash);
|
||||
emitMappedValue(sender, &QSignalMapper::mappedString, stringHash);
|
||||
emitMappedValue(sender, &QSignalMapper::mappedWidget, widgetHash);
|
||||
emitMappedValue(sender, &QSignalMapper::mappedObject, objectHash);
|
||||
}
|
||||
|
||||
QHash<QObject *, int> intHash;
|
||||
QHash<QObject *, QString> stringHash;
|
||||
QHash<QObject *, QWidget*> widgetHash;
|
||||
QHash<QObject *, QObject*> objectHash;
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -74,11 +99,12 @@ public:
|
||||
use lambdas for passing custom parameters to slots. This is less
|
||||
costly and will simplify the code.
|
||||
|
||||
The class supports the mapping of particular strings or integers
|
||||
with particular objects using setMapping(). The objects' signals
|
||||
can then be connected to the map() slot which will emit the
|
||||
mapped() signal with the string or integer associated with the
|
||||
original signalling object. Mappings can be removed later using
|
||||
The class supports the mapping of particular strings, integers,
|
||||
objects and widgets with particular objects using setMapping().
|
||||
The objects' signals can then be connected to the map() slot which
|
||||
will emit a signal (it could be mappedInt(), mappedString(),
|
||||
mappedWidget() and mappedObject()) with a value associated with
|
||||
the original signalling object. Mappings can be removed later using
|
||||
removeMappings().
|
||||
|
||||
Example: Suppose we want to create a custom widget that contains
|
||||
@ -106,8 +132,8 @@ public:
|
||||
created. We connect each button's \c clicked() signal to the
|
||||
signal mapper's map() slot, and create a mapping in the signal
|
||||
mapper from each button to the button's text. Finally we connect
|
||||
the signal mapper's mapped() signal to the custom widget's \c
|
||||
clicked() signal. When the user clicks a button, the custom
|
||||
the signal mapper's mappedString() signal to the custom widget's
|
||||
\c clicked() signal. When the user clicks a button, the custom
|
||||
widget will emit a single \c clicked() signal whose argument is
|
||||
the text of the button the user clicked.
|
||||
|
||||
@ -137,7 +163,7 @@ QSignalMapper::~QSignalMapper()
|
||||
|
||||
/*!
|
||||
Adds a mapping so that when map() is signalled from the given \a
|
||||
sender, the signal mapped(\a id) is emitted.
|
||||
sender, the signal mappedInt(\a id) is emitted.
|
||||
|
||||
There may be at most one integer ID for each sender.
|
||||
|
||||
@ -152,7 +178,7 @@ void QSignalMapper::setMapping(QObject *sender, int id)
|
||||
|
||||
/*!
|
||||
Adds a mapping so that when map() is signalled from the \a sender,
|
||||
the signal mapped(\a text ) is emitted.
|
||||
the signal mappedString(\a text ) is emitted.
|
||||
|
||||
There may be at most one text for each sender.
|
||||
*/
|
||||
@ -165,7 +191,7 @@ void QSignalMapper::setMapping(QObject *sender, const QString &text)
|
||||
|
||||
/*!
|
||||
Adds a mapping so that when map() is signalled from the \a sender,
|
||||
the signal mapped(\a widget ) is emitted.
|
||||
the signal mappedWidget(\a widget ) is emitted.
|
||||
|
||||
There may be at most one widget for each sender.
|
||||
*/
|
||||
@ -178,7 +204,7 @@ void QSignalMapper::setMapping(QObject *sender, QWidget *widget)
|
||||
|
||||
/*!
|
||||
Adds a mapping so that when map() is signalled from the \a sender,
|
||||
the signal mapped(\a object ) is emitted.
|
||||
the signal mappedObject(\a object ) is emitted.
|
||||
|
||||
There may be at most one object for each sender.
|
||||
*/
|
||||
@ -259,20 +285,14 @@ void QSignalMapper::map() { map(sender()); }
|
||||
*/
|
||||
void QSignalMapper::map(QObject *sender)
|
||||
{
|
||||
Q_D(QSignalMapper);
|
||||
if (d->intHash.contains(sender))
|
||||
emit mapped(d->intHash.value(sender));
|
||||
if (d->stringHash.contains(sender))
|
||||
emit mapped(d->stringHash.value(sender));
|
||||
if (d->widgetHash.contains(sender))
|
||||
emit mapped(d->widgetHash.value(sender));
|
||||
if (d->objectHash.contains(sender))
|
||||
emit mapped(d->objectHash.value(sender));
|
||||
d_func()->emitMappedValues(sender);
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\fn void QSignalMapper::mapped(int i)
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has an integer mapping set. The object's mapped integer is passed
|
||||
@ -283,6 +303,8 @@ void QSignalMapper::map(QObject *sender)
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mapped(const QString &text)
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has a string mapping set. The object's mapped string is passed in
|
||||
@ -293,6 +315,8 @@ void QSignalMapper::map(QObject *sender)
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mapped(QWidget *widget)
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has a widget mapping set. The object's mapped widget is passed in
|
||||
@ -303,6 +327,53 @@ void QSignalMapper::map(QObject *sender)
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mapped(QObject *object)
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has an object mapping set. The object provided by the map is passed in
|
||||
\a object.
|
||||
|
||||
\sa setMapping()
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mappedInt(int i)
|
||||
\since 5.15
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has an integer mapping set. The object's mapped integer is passed
|
||||
in \a i.
|
||||
|
||||
\sa setMapping()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mappedString(const QString &text)
|
||||
\since 5.15
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has a string mapping set. The object's mapped string is passed in
|
||||
\a text.
|
||||
|
||||
\sa setMapping()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mappedWidget(QWidget *widget)
|
||||
\since 5.15
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has a widget mapping set. The object's mapped widget is passed in
|
||||
\a widget.
|
||||
|
||||
\sa setMapping()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSignalMapper::mappedObject(QObject *object)
|
||||
\since 5.15
|
||||
|
||||
This signal is emitted when map() is signalled from an object that
|
||||
has an object mapping set. The object provided by the map is passed in
|
||||
|
@ -66,10 +66,20 @@ public:
|
||||
QObject *mapping(QObject *object) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedInt(int) instead")
|
||||
void mapped(int);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedString(const QString&) instead")
|
||||
void mapped(const QString &);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedWidget(QWidget *) instead")
|
||||
void mapped(QWidget *);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedObject(QObject *) instead")
|
||||
void mapped(QObject *);
|
||||
#endif
|
||||
void mappedInt(int);
|
||||
void mappedString(const QString &);
|
||||
void mappedWidget(QWidget *);
|
||||
void mappedObject(QObject *);
|
||||
|
||||
public Q_SLOTS:
|
||||
void map();
|
||||
|
@ -283,7 +283,7 @@ class QTranslatorPrivate : public QObjectPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QTranslator)
|
||||
public:
|
||||
enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96 };
|
||||
enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96, Language = 0xa7 };
|
||||
|
||||
QTranslatorPrivate() :
|
||||
#if defined(QT_USE_MMAP)
|
||||
@ -316,6 +316,9 @@ public:
|
||||
uint contextLength;
|
||||
uint numerusRulesLength;
|
||||
|
||||
QString language;
|
||||
QString filePath;
|
||||
|
||||
bool do_load(const QString &filename, const QString &directory);
|
||||
bool do_load(const uchar *data, qsizetype len, const QString &directory);
|
||||
QString do_translate(const char *context, const char *sourceText, const char *comment,
|
||||
@ -597,8 +600,10 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
|
||||
}
|
||||
}
|
||||
|
||||
if (ok && d->do_load(reinterpret_cast<const uchar *>(d->unmapPointer), d->unmapLength, directory))
|
||||
if (ok && d->do_load(reinterpret_cast<const uchar *>(d->unmapPointer), d->unmapLength, directory)) {
|
||||
d->filePath = realname;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(QT_USE_MMAP)
|
||||
if (used_mmap) {
|
||||
@ -829,7 +834,9 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
|
||||
break;
|
||||
}
|
||||
|
||||
if (tag == QTranslatorPrivate::Contexts) {
|
||||
if (tag == QTranslatorPrivate::Language) {
|
||||
language = QString::fromUtf8((const char*)data, blockLen);
|
||||
} else if (tag == QTranslatorPrivate::Contexts) {
|
||||
contextArray = data;
|
||||
contextLength = blockLen;
|
||||
} else if (tag == QTranslatorPrivate::Hashes) {
|
||||
@ -1091,6 +1098,9 @@ void QTranslatorPrivate::clear()
|
||||
qDeleteAll(subTranslators);
|
||||
subTranslators.clear();
|
||||
|
||||
language.clear();
|
||||
filePath.clear();
|
||||
|
||||
if (QCoreApplicationPrivate::isTranslatorInstalled(q))
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(),
|
||||
new QEvent(QEvent::LanguageChange));
|
||||
@ -1132,6 +1142,32 @@ bool QTranslator::isEmpty() const
|
||||
&& d->subTranslators.isEmpty();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the target language as stored in the translation file.
|
||||
*/
|
||||
QString QTranslator::language() const
|
||||
{
|
||||
Q_D(const QTranslator);
|
||||
return d->language;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the path of the loaded translation file.
|
||||
|
||||
The file path is empty if no translation was loaded yet,
|
||||
the loading failed, or if the translation was not loaded
|
||||
from a file.
|
||||
*/
|
||||
QString QTranslator::filePath() const
|
||||
{
|
||||
Q_D(const QTranslator);
|
||||
return d->filePath;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qtranslator.cpp"
|
||||
|
@ -63,6 +63,9 @@ public:
|
||||
|
||||
virtual bool isEmpty() const;
|
||||
|
||||
QString language() const;
|
||||
QString filePath() const;
|
||||
|
||||
bool load(const QString & filename,
|
||||
const QString & directory = QString(),
|
||||
const QString & search_delimiters = QString(),
|
||||
|
@ -662,7 +662,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
|
||||
# endif
|
||||
#endif
|
||||
case QMetaType::QDate:
|
||||
*dt = QDateTime(*v_cast<QDate>(d));
|
||||
*dt = v_cast<QDate>(d)->startOfDay();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@ -1229,7 +1229,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
|
||||
*static_cast<QCborValue *>(result) = *v_cast<QByteArray>(d);
|
||||
break;
|
||||
case QMetaType::QDate:
|
||||
*static_cast<QCborValue *>(result) = QCborValue(QDateTime(*v_cast<QDate>(d)));
|
||||
*static_cast<QCborValue *>(result) = QCborValue(v_cast<QDate>(d)->startOfDay());
|
||||
break;
|
||||
case QMetaType::QDateTime:
|
||||
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QDateTime>(d));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2018 Intel Corporation
|
||||
** Copyright (C) 2020 Intel Corporation
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -218,6 +218,8 @@ bool QLibraryPrivate::load_sys()
|
||||
for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
|
||||
if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
|
||||
continue;
|
||||
if (path.isEmpty() && prefixes.at(prefix).contains(QLatin1Char('/')))
|
||||
continue;
|
||||
if (!suffixes.at(suffix).isEmpty() && name.endsWith(suffixes.at(suffix)))
|
||||
continue;
|
||||
if (loadHints & QLibrary::LoadArchiveMemberHint) {
|
||||
|
@ -342,7 +342,7 @@ static QString locatePlugin(const QString& fileName)
|
||||
QPluginLoader will automatically look for the file with the appropriate
|
||||
suffix (see QLibrary::isLibrary()).
|
||||
|
||||
When loading the plugin, QPluginLoader searches in the current directory and
|
||||
When loading the plugin, QPluginLoader searches
|
||||
in all plugin locations specified by QCoreApplication::libraryPaths(),
|
||||
unless the file name has an absolute path. After loading the plugin
|
||||
successfully, fileName() returns the fully-qualified file name of
|
||||
|
@ -3185,6 +3185,26 @@ QStateMachine::WrappedEvent::~WrappedEvent()
|
||||
\sa QStateMachine::running
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStateMachine::postDelayedEvent(QEvent *event, std::chrono::milliseconds delay)
|
||||
\since 5.15
|
||||
\overload
|
||||
\threadsafe
|
||||
|
||||
Posts the given \a event for processing by this state machine, with the
|
||||
given \a delay in milliseconds. Returns an identifier associated with the
|
||||
delayed event, or -1 if the event could not be posted.
|
||||
|
||||
This function returns immediately. When the delay has expired, the event
|
||||
will be added to the state machine's event queue for processing. The state
|
||||
machine takes ownership of the event and deletes it once it has been
|
||||
processed.
|
||||
|
||||
You can only post events when the state machine is running.
|
||||
|
||||
\sa cancelDelayedEvent(), postEvent()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qstatemachine.moc"
|
||||
|
@ -48,6 +48,10 @@
|
||||
#include <QtCore/qset.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
#if __has_include(<chrono>)
|
||||
# include <chrono>
|
||||
#endif
|
||||
|
||||
QT_REQUIRE_CONFIG(statemachine);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -145,6 +149,13 @@ public:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
#endif
|
||||
|
||||
#if __has_include(<chrono>) || defined(Q_QDOC)
|
||||
int postDelayedEvent(QEvent *event, std::chrono::milliseconds delay)
|
||||
{
|
||||
return postDelayedEvent(event, int(delay.count()));
|
||||
}
|
||||
#endif
|
||||
|
||||
public Q_SLOTS:
|
||||
void start();
|
||||
void stop();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user