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)
|
add_subdirectory(benchmarks)
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manual/CMakeLists.txt")
|
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()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@ -136,8 +136,10 @@ Build options:
|
|||||||
for example, -sanitize address cannot be combined with
|
for example, -sanitize address cannot be combined with
|
||||||
-sanitize thread.
|
-sanitize thread.
|
||||||
|
|
||||||
-coverage {trace-pc-guard}
|
-coverage {trace-pc-guard|source-based}
|
||||||
Add code coverage instrumentation (Clang only)
|
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]
|
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11]
|
||||||
(Not supported with MSVC 2015)
|
(Not supported with MSVC 2015)
|
||||||
|
@ -15,7 +15,7 @@ qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev)
|
|||||||
|
|
||||||
#### Tests
|
#### Tests
|
||||||
|
|
||||||
# c++14
|
# cxx14
|
||||||
qt_config_compile_test(cxx14
|
qt_config_compile_test(cxx14
|
||||||
LABEL "C++14 support"
|
LABEL "C++14 support"
|
||||||
CODE
|
CODE
|
||||||
@ -38,7 +38,7 @@ int main(int argc, char **argv)
|
|||||||
CXX_STANDARD 14
|
CXX_STANDARD 14
|
||||||
)
|
)
|
||||||
|
|
||||||
# c++17
|
# cxx17
|
||||||
qt_config_compile_test(cxx17
|
qt_config_compile_test(cxx17
|
||||||
LABEL "C++17 support"
|
LABEL "C++17 support"
|
||||||
CODE
|
CODE
|
||||||
@ -65,7 +65,7 @@ std::visit([](const auto &) { return 1; }, v);
|
|||||||
CXX_STANDARD 17
|
CXX_STANDARD 17
|
||||||
)
|
)
|
||||||
|
|
||||||
# c++2a
|
# cxx2a
|
||||||
qt_config_compile_test(cxx2a
|
qt_config_compile_test(cxx2a
|
||||||
LABEL "C++2a support"
|
LABEL "C++2a support"
|
||||||
CODE
|
CODE
|
||||||
@ -398,9 +398,14 @@ qt_feature("coverage_trace_pc_guard"
|
|||||||
AUTODETECT OFF
|
AUTODETECT OFF
|
||||||
)
|
)
|
||||||
qt_feature_config("coverage_trace_pc_guard" QMAKE_PUBLIC_CONFIG)
|
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"
|
qt_feature("coverage"
|
||||||
LABEL "Code Coverage Instrumentation"
|
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_config("coverage" QMAKE_PUBLIC_CONFIG)
|
||||||
qt_feature("plugin-manifests"
|
qt_feature("plugin-manifests"
|
||||||
|
@ -321,7 +321,7 @@
|
|||||||
"qmake": "CONFIG += c11"
|
"qmake": "CONFIG += c11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"c++14": {
|
"cxx14": {
|
||||||
"label": "C++14 support",
|
"label": "C++14 support",
|
||||||
"type": "compile",
|
"type": "compile",
|
||||||
"test": {
|
"test": {
|
||||||
@ -335,7 +335,7 @@
|
|||||||
"qmake": "CONFIG += c++11 c++14"
|
"qmake": "CONFIG += c++11 c++14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"c++17": {
|
"cxx17": {
|
||||||
"label": "C++17 support",
|
"label": "C++17 support",
|
||||||
"type": "compile",
|
"type": "compile",
|
||||||
"test": {
|
"test": {
|
||||||
@ -356,7 +356,7 @@
|
|||||||
"qmake": "CONFIG += c++11 c++14 c++17"
|
"qmake": "CONFIG += c++11 c++14 c++17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"c++2a": {
|
"cxx2a": {
|
||||||
"label": "C++2a support",
|
"label": "C++2a support",
|
||||||
"type": "compile",
|
"type": "compile",
|
||||||
"test": {
|
"test": {
|
||||||
@ -915,9 +915,14 @@
|
|||||||
"autoDetect": false,
|
"autoDetect": false,
|
||||||
"output": [ "publicConfig" ]
|
"output": [ "publicConfig" ]
|
||||||
},
|
},
|
||||||
|
"coverage_source_based": {
|
||||||
|
"label": "source-based",
|
||||||
|
"autoDetect": false,
|
||||||
|
"output": [ "publicConfig" ]
|
||||||
|
},
|
||||||
"coverage": {
|
"coverage": {
|
||||||
"label": "Code Coverage Instrumentation",
|
"label": "Code Coverage Instrumentation",
|
||||||
"condition": "features.coverage_trace_pc_guard",
|
"condition": "features.coverage_trace_pc_guard || features.coverage_source_based",
|
||||||
"output": [ "publicConfig" ]
|
"output": [ "publicConfig" ]
|
||||||
},
|
},
|
||||||
"GNUmake": {
|
"GNUmake": {
|
||||||
@ -957,12 +962,12 @@
|
|||||||
},
|
},
|
||||||
"c++14": {
|
"c++14": {
|
||||||
"label": "C++14",
|
"label": "C++14",
|
||||||
"condition": "features.c++11 && tests.c++14",
|
"condition": "features.c++11 && tests.cxx14",
|
||||||
"output": [ "publicFeature", "publicQtConfig" ]
|
"output": [ "publicFeature", "publicQtConfig" ]
|
||||||
},
|
},
|
||||||
"c++17": {
|
"c++17": {
|
||||||
"label": "C++17",
|
"label": "C++17",
|
||||||
"condition": "features.c++14 && tests.c++17",
|
"condition": "features.c++14 && tests.cxx17",
|
||||||
"output": [ "publicFeature", "publicQtConfig" ]
|
"output": [ "publicFeature", "publicQtConfig" ]
|
||||||
},
|
},
|
||||||
"c++1z": {
|
"c++1z": {
|
||||||
@ -973,7 +978,7 @@
|
|||||||
"c++2a": {
|
"c++2a": {
|
||||||
"label": "C++2a",
|
"label": "C++2a",
|
||||||
"autoDetect": false,
|
"autoDetect": false,
|
||||||
"condition": "features.c++17 && tests.c++2a",
|
"condition": "features.c++17 && tests.cxx2a",
|
||||||
"output": [ "publicFeature", "publicQtConfig" ]
|
"output": [ "publicFeature", "publicQtConfig" ]
|
||||||
},
|
},
|
||||||
"c89": {
|
"c89": {
|
||||||
@ -1606,7 +1611,7 @@
|
|||||||
{
|
{
|
||||||
"message": "Code Coverage Instrumentation",
|
"message": "Code Coverage Instrumentation",
|
||||||
"type": "firstAvailableFeature",
|
"type": "firstAvailableFeature",
|
||||||
"args": "coverage_trace_pc_guard",
|
"args": "coverage_trace_pc_guard coverage_source_based",
|
||||||
"condition": "features.coverage"
|
"condition": "features.coverage"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,9 @@ defineTest(qtConfCommandline_coverage) {
|
|||||||
!contains(val, "^-.*"):!isEmpty(val) {
|
!contains(val, "^-.*"):!isEmpty(val) {
|
||||||
equals(val, "trace-pc-guard") {
|
equals(val, "trace-pc-guard") {
|
||||||
qtConfCommandlineSetInput("coverage_trace_pc_guard", "yes")
|
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")
|
qtConfAddError("Invalid argument $$val to command line parameter $$arg")
|
||||||
}
|
}
|
||||||
} else {
|
} 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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -482,6 +482,11 @@
|
|||||||
\title Khronos OpenGL ES API Registry
|
\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
|
\externalpage https://github.com/iksaif/qsslkey-p11
|
||||||
\title qsslkey example
|
\title qsslkey example
|
||||||
|
@ -83,8 +83,7 @@ Client::Client(QWidget *parent)
|
|||||||
this, &Client::requestNewFortune);
|
this, &Client::requestNewFortune);
|
||||||
connect(quitButton, &QPushButton::clicked, this, &Client::close);
|
connect(quitButton, &QPushButton::clicked, this, &Client::close);
|
||||||
connect(socket, &QLocalSocket::readyRead, this, &Client::readFortune);
|
connect(socket, &QLocalSocket::readyRead, this, &Client::readFortune);
|
||||||
connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
|
connect(socket, &QLocalSocket::errorOccurred, this, &Client::displayError);
|
||||||
this, &Client::displayError);
|
|
||||||
|
|
||||||
QGridLayout *mainLayout = new QGridLayout(this);
|
QGridLayout *mainLayout = new QGridLayout(this);
|
||||||
mainLayout->addWidget(hostLabel, 0, 0);
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||||
@ -198,7 +198,7 @@ private slots:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void request(const QString &flightCode, const QDate &date) {
|
void request(const QString &flightCode, QDate date) {
|
||||||
|
|
||||||
setWindowTitle("Loading...");
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
** 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();
|
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(name);
|
||||||
q.addBindValue(birthdate);
|
q.addBindValue(birthdate);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example hellovulkancubes
|
\example hellovulkancubes
|
||||||
|
\meta installpath vulkan
|
||||||
\title Hello Vulkan Cubes Example
|
\title Hello Vulkan Cubes Example
|
||||||
\ingroup examples-vulkan
|
\ingroup examples-vulkan
|
||||||
\brief Shows the basics of using QVulkanWindow.
|
\brief Shows the basics of using QVulkanWindow.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example hellovulkantexture
|
\example hellovulkantexture
|
||||||
|
\meta installpath vulkan
|
||||||
\ingroup examples-vulkan
|
\ingroup examples-vulkan
|
||||||
\title Hello Vulkan Texture Vulkan Example
|
\title Hello Vulkan Texture Vulkan Example
|
||||||
\brief Shows the basics of rendering with textures in a QVulkanWindow.
|
\brief Shows the basics of rendering with textures in a QVulkanWindow.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example hellovulkantriangle
|
\example hellovulkantriangle
|
||||||
|
\meta installpath vulkan
|
||||||
\ingroup examples-vulkan
|
\ingroup examples-vulkan
|
||||||
\title Hello Vulkan Triangle Example
|
\title Hello Vulkan Triangle Example
|
||||||
\brief Shows the basics of rendering with QVulkanWindow and the Vulkan API.
|
\brief Shows the basics of rendering with QVulkanWindow and the Vulkan API.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example hellovulkanwidget
|
\example hellovulkanwidget
|
||||||
|
\meta installpath vulkan
|
||||||
\ingroup examples-vulkan
|
\ingroup examples-vulkan
|
||||||
\title Hello Vulkan Widget Example
|
\title Hello Vulkan Widget Example
|
||||||
\brief Shows the usage of QVulkanWindow in QWidget applications.
|
\brief Shows the usage of QVulkanWindow in QWidget applications.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example hellovulkanwindow
|
\example hellovulkanwindow
|
||||||
|
\meta installpath vulkan
|
||||||
\title Hello Vulkan Window Example
|
\title Hello Vulkan Window Example
|
||||||
\ingroup examples-vulkan
|
\ingroup examples-vulkan
|
||||||
\brief Shows the basics of using QVulkanWindow.
|
\brief Shows the basics of using QVulkanWindow.
|
||||||
|
@ -109,7 +109,7 @@ void Screenshot::resizeEvent(QResizeEvent * /* event */)
|
|||||||
{
|
{
|
||||||
QSize scaledSize = originalPixmap.size();
|
QSize scaledSize = originalPixmap.size();
|
||||||
scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio);
|
scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio);
|
||||||
if (!screenshotLabel->pixmap() || scaledSize != screenshotLabel->pixmap()->size())
|
if (scaledSize != screenshotLabel->pixmap(Qt::ReturnByValue).size())
|
||||||
updateScreenshotLabel();
|
updateScreenshotLabel();
|
||||||
}
|
}
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -369,7 +369,7 @@ void ConclusionPage::setVisible(bool visible)
|
|||||||
|
|
||||||
void ConclusionPage::printButtonClicked()
|
void ConclusionPage::printButtonClicked()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
QPrintDialog dialog(&printer, this);
|
QPrintDialog dialog(&printer, this);
|
||||||
if (dialog.exec())
|
if (dialog.exec())
|
||||||
|
@ -329,7 +329,8 @@ void Dialog::setDouble()
|
|||||||
//! [1]
|
//! [1]
|
||||||
bool ok;
|
bool ok;
|
||||||
double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
|
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)
|
if (ok)
|
||||||
doubleLabel->setText(QString("$%1").arg(d));
|
doubleLabel->setText(QString("$%1").arg(d));
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -175,8 +175,8 @@
|
|||||||
will expand to
|
will expand to
|
||||||
|
|
||||||
\code
|
\code
|
||||||
if (!imageLabel->pixmap())
|
if (imageLabel->pixmap(Qt::ReturnByValue).isNull())
|
||||||
qFatal("ASSERT: "imageLabel->pixmap()" in file ...");
|
qFatal("ASSERT: "imageLabel->pixmap(Qt::ReturnByValue).isNull()" in file ...");
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
In release mode, the macro simply disappear. The mode can be set
|
In release mode, the macro simply disappear. The mode can be set
|
||||||
|
@ -142,7 +142,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
if (!child)
|
if (!child)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPixmap pixmap = *child->pixmap();
|
QPixmap pixmap = child->pixmap(Qt::ReturnByValue);
|
||||||
|
|
||||||
QByteArray itemData;
|
QByteArray itemData;
|
||||||
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
|
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
|
||||||
|
@ -208,7 +208,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
//! [16]
|
//! [16]
|
||||||
QDrag *drag = new QDrag(this);
|
QDrag *drag = new QDrag(this);
|
||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
drag->setPixmap(*child->pixmap());
|
drag->setPixmap(child->pixmap(Qt::ReturnByValue));
|
||||||
drag->setHotSpot(hotSpot);
|
drag->setHotSpot(hotSpot);
|
||||||
|
|
||||||
child->hide();
|
child->hide();
|
||||||
|
@ -243,7 +243,7 @@ void View::toggleAntialiasing()
|
|||||||
|
|
||||||
void View::print()
|
void View::print()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
QPrintDialog dialog(&printer, this);
|
QPrintDialog dialog(&printer, this);
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -60,7 +60,7 @@ MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
|
|||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
|
void MySortFilterProxyModel::setFilterMinimumDate(QDate date)
|
||||||
{
|
{
|
||||||
minDate = date;
|
minDate = date;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
@ -68,7 +68,7 @@ void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
|
|||||||
//! [1]
|
//! [1]
|
||||||
|
|
||||||
//! [2]
|
//! [2]
|
||||||
void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date)
|
void MySortFilterProxyModel::setFilterMaximumDate(QDate date)
|
||||||
{
|
{
|
||||||
maxDate = date;
|
maxDate = date;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
@ -122,7 +122,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
|
|||||||
//! [5] //! [6]
|
//! [5] //! [6]
|
||||||
|
|
||||||
//! [7]
|
//! [7]
|
||||||
bool MySortFilterProxyModel::dateInRange(const QDate &date) const
|
bool MySortFilterProxyModel::dateInRange(QDate date) const
|
||||||
{
|
{
|
||||||
return (!minDate.isValid() || date > minDate)
|
return (!minDate.isValid() || date > minDate)
|
||||||
&& (!maxDate.isValid() || date < maxDate);
|
&& (!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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -63,17 +63,17 @@ public:
|
|||||||
MySortFilterProxyModel(QObject *parent = 0);
|
MySortFilterProxyModel(QObject *parent = 0);
|
||||||
|
|
||||||
QDate filterMinimumDate() const { return minDate; }
|
QDate filterMinimumDate() const { return minDate; }
|
||||||
void setFilterMinimumDate(const QDate &date);
|
void setFilterMinimumDate(QDate date);
|
||||||
|
|
||||||
QDate filterMaximumDate() const { return maxDate; }
|
QDate filterMaximumDate() const { return maxDate; }
|
||||||
void setFilterMaximumDate(const QDate &date);
|
void setFilterMaximumDate(QDate date);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dateInRange(const QDate &date) const;
|
bool dateInRange(QDate date) const;
|
||||||
|
|
||||||
QDate minDate;
|
QDate minDate;
|
||||||
QDate maxDate;
|
QDate maxDate;
|
||||||
|
@ -167,7 +167,7 @@ void MainWindow::openImage(const QString &fileName)
|
|||||||
|
|
||||||
void MainWindow::printImage()
|
void MainWindow::printImage()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
|
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
|
||||||
QMessageBox::StandardButton answer;
|
QMessageBox::StandardButton answer;
|
||||||
answer = QMessageBox::question(this, tr("Large Image Size"),
|
answer = QMessageBox::question(this, tr("Large Image Size"),
|
||||||
|
@ -128,7 +128,7 @@ void MainWindow::newLetter()
|
|||||||
//! [3]
|
//! [3]
|
||||||
void MainWindow::print()
|
void MainWindow::print()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QTextDocument *document = textEdit->document();
|
QTextDocument *document = textEdit->document();
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void MainWindow::openDialog()
|
|||||||
//! [17]
|
//! [17]
|
||||||
void MainWindow::printFile()
|
void MainWindow::printFile()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
|
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
|
||||||
//! [18]
|
//! [18]
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
@ -419,18 +419,18 @@ bool TextEdit::load(const QString &f)
|
|||||||
QByteArray data = file.readAll();
|
QByteArray data = file.readAll();
|
||||||
QTextCodec *codec = Qt::codecForHtml(data);
|
QTextCodec *codec = Qt::codecForHtml(data);
|
||||||
QString str = codec->toUnicode(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)) {
|
if (Qt::mightBeRichText(str)) {
|
||||||
|
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
|
||||||
|
textEdit->document()->setBaseUrl(baseUrl);
|
||||||
textEdit->setHtml(str);
|
textEdit->setHtml(str);
|
||||||
} else {
|
} else {
|
||||||
#if QT_CONFIG(textmarkdownreader)
|
#if QT_CONFIG(textmarkdownreader)
|
||||||
QMimeDatabase db;
|
QMimeDatabase db;
|
||||||
if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown"))
|
if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown"))
|
||||||
textEdit->setMarkdown(str);
|
textEdit->setMarkdown(QString::fromUtf8(data));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
textEdit->setPlainText(QString::fromLocal8Bit(data));
|
textEdit->setPlainText(QString::fromUtf8(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentFileName(f);
|
setCurrentFileName(f);
|
||||||
@ -545,7 +545,7 @@ bool TextEdit::fileSaveAs()
|
|||||||
|
|
||||||
void TextEdit::filePrint()
|
void TextEdit::filePrint()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
||||||
if (textEdit->textCursor().hasSelection())
|
if (textEdit->textCursor().hasSelection())
|
||||||
|
@ -170,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
|
|||||||
//! [21]
|
//! [21]
|
||||||
void ScribbleArea::print()
|
void ScribbleArea::print()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
|
||||||
QPrintDialog printDialog(&printer, this);
|
QPrintDialog printDialog(&printer, this);
|
||||||
|
@ -92,7 +92,7 @@ Notepad::Notepad(QWidget *parent) :
|
|||||||
connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
|
connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
|
||||||
|
|
||||||
// Disable menu actions for unavailable features
|
// Disable menu actions for unavailable features
|
||||||
#if !QT_CONFIG(printer)
|
#if !defined(QT_PRINTSUPPORT_LIB) || !QT_CONFIG(printer)
|
||||||
ui->actionPrint->setEnabled(false);
|
ui->actionPrint->setEnabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ void Notepad::saveAs()
|
|||||||
|
|
||||||
void Notepad::print()
|
void Notepad::print()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printer)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
|
||||||
QPrinter printDev;
|
QPrinter printDev;
|
||||||
#if QT_CONFIG(printdialog)
|
#if QT_CONFIG(printdialog)
|
||||||
QPrintDialog dialog(&printDev, this);
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -126,7 +126,7 @@ void Window::selectedDateChanged()
|
|||||||
//! [2]
|
//! [2]
|
||||||
|
|
||||||
//! [3]
|
//! [3]
|
||||||
void Window::minimumDateChanged(const QDate &date)
|
void Window::minimumDateChanged(QDate date)
|
||||||
{
|
{
|
||||||
calendar->setMinimumDate(date);
|
calendar->setMinimumDate(date);
|
||||||
maximumDateEdit->setDate(calendar->maximumDate());
|
maximumDateEdit->setDate(calendar->maximumDate());
|
||||||
@ -134,7 +134,7 @@ void Window::minimumDateChanged(const QDate &date)
|
|||||||
//! [3]
|
//! [3]
|
||||||
|
|
||||||
//! [4]
|
//! [4]
|
||||||
void Window::maximumDateChanged(const QDate &date)
|
void Window::maximumDateChanged(QDate date)
|
||||||
{
|
{
|
||||||
calendar->setMaximumDate(date);
|
calendar->setMaximumDate(date);
|
||||||
minimumDateEdit->setDate(calendar->minimumDate());
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -52,6 +52,7 @@
|
|||||||
#define WINDOW_H
|
#define WINDOW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCalendarWidget;
|
class QCalendarWidget;
|
||||||
@ -79,8 +80,8 @@ private slots:
|
|||||||
void horizontalHeaderChanged(int index);
|
void horizontalHeaderChanged(int index);
|
||||||
void verticalHeaderChanged(int index);
|
void verticalHeaderChanged(int index);
|
||||||
void selectedDateChanged();
|
void selectedDateChanged();
|
||||||
void minimumDateChanged(const QDate &date);
|
void minimumDateChanged(QDate date);
|
||||||
void maximumDateChanged(const QDate &date);
|
void maximumDateChanged(QDate date);
|
||||||
void weekdayFormatChanged();
|
void weekdayFormatChanged();
|
||||||
void weekendFormatChanged();
|
void weekendFormatChanged();
|
||||||
void reformatHeaders();
|
void reformatHeaders();
|
||||||
|
@ -200,19 +200,20 @@ void ImageViewer::saveAs()
|
|||||||
void ImageViewer::print()
|
void ImageViewer::print()
|
||||||
//! [5] //! [6]
|
//! [5] //! [6]
|
||||||
{
|
{
|
||||||
Q_ASSERT(imageLabel->pixmap());
|
Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull());
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
//! [6] //! [7]
|
//! [6] //! [7]
|
||||||
QPrintDialog dialog(&printer, this);
|
QPrintDialog dialog(&printer, this);
|
||||||
//! [7] //! [8]
|
//! [7] //! [8]
|
||||||
if (dialog.exec()) {
|
if (dialog.exec()) {
|
||||||
QPainter painter(&printer);
|
QPainter painter(&printer);
|
||||||
|
QPixmap pixmap = imageLabel->pixmap(Qt::ReturnByValue);
|
||||||
QRect rect = painter.viewport();
|
QRect rect = painter.viewport();
|
||||||
QSize size = imageLabel->pixmap()->size();
|
QSize size = pixmap.size();
|
||||||
size.scale(rect.size(), Qt::KeepAspectRatio);
|
size.scale(rect.size(), Qt::KeepAspectRatio);
|
||||||
painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
|
painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
|
||||||
painter.setWindow(imageLabel->pixmap()->rect());
|
painter.setWindow(pixmap.rect());
|
||||||
painter.drawPixmap(0, 0, *imageLabel->pixmap());
|
painter.drawPixmap(0, 0, pixmap);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -383,9 +384,8 @@ void ImageViewer::updateActions()
|
|||||||
void ImageViewer::scaleImage(double factor)
|
void ImageViewer::scaleImage(double factor)
|
||||||
//! [23] //! [24]
|
//! [23] //! [24]
|
||||||
{
|
{
|
||||||
Q_ASSERT(imageLabel->pixmap());
|
|
||||||
scaleFactor *= factor;
|
scaleFactor *= factor;
|
||||||
imageLabel->resize(scaleFactor * imageLabel->pixmap()->size());
|
imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
|
||||||
|
|
||||||
adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
|
adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
|
||||||
adjustScrollBar(scrollArea->verticalScrollBar(), factor);
|
adjustScrollBar(scrollArea->verticalScrollBar(), factor);
|
||||||
|
@ -210,7 +210,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
|
|||||||
//! [21]
|
//! [21]
|
||||||
void ScribbleArea::print()
|
void ScribbleArea::print()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(printdialog)
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
|
||||||
QPrintDialog printDialog(&printer, this);
|
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_CFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||||
QMAKE_CXXFLAGS_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_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_AVX512VL += -mavx512vl
|
||||||
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
|
||||||
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
|
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_AESNI += -maes
|
||||||
QMAKE_CFLAGS_SHANI += -msha
|
QMAKE_CFLAGS_SHANI += -msha
|
||||||
|
QMAKE_CFLAGS_VAES += -mvaes
|
||||||
QMAKE_CFLAGS_NEON += -mfpu=neon
|
QMAKE_CFLAGS_NEON += -mfpu=neon
|
||||||
QMAKE_CFLAGS_MIPS_DSP += -mdsp
|
QMAKE_CFLAGS_MIPS_DSP += -mdsp
|
||||||
QMAKE_CFLAGS_MIPS_DSPR2 += -mdspr2
|
QMAKE_CFLAGS_MIPS_DSPR2 += -mdspr2
|
||||||
|
@ -48,11 +48,18 @@ QMAKE_CFLAGS_AVX512PF += -march=knl
|
|||||||
QMAKE_CFLAGS_AVX512DQ += -march=skylake-avx512
|
QMAKE_CFLAGS_AVX512DQ += -march=skylake-avx512
|
||||||
QMAKE_CFLAGS_AVX512BW += -march=skylake-avx512
|
QMAKE_CFLAGS_AVX512BW += -march=skylake-avx512
|
||||||
QMAKE_CFLAGS_AVX512VL += -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_AESNI += -maes
|
||||||
QMAKE_CFLAGS_F16C += $$QMAKE_CFLAGS_AVX2
|
QMAKE_CFLAGS_F16C += $$QMAKE_CFLAGS_AVX2
|
||||||
QMAKE_CFLAGS_RDRND += -mrdrnd
|
QMAKE_CFLAGS_RDRND += -mrdrnd
|
||||||
QMAKE_CFLAGS_RDSEED += -mrdseed
|
QMAKE_CFLAGS_RDSEED += -mrdseed
|
||||||
QMAKE_CFLAGS_SHANI += -msha
|
QMAKE_CFLAGS_SHANI += -msha
|
||||||
|
QMAKE_CFLAGS_VAES += -mvaes
|
||||||
|
|
||||||
QMAKE_CXX = icpc
|
QMAKE_CXX = icpc
|
||||||
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
|
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
|
||||||
|
@ -36,7 +36,7 @@ build_pass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install {
|
} 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}
|
!equals(tmpvar, $${QT_ARCH}): TARGET = $${TARGET}_$${QT_ARCH}
|
||||||
target.path = /libs/$$ANDROID_TARGET_ARCH/
|
target.path = /libs/$$ANDROID_TARGET_ARCH/
|
||||||
INSTALLS *= target
|
INSTALLS *= target
|
||||||
|
@ -5,3 +5,9 @@ coverage_trace_pc_guard {
|
|||||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD
|
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_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, [-/], _)
|
CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _)
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
|
!mingw|qtConfig(debug_and_release): debug_suffix="d"
|
||||||
|
|
||||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
|
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) {
|
isEmpty(CMAKE_STATIC_TYPE) {
|
||||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll
|
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 {
|
} else:mingw {
|
||||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
|
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
|
} else { # MSVC static
|
||||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
|
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 {
|
} else {
|
||||||
mac {
|
mac {
|
||||||
@ -313,27 +316,29 @@ mac {
|
|||||||
CMAKE_WINDOWS_BUILD = "true"
|
CMAKE_WINDOWS_BUILD = "true"
|
||||||
CMAKE_FIND_OTHER_LIBRARY_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
|
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll
|
||||||
|
|
||||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||||
CMAKE_STATIC_WINDOWS_BUILD = "true"
|
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
|
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
|
||||||
}
|
}
|
||||||
|
|
||||||
mingw {
|
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_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
|
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
|
||||||
} else {
|
} 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_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
|
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
|
||||||
}
|
}
|
||||||
} else {
|
} 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 \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends \"${_prl_strings}\")
|
||||||
string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
|
string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
|
||||||
set(_search_paths)
|
set(_search_paths)
|
||||||
|
set(_fw_search_paths)
|
||||||
set(_framework_flag)
|
set(_framework_flag)
|
||||||
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
|
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
|
||||||
foreach(_flag ${_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$\")
|
if(_flag MATCHES \"^-framework$\")
|
||||||
# Handle the next flag as framework name
|
# Handle the next flag as framework name
|
||||||
set(_framework_flag 1)
|
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(.*)$\")
|
elseif(_framework_flag OR _flag MATCHES \"^-l(.*)$\")
|
||||||
if(_framework_flag)
|
if(_framework_flag)
|
||||||
# Handle Darwin framework bundles passed as -framework Foo
|
# Handle Darwin framework bundles passed as -framework Foo
|
||||||
unset(_framework_flag)
|
|
||||||
set(_lib ${_flag})
|
set(_lib ${_flag})
|
||||||
else()
|
else()
|
||||||
# Handle normal libraries passed as -lfoo
|
# 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)
|
find_package(Threads REQUIRED)
|
||||||
list(APPEND _lib_deps Threads::Threads)
|
list(APPEND _lib_deps Threads::Threads)
|
||||||
else()
|
else()
|
||||||
if(_search_paths)
|
set(current_search_paths \"${_search_paths}\")
|
||||||
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${_search_paths} NO_DEFAULT_PATH)
|
if(_framework_flag)
|
||||||
|
set(current_search_paths \"${_fw_search_paths}\")
|
||||||
endif()
|
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)
|
mark_as_advanced(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||||||
if(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
if(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||||||
list(APPEND _lib_deps
|
list(APPEND _lib_deps
|
||||||
@ -112,6 +120,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
|
|||||||
else()
|
else()
|
||||||
message(FATAL_ERROR \"Library not found: ${_lib}\")
|
message(FATAL_ERROR \"Library not found: ${_lib}\")
|
||||||
endif()
|
endif()
|
||||||
|
unset(_framework_flag)
|
||||||
endif()
|
endif()
|
||||||
elseif(EXISTS \"${_flag}\")
|
elseif(EXISTS \"${_flag}\")
|
||||||
# The flag is an absolute path to an existing library
|
# The flag is an absolute path to an existing library
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
qtPrepareTool(MOC_COLLECT_JSON, moc)
|
qtPrepareTool(MOC_COLLECT_JSON, moc)
|
||||||
|
|
||||||
load(qt_build_paths)
|
|
||||||
|
|
||||||
QMAKE_MOC_OPTIONS += --output-json
|
QMAKE_MOC_OPTIONS += --output-json
|
||||||
|
|
||||||
MOC_JSON_H_BASE = $${QMAKE_H_MOD_MOC}
|
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.path = $$[QT_INSTALL_LIBS]/metatypes
|
||||||
do_install_metatypes.files = $$OUT_PWD/$$MOC_COLLECT_JSON_OUTPUT
|
do_install_metatypes.files = $$OUT_PWD/$$MOC_COLLECT_JSON_OUTPUT
|
||||||
prefix_build {
|
prefix_build {
|
||||||
|
load(qt_build_paths)
|
||||||
!isEmpty(MODULE_BASE_OUTDIR) {
|
!isEmpty(MODULE_BASE_OUTDIR) {
|
||||||
metatypes_to_builddir.files = $$do_install_metatypes.files
|
metatypes_to_builddir.files = $$do_install_metatypes.files
|
||||||
metatypes_to_builddir.path = $$MODULE_BASE_OUTDIR/lib/metatypes
|
metatypes_to_builddir.path = $$MODULE_BASE_OUTDIR/lib/metatypes
|
||||||
|
@ -46,8 +46,8 @@ build_pass:!isEmpty(QT_ARCH): {
|
|||||||
EXTENDS = $$section(LIB_FILE, ":", 1, 1)
|
EXTENDS = $$section(LIB_FILE, ":", 1, 1)
|
||||||
!isEmpty(EXTENDS): EXTENDS = "extends=\"$$EXTENDS\""
|
!isEmpty(EXTENDS): EXTENDS = "extends=\"$$EXTENDS\""
|
||||||
LIB_FILE = $$section(LIB_FILE, ":", 0, 0)
|
LIB_FILE = $$section(LIB_FILE, ":", 0, 0)
|
||||||
LIB_FILE = $$replace(LIB_FILE,".so", "_$${QT_ARCH}.so")
|
LIB_FILE = $$replace(LIB_FILE,"\.so", "_$${QT_ARCH}.so")
|
||||||
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,".so", "_$${QT_ARCH}.so")
|
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,"\.so", "_$${QT_ARCH}.so")
|
||||||
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" $$EXTENDS />"
|
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" $$EXTENDS />"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,14 +56,14 @@ build_pass:!isEmpty(QT_ARCH): {
|
|||||||
for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
|
for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
|
||||||
REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
|
REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
|
||||||
LIB_FILE = $$section(REPLACEMENT, ":", 1, 1)
|
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\" />"
|
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" replaces=\"$$REPLACEMENT_FILE\" />"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
!isEmpty(ANDROID_BUNDLED_FILES) {
|
!isEmpty(ANDROID_BUNDLED_FILES) {
|
||||||
for (BUNDLED_FILE, 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\" />"
|
FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,21 @@
|
|||||||
defineReplace(qtPlatformTargetSuffix) {
|
defineReplace(qtPlatformTargetSuffix) {
|
||||||
suffix =
|
suffix =
|
||||||
android: return($${suffix}_$${QT_ARCH})
|
android: return($${suffix}_$${QT_ARCH})
|
||||||
else: CONFIG(debug, debug|release) {
|
win32 {
|
||||||
!debug_and_release|build_pass {
|
CONFIG(debug, debug|release) {
|
||||||
mac: return($${suffix}_debug)
|
mingw {
|
||||||
win32: return($${suffix}d)
|
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)
|
return($$suffix)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
qtPrepareTool(QMAKE_RCC, rcc, _DEP)
|
qtPrepareTool(QMAKE_RCC, rcc, _DEP)
|
||||||
|
|
||||||
isEmpty(RCC_DIR):RCC_DIR = .
|
|
||||||
isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
|
isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
|
||||||
|
|
||||||
!contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT
|
!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)
|
load(resources_functions)
|
||||||
qtFlattenResources()
|
qtFlattenResources()
|
||||||
|
qtEnsurePluginResourcesCpp()
|
||||||
!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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rcc.input = RESOURCES
|
rcc.input = RESOURCES
|
||||||
rcc.name = RCC ${QMAKE_FILE_IN}
|
rcc.name = RCC ${QMAKE_FILE_IN}
|
||||||
|
@ -9,6 +9,7 @@ defineReplace(xml_escape) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defineTest(qtFlattenResources) {
|
defineTest(qtFlattenResources) {
|
||||||
|
isEmpty(RCC_DIR):RCC_DIR = .
|
||||||
immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR
|
immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR
|
||||||
defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \
|
defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \
|
||||||
QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1)
|
QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1)
|
||||||
@ -33,7 +34,18 @@ defineTest(qtFlattenResources) {
|
|||||||
next()
|
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 {
|
isEmpty(BUILDS)|build_pass {
|
||||||
# Collection of files, generate qrc file
|
# Collection of files, generate qrc file
|
||||||
@ -68,13 +80,54 @@ defineTest(qtFlattenResources) {
|
|||||||
!write_file($$resource_file, resource_file_content): \
|
!write_file($$resource_file, resource_file_content): \
|
||||||
error()
|
error()
|
||||||
}
|
}
|
||||||
|
|
||||||
RESOURCES -= $$resource
|
|
||||||
RESOURCES += $$resource_file
|
|
||||||
}
|
}
|
||||||
|
export(RCC_DIR)
|
||||||
export(QMAKE_RESOURCES_IMMEDIATE_NR)
|
export(QMAKE_RESOURCES_IMMEDIATE_NR)
|
||||||
export(RESOURCES)
|
export(RESOURCES)
|
||||||
export(OTHER_FILES)
|
export(OTHER_FILES)
|
||||||
export($${immediate}.files)
|
export($${immediate}.files)
|
||||||
return(true)
|
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(sse4_2)
|
||||||
addSimdCompiler(aesni)
|
addSimdCompiler(aesni)
|
||||||
addSimdCompiler(shani)
|
addSimdCompiler(shani)
|
||||||
|
addSimdCompiler(vaes)
|
||||||
addSimdCompiler(avx)
|
addSimdCompiler(avx)
|
||||||
addSimdCompiler(avx2)
|
addSimdCompiler(avx2)
|
||||||
addSimdCompiler(avx512f)
|
addSimdCompiler(avx512f)
|
||||||
@ -133,8 +134,12 @@ addSimdCompiler(avx512pf)
|
|||||||
addSimdCompiler(avx512dq)
|
addSimdCompiler(avx512dq)
|
||||||
addSimdCompiler(avx512bw)
|
addSimdCompiler(avx512bw)
|
||||||
addSimdCompiler(avx512vl)
|
addSimdCompiler(avx512vl)
|
||||||
|
addSimdCompiler(avx512vnni)
|
||||||
addSimdCompiler(avx512ifma)
|
addSimdCompiler(avx512ifma)
|
||||||
addSimdCompiler(avx512vbmi)
|
addSimdCompiler(avx512vbmi)
|
||||||
|
addSimdCompiler(avx512vbmi2)
|
||||||
|
addSimdCompiler(avx512bitalg)
|
||||||
|
addSimdCompiler(avx512vpopcntd)
|
||||||
addSimdCompiler(f16c)
|
addSimdCompiler(f16c)
|
||||||
addSimdCompiler(rdrnd)
|
addSimdCompiler(rdrnd)
|
||||||
addSimdCompiler(rdseed)
|
addSimdCompiler(rdseed)
|
||||||
|
@ -30,8 +30,8 @@ defineReplace(yaccCommands) {
|
|||||||
commands = \
|
commands = \
|
||||||
-$(DEL_FILE) $${hpp_output} $${cpp_output}$$escape_expand(\\n\\t) \
|
-$(DEL_FILE) $${hpp_output} $${cpp_output}$$escape_expand(\\n\\t) \
|
||||||
$${yacc_call}$$escape_expand(\\n\\t) \
|
$${yacc_call}$$escape_expand(\\n\\t) \
|
||||||
$(MOVE) $${YACC_DIR}/$${QMAKE_YACC_HEADER} $${hpp_output}$$escape_expand(\\n\\t) \
|
$(MOVE) $$shell_path($${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_SOURCE}) $${cpp_output}$$escape_expand(\\n\\t)
|
||||||
|
|
||||||
silent: commands = @echo Yacc $$1 && $$commands
|
silent: commands = @echo Yacc $$1 && $$commands
|
||||||
return($$commands)
|
return($$commands)
|
||||||
|
@ -51,34 +51,8 @@ EMCC_COMMON_LFLAGS_DEBUG = \
|
|||||||
# -s SOCKET_DEBUG \ #print out socket,network data transfer
|
# -s SOCKET_DEBUG \ #print out socket,network data transfer
|
||||||
-s GL_DEBUG=1
|
-s GL_DEBUG=1
|
||||||
|
|
||||||
# Set up debug/optimization flags
|
QMAKE_LFLAGS_DEBUG += -g
|
||||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
QMAKE_LFLAGS_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_COMPILER += emscripten
|
QMAKE_COMPILER += emscripten
|
||||||
|
|
||||||
|
@ -38,6 +38,12 @@ QMAKE_CFLAGS_AVX512PF += -QxMIC-AVX512
|
|||||||
QMAKE_CFLAGS_AVX512DQ += -QxCORE-AVX512
|
QMAKE_CFLAGS_AVX512DQ += -QxCORE-AVX512
|
||||||
QMAKE_CFLAGS_AVX512BW += -QxCORE-AVX512
|
QMAKE_CFLAGS_AVX512BW += -QxCORE-AVX512
|
||||||
QMAKE_CFLAGS_AVX512VL += -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_F16C = $$QMAKE_CFLAGS_AVX2
|
||||||
QMAKE_CFLAGS_RDRND = $$QMAKE_CFLAGS_AVX2
|
QMAKE_CFLAGS_RDRND = $$QMAKE_CFLAGS_AVX2
|
||||||
# ICC on Windows lacks the mrdseed compiler option that sets the RDSEED macro
|
# 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_AESNI = -QxSSE2
|
||||||
QMAKE_CFLAGS_SHANI = -QxSSE4.2
|
QMAKE_CFLAGS_SHANI = -QxSSE4.2
|
||||||
|
QMAKE_CFLAGS_VAES = -QxCORE-AVX512
|
||||||
|
|
||||||
QMAKE_CXX = $$QMAKE_CC
|
QMAKE_CXX = $$QMAKE_CC
|
||||||
QMAKE_CXXFLAGS += -Qprec -Zm200 -Zc:forScope
|
QMAKE_CXXFLAGS += -Qprec -Zm200 -Zc:forScope
|
||||||
|
@ -917,7 +917,7 @@
|
|||||||
Specifies project configuration and compiler options. The values are
|
Specifies project configuration and compiler options. The values are
|
||||||
recognized internally by qmake and have special meaning.
|
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
|
\table
|
||||||
\header \li Option \li Description
|
\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 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 \li Exception support is enabled. Set by default.
|
||||||
\row \li exceptions_off \li Exception support is disabled.
|
\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
|
\row \li rtti \li RTTI support is enabled. By default, the compiler
|
||||||
default is used.
|
default is used.
|
||||||
\row \li rtti_off \li RTTI support is disabled. By default, the compiler
|
\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))
|
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
|
||||||
commands.insert(i + 1, errchk);
|
commands.insert(i + 1, errchk);
|
||||||
}
|
}
|
||||||
return commands.join('\n');
|
return commands.join("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString unquote(const QString &value)
|
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
|
INCLUDEPATH += $$PWD/md4c
|
||||||
HEADERS += $$PWD/md4c/md4c.h
|
HEADERS += $$PWD/md4c/md4c.h
|
||||||
SOURCES += $$PWD/md4c/md4c.c
|
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.",
|
"Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
|
||||||
"Homepage": "https://www.sqlite.org/",
|
"Homepage": "https://www.sqlite.org/",
|
||||||
"Version": "3.30.1",
|
"Version": "3.31.1",
|
||||||
"DownloadLocation": "https://www.sqlite.org/2019/sqlite-amalgamation-3300100.zip",
|
"DownloadLocation": "https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip",
|
||||||
"License": "Public Domain",
|
"License": "Public Domain",
|
||||||
"Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
|
"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()
|
public static boolean hasClipboardText()
|
||||||
{
|
{
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getText() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
return true;
|
if (primaryClip.getItemAt(i).getText() != null)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getClipboardText()
|
private static String getClipboardText()
|
||||||
{
|
{
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getText() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
return primaryClip.getItemAt(i).getText().toString();
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updatePrimaryClip(ClipData clipData)
|
private static void updatePrimaryClip(ClipData clipData)
|
||||||
{
|
{
|
||||||
if (m_usePrimaryClip) {
|
try {
|
||||||
ClipData clip = m_clipboardManager.getPrimaryClip();
|
if (m_usePrimaryClip) {
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
ClipData clip = m_clipboardManager.getPrimaryClip();
|
||||||
if (m_addItemMethod == null) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
Class[] cArg = new Class[2];
|
if (m_addItemMethod == null) {
|
||||||
cArg[0] = ContentResolver.class;
|
Class[] cArg = new Class[2];
|
||||||
cArg[1] = ClipData.Item.class;
|
cArg[0] = ContentResolver.class;
|
||||||
try {
|
cArg[1] = ClipData.Item.class;
|
||||||
m_addItemMethod = m_clipboardManager.getClass().getMethod("addItem", cArg);
|
try {
|
||||||
} catch (Exception e) {
|
m_addItemMethod = m_clipboardManager.getClass().getMethod("addItem", cArg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (m_addItemMethod != null) {
|
||||||
if (m_addItemMethod != null) {
|
try {
|
||||||
try {
|
m_addItemMethod.invoke(m_activity.getContentResolver(), clipData.getItemAt(0));
|
||||||
m_addItemMethod.invoke(m_activity.getContentResolver(), clipData.getItemAt(0));
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}
|
||||||
|
} else {
|
||||||
|
clip.addItem(clipData.getItemAt(0));
|
||||||
}
|
}
|
||||||
|
m_clipboardManager.setPrimaryClip(clip);
|
||||||
} else {
|
} else {
|
||||||
clip.addItem(clipData.getItemAt(0));
|
m_clipboardManager.setPrimaryClip(clipData);
|
||||||
|
m_usePrimaryClip = true;
|
||||||
}
|
}
|
||||||
m_clipboardManager.setPrimaryClip(clip);
|
} catch (Exception e) {
|
||||||
} else {
|
Log.e(QtTAG, "Failed to set clipboard data", e);
|
||||||
m_clipboardManager.setPrimaryClip(clipData);
|
|
||||||
m_usePrimaryClip = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,22 +813,30 @@ public class QtNative
|
|||||||
|
|
||||||
public static boolean hasClipboardHtml()
|
public static boolean hasClipboardHtml()
|
||||||
{
|
{
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
return true;
|
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getClipboardHtml()
|
private static String getClipboardHtml()
|
||||||
{
|
{
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getHtmlText() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
return primaryClip.getItemAt(i).getHtmlText().toString();
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -832,11 +852,15 @@ public class QtNative
|
|||||||
|
|
||||||
public static boolean hasClipboardUri()
|
public static boolean hasClipboardUri()
|
||||||
{
|
{
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getUri() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
return true;
|
if (primaryClip.getItemAt(i).getUri() != null)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(QtTAG, "Failed to get clipboard data", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -844,11 +868,15 @@ public class QtNative
|
|||||||
private static String[] getClipboardUris()
|
private static String[] getClipboardUris()
|
||||||
{
|
{
|
||||||
ArrayList<String> uris = new ArrayList<String>();
|
ArrayList<String> uris = new ArrayList<String>();
|
||||||
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
try {
|
||||||
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
|
||||||
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
ClipData primaryClip = m_clipboardManager.getPrimaryClip();
|
||||||
if (primaryClip.getItemAt(i).getUri() != null)
|
for (int i = 0; i < primaryClip.getItemCount(); ++i)
|
||||||
uris.add(primaryClip.getItemAt(i).getUri().toString());
|
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()];
|
String[] strings = new String[uris.size()];
|
||||||
strings = uris.toArray(strings);
|
strings = uris.toArray(strings);
|
||||||
|
@ -62,7 +62,7 @@ public class QtActivityLoader extends QtLoader {
|
|||||||
protected void downloadUpgradeMinistro(String msg) {
|
protected void downloadUpgradeMinistro(String msg) {
|
||||||
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity);
|
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity);
|
||||||
downloadDialog.setMessage(msg);
|
downloadDialog.setMessage(msg);
|
||||||
downloadDialog.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
downloadDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
try {
|
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
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
m_activity.finish();
|
m_activity.finish();
|
||||||
|
@ -385,6 +385,7 @@ qt_extend_target(Core CONDITION WIN32 AND NOT WINRT
|
|||||||
qt_extend_target(Core CONDITION APPLE
|
qt_extend_target(Core CONDITION APPLE
|
||||||
SOURCES
|
SOURCES
|
||||||
global/qoperatingsystemversion_darwin.mm
|
global/qoperatingsystemversion_darwin.mm
|
||||||
|
io/qfilesystemengine_mac.mm
|
||||||
io/qstandardpaths_mac.mm
|
io/qstandardpaths_mac.mm
|
||||||
io/qstorageinfo_mac.cpp
|
io/qstorageinfo_mac.cpp
|
||||||
kernel/qcfsocketnotifier.cpp kernel/qcfsocketnotifier_p.h
|
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
|
qt_extend_target(Core CONDITION APPLE
|
||||||
SOURCES
|
SOURCES
|
||||||
global/qoperatingsystemversion_darwin.mm
|
global/qoperatingsystemversion_darwin.mm
|
||||||
|
io/qfilesystemengine_mac.mm
|
||||||
io/qstandardpaths_mac.mm
|
io/qstandardpaths_mac.mm
|
||||||
io/qstorageinfo_mac.cpp
|
io/qstorageinfo_mac.cpp
|
||||||
kernel/qcfsocketnotifier.cpp kernel/qcfsocketnotifier_p.h
|
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}")
|
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
|
||||||
string(REPLACE ".." "__" _outfile ${_outfile})
|
string(REPLACE ".." "__" _outfile ${_outfile})
|
||||||
get_filename_component(outpath ${_outfile} PATH)
|
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})
|
file(MAKE_DIRECTORY ${outpath})
|
||||||
set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
|
set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
|
||||||
endmacro()
|
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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -135,7 +135,7 @@ class Employee
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Employee() {}
|
Employee() {}
|
||||||
Employee(const QString &name, const QDate &dateOfBirth);
|
Employee(const QString &name, QDate dateOfBirth);
|
||||||
...
|
...
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -151,7 +151,7 @@ class Employee
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Employee() {}
|
Employee() {}
|
||||||
Employee(const QString &name, const QDate &dateOfBirth);
|
Employee(const QString &name, QDate dateOfBirth);
|
||||||
...
|
...
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -61,14 +61,13 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
|
|||||||
QGridLayout *gridLayout = new QGridLayout;
|
QGridLayout *gridLayout = new QGridLayout;
|
||||||
for (int i = 0; i < texts.size(); ++i) {
|
for (int i = 0; i < texts.size(); ++i) {
|
||||||
QPushButton *button = new QPushButton(texts[i]);
|
QPushButton *button = new QPushButton(texts[i]);
|
||||||
connect(button, &QPushButton::clicked,
|
connect(button, &QPushButton::clicked, signalMapper, &QSignalMapper::map);
|
||||||
signalMapper, &QSignalMapper::map);
|
|
||||||
//! [0] //! [1]
|
//! [0] //! [1]
|
||||||
signalMapper->setMapping(button, texts[i]);
|
signalMapper->setMapping(button, texts[i]);
|
||||||
gridLayout->addWidget(button, i / 3, i % 3);
|
gridLayout->addWidget(button, i / 3, i % 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(signalMapper, QOverload<const QString &>::of(&QSignalMapper::mapped),
|
connect(signalMapper, &QSignalMapper::mappedString,
|
||||||
//! [1] //! [2]
|
//! [1] //! [2]
|
||||||
this, &ButtonWidget::clicked);
|
this, &ButtonWidget::clicked);
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype
|
|||||||
#undef f16cextern
|
#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()
|
static inline bool hasFastF16()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#if !defined(__F16C__) && !defined(__ARM_FP16_FORMAT_IEEE)
|
#if !defined(__ARM_FP16_FORMAT_IEEE)
|
||||||
|
|
||||||
const quint32 qfloat16::mantissatable[2048] = {
|
const quint32 qfloat16::mantissatable[2048] = {
|
||||||
0,
|
0,
|
||||||
|
@ -1669,14 +1669,34 @@ static bool android_default_message_handler(QtMsgType type,
|
|||||||
#endif //Q_OS_ANDROID
|
#endif //Q_OS_ANDROID
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#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)
|
static bool win_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message)
|
||||||
{
|
{
|
||||||
if (shouldLogToStderr())
|
if (shouldLogToStderr())
|
||||||
return false; // Leave logging up to stderr handler
|
return false; // Leave logging up to stderr handler
|
||||||
|
|
||||||
QString formattedMessage = qFormatLogMessage(type, context, message);
|
const QString formattedMessage = qFormatLogMessage(type, context, message).append('\n');
|
||||||
formattedMessage.append(QLatin1Char('\n'));
|
win_outputDebugString_helper(formattedMessage);
|
||||||
OutputDebugString(reinterpret_cast<const wchar_t *>(formattedMessage.utf16()));
|
|
||||||
|
|
||||||
return true; // Prevent further output to stderr
|
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)
|
static void qt_message_print(const QString &message)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WINRT)
|
#if defined(Q_OS_WINRT)
|
||||||
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16()));
|
win_outputDebugString_helper(message);
|
||||||
return;
|
return;
|
||||||
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
|
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
|
||||||
if (!shouldLogToStderr()) {
|
if (!shouldLogToStderr()) {
|
||||||
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16()));
|
win_outputDebugString_helper(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
@ -1249,14 +1249,16 @@ namespace Qt {
|
|||||||
enum DateFormat {
|
enum DateFormat {
|
||||||
TextDate, // default Qt
|
TextDate, // default Qt
|
||||||
ISODate, // ISO 8601
|
ISODate, // ISO 8601
|
||||||
SystemLocaleDate, // deprecated
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
LocalDate = SystemLocaleDate, // deprecated
|
SystemLocaleDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
LocaleDate, // deprecated
|
LocalDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale") = 2, // i.e. SystemLocaleDate
|
||||||
SystemLocaleShortDate,
|
LocaleDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
SystemLocaleLongDate,
|
SystemLocaleShortDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
DefaultLocaleShortDate,
|
SystemLocaleLongDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
DefaultLocaleLongDate,
|
DefaultLocaleShortDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
RFC2822Date, // RFC 2822 (+ 850 and 1036 during parsing)
|
DefaultLocaleLongDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
|
||||||
|
#endif
|
||||||
|
RFC2822Date = 8, // RFC 2822 (+ 850 and 1036 during parsing)
|
||||||
ISODateWithMs
|
ISODateWithMs
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1750,7 +1752,7 @@ namespace Qt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// QTBUG-48701
|
// QTBUG-48701
|
||||||
enum ReturnByValue_t { ReturnByValue }; // ### Qt 7: Remove me
|
enum ReturnByValueConstant { ReturnByValue }; // ### Qt 7: Remove me
|
||||||
|
|
||||||
#ifndef Q_QDOC
|
#ifndef Q_QDOC
|
||||||
// NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists.
|
// 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/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** 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 ISODateWithMs \l{ISO 8601} extended format, including milliseconds if applicable.
|
||||||
|
|
||||||
\value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used
|
\value SystemLocaleShortDate \e{This enum value is deprecated and
|
||||||
by the \l{QLocale::system()}{operating system}.
|
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
|
\value SystemLocaleLongDate \e{This enum value is deprecated and
|
||||||
by the \l{QLocale::system()}{operating system}.
|
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
|
\value DefaultLocaleShortDate \e{This enum value is deprecated and
|
||||||
by the \l{QLocale::setDefault()}{application's locale}.
|
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
|
\value DefaultLocaleLongDate \e{This enum value is deprecated and
|
||||||
by the \l{QLocale::setDefault()}{application's locale}.
|
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
|
\value SystemLocaleDate \e{This enum value is deprecated and shall
|
||||||
instead (or Qt::SystemLocaleLongDate if you want long dates).
|
be removed in Qt 6.} It is equivalent to SystemLocaleShortDate.
|
||||||
|
|
||||||
\value LocaleDate \e{This enum value is deprecated.} Use Qt::DefaultLocaleShortDate
|
\value LocaleDate \e{This enum value is deprecated and shall be
|
||||||
instead (or Qt::DefaultLocaleLongDate if you want long dates).
|
removed in Qt 6.} It is equivalent to DefaultLocaleShortDate.
|
||||||
|
|
||||||
\value LocalDate \e{This enum value is deprecated.} Use Qt::SystemLocaleShortDate
|
\value LocalDate \e{This enum value is deprecated and shall be
|
||||||
instead (or Qt::SystemLocaleLongDate if you want long dates).
|
removed in Qt 6.} It is equivalent to SystemLocaleShortDate.
|
||||||
|
|
||||||
\value RFC2822Date \l{RFC 2822}, \l{RFC 850} and \l{RFC 1036} format:
|
\value RFC2822Date \l{RFC 2822}, \l{RFC 850} and \l{RFC 1036} format:
|
||||||
either \c{[ddd,] dd MMM yyyy [hh:mm[:ss]][ ±tzoff]}
|
either \c{[ddd,] dd MMM yyyy [hh:mm[:ss]][ ±tzoff]}
|
||||||
@ -1187,6 +1199,7 @@
|
|||||||
|
|
||||||
\value WA_StyleSheetTarget Indicates that the widget appearance was modified
|
\value WA_StyleSheetTarget Indicates that the widget appearance was modified
|
||||||
by a \l{Qt Style Sheets}{style sheet}. WA_StyleSheet will also be set.
|
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
|
\value WA_TabletTracking Indicates that the widget has tablet
|
||||||
tracking enabled. See QWidget::tabletTracking.
|
tracking enabled. See QWidget::tabletTracking.
|
||||||
@ -3321,7 +3334,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum Qt::ReturnByValue_t
|
\enum Qt::ReturnByValueConstant
|
||||||
\since 5.15
|
\since 5.15
|
||||||
|
|
||||||
This is a dummy type, designed to help users transition from certain deprecated APIs to their replacement APIs.
|
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
|
SOURCES += io/qstorageinfo_mac.cpp
|
||||||
qtConfig(processenvironment): \
|
qtConfig(processenvironment): \
|
||||||
OBJECTIVE_SOURCES += io/qprocess_darwin.mm
|
OBJECTIVE_SOURCES += io/qprocess_darwin.mm
|
||||||
OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm
|
OBJECTIVE_SOURCES += \
|
||||||
|
io/qstandardpaths_mac.mm \
|
||||||
|
io/qfilesystemengine_mac.mm
|
||||||
osx {
|
osx {
|
||||||
LIBS += -framework DiskArbitration -framework IOKit
|
LIBS += -framework DiskArbitration -framework IOKit
|
||||||
} else {
|
} else {
|
||||||
|
@ -551,6 +551,66 @@ QFile::remove(const QString &fileName)
|
|||||||
return QFile(fileName).remove();
|
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.
|
Renames the file currently specified by fileName() to \a newName.
|
||||||
Returns \c true if successful; otherwise returns \c false.
|
Returns \c true if successful; otherwise returns \c false.
|
||||||
|
@ -125,6 +125,9 @@ public:
|
|||||||
bool remove();
|
bool remove();
|
||||||
static bool remove(const QString &fileName);
|
static bool remove(const QString &fileName);
|
||||||
|
|
||||||
|
bool moveToTrash();
|
||||||
|
static bool moveToTrash(const QString &fileName, QString *pathInTrash = nullptr);
|
||||||
|
|
||||||
bool rename(const QString &newName);
|
bool rename(const QString &newName);
|
||||||
static bool rename(const QString &oldName, 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;
|
Returns \c true if the object points to a junction;
|
||||||
otherwise returns \c false.
|
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)); \
|
Q_RETURN_ON_INVALID_FILENAME("Broken filename passed to function", (result)); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
class QFileSystemEngine
|
class Q_AUTOTEST_EXPORT QFileSystemEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool isCaseSensitive()
|
static bool isCaseSensitive()
|
||||||
@ -155,6 +155,7 @@ public:
|
|||||||
static bool createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
static bool createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||||
|
|
||||||
static bool copyFile(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 renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error);
|
||||||
static bool renameOverwriteFile(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);
|
static bool removeFile(const QFileSystemEntry &entry, QSystemError &error);
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
#include "qfilesystemengine_p.h"
|
#include "qfilesystemengine_p.h"
|
||||||
#include "qfile.h"
|
#include "qfile.h"
|
||||||
|
#include "qstorageinfo.h"
|
||||||
|
#include "qtextstream.h"
|
||||||
|
|
||||||
#include <QtCore/qoperatingsystemversion.h>
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
#include <QtCore/private/qcore_unix_p.h>
|
#include <QtCore/private/qcore_unix_p.h>
|
||||||
@ -1197,6 +1199,216 @@ bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSy
|
|||||||
return false;
|
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
|
//static
|
||||||
bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
|
bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "qoperatingsystemversion.h"
|
#include "qoperatingsystemversion.h"
|
||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
#include "qsysinfo.h"
|
#include "qsysinfo.h"
|
||||||
|
#include "qscopeguard.h"
|
||||||
#include "private/qabstractfileengine_p.h"
|
#include "private/qabstractfileengine_p.h"
|
||||||
#include "private/qfsfileengine_p.h"
|
#include "private/qfsfileengine_p.h"
|
||||||
#include <private/qsystemlibrary_p.h>
|
#include <private/qsystemlibrary_p.h>
|
||||||
@ -59,6 +60,8 @@
|
|||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
# include <shlobj.h>
|
# include <shlobj.h>
|
||||||
|
# include <shobjidl.h>
|
||||||
|
# include <shellapi.h>
|
||||||
# include <lm.h>
|
# include <lm.h>
|
||||||
# include <accctrl.h>
|
# include <accctrl.h>
|
||||||
#endif
|
#endif
|
||||||
@ -422,6 +425,104 @@ static inline bool getFindData(QString path, WIN32_FIND_DATA &findData)
|
|||||||
return false;
|
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)
|
bool QFileSystemEngine::uncListSharesOnServer(const QString &server, QStringList *list)
|
||||||
{
|
{
|
||||||
DWORD res = ERROR_NOT_SUPPORTED;
|
DWORD res = ERROR_NOT_SUPPORTED;
|
||||||
@ -1431,6 +1532,103 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &
|
|||||||
return ret;
|
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
|
//static
|
||||||
bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error,
|
bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error,
|
||||||
QFileSystemMetaData *data)
|
QFileSystemMetaData *data)
|
||||||
|
@ -714,7 +714,7 @@ void QIODevicePrivate::setReadChannelCount(int count)
|
|||||||
/*!
|
/*!
|
||||||
\since 5.7
|
\since 5.7
|
||||||
|
|
||||||
Returns the the index of the current write channel.
|
Returns the index of the current write channel.
|
||||||
|
|
||||||
\sa setCurrentWriteChannel(), writeChannelCount()
|
\sa setCurrentWriteChannel(), writeChannelCount()
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,8 @@
|
|||||||
#include <sys/file.h> // flock
|
#include <sys/file.h> // flock
|
||||||
#endif
|
#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_EX
|
||||||
# undef LOCK_NB
|
# undef LOCK_NB
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
|
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
|
||||||
# include <mntent.h>
|
# include <mntent.h>
|
||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
|
# include <sys/sysmacros.h>
|
||||||
#elif defined(Q_OS_SOLARIS)
|
#elif defined(Q_OS_SOLARIS)
|
||||||
# include <sys/mnttab.h>
|
# include <sys/mnttab.h>
|
||||||
# include <sys/statvfs.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).
|
//(2) parent ID: the ID of the parent mount (or of self for the top of the mount tree).
|
||||||
// int parent_id;
|
// int parent_id;
|
||||||
//(3) major:minor: the value of st_dev for files on this filesystem (see stat(2)).
|
//(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.
|
//(4) root: the pathname of the directory in the filesystem which forms the root of this mount.
|
||||||
char *subvolume;
|
char *subvolume;
|
||||||
//(5) mount point: the pathname of the mount point relative to the process's root directory.
|
//(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);
|
int rdevminor = qstrtoll(ptr + 1, const_cast<const char **>(&ptr), 10, &ok);
|
||||||
if (!ptr || !ok)
|
if (!ptr || !ok)
|
||||||
return false;
|
return false;
|
||||||
Q_UNUSED(rdevmajor);
|
mnt.rdev = makedev(rdevmajor, rdevminor);
|
||||||
Q_UNUSED(rdevminor);
|
|
||||||
|
|
||||||
if (*ptr != ' ')
|
if (*ptr != ' ')
|
||||||
return false;
|
return false;
|
||||||
@ -566,6 +566,21 @@ inline QByteArray QStorageIterator::fileSystemType() const
|
|||||||
|
|
||||||
inline QByteArray QStorageIterator::device() 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);
|
return QByteArray(mnt.mnt_fsname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@
|
|||||||
#include "qhash.h"
|
#include "qhash.h"
|
||||||
#include "qdir.h" // for QDir::fromNativeSeparators
|
#include "qdir.h" // for QDir::fromNativeSeparators
|
||||||
#include "qdatastream.h"
|
#include "qdatastream.h"
|
||||||
#if QT_CONFIG(topleveldomain)
|
#if QT_CONFIG(topleveldomain) // ### Qt6: Remove section
|
||||||
#include "qtldurl_p.h"
|
#include "qtldurl_p.h"
|
||||||
#endif
|
#endif
|
||||||
#include "private/qipaddress_p.h"
|
#include "private/qipaddress_p.h"
|
||||||
@ -3149,10 +3149,13 @@ bool QUrl::hasFragment() const
|
|||||||
return d->hasFragment();
|
return d->hasFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
#if QT_CONFIG(topleveldomain)
|
#if QT_CONFIG(topleveldomain)
|
||||||
/*!
|
/*!
|
||||||
\since 4.8
|
\since 4.8
|
||||||
|
|
||||||
|
\deprecated
|
||||||
|
|
||||||
Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net).
|
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
|
Note that the return value is prefixed with a '.' unless the
|
||||||
URL does not contain a valid TLD, in which case the function returns
|
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;
|
return tld;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||||
/*!
|
/*!
|
||||||
Returns the result of the merge of this URL with \a relative. This
|
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.
|
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);
|
void setHost(const QString &host, ParsingMode mode = DecodedMode);
|
||||||
QString host(ComponentFormattingOptions = FullyDecoded) const;
|
QString host(ComponentFormattingOptions = FullyDecoded) const;
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
#if QT_CONFIG(topleveldomain)
|
#if QT_CONFIG(topleveldomain)
|
||||||
QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const;
|
QT_DEPRECATED QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const;
|
||||||
#endif
|
#endif
|
||||||
|
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||||
|
|
||||||
void setPort(int port);
|
void setPort(int port);
|
||||||
int port(int defaultPort = -1) const;
|
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
|
It is good practice to check that persistent model indexes are valid
|
||||||
before using them.
|
before using them.
|
||||||
|
|
||||||
|
\note You cannot store a QStandardItemModel's QPersistentModelIndex
|
||||||
|
in one of the model's items.
|
||||||
|
|
||||||
\sa {Model/View Programming}, QModelIndex, QAbstractItemModel
|
\sa {Model/View Programming}, QModelIndex, QAbstractItemModel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ AppleApplication *qt_apple_sharedApplication()
|
|||||||
qWarning() << "accessing the shared" << [AppleApplication class]
|
qWarning() << "accessing the shared" << [AppleApplication class]
|
||||||
<< "is not allowed in application extensions";
|
<< "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
|
// 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.
|
// in case, unless we don't care about being App Store compliant.
|
||||||
#if QT_CONFIG(appstore_compliant)
|
#if QT_CONFIG(appstore_compliant)
|
||||||
|
@ -988,6 +988,30 @@ enum IteratorCapability
|
|||||||
RandomAccessCapability = 4
|
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>
|
template<typename T, typename Category = typename std::iterator_traits<typename T::const_iterator>::iterator_category>
|
||||||
struct CapabilitiesImpl;
|
struct CapabilitiesImpl;
|
||||||
|
|
||||||
@ -1019,6 +1043,12 @@ template<typename T>
|
|||||||
struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> >
|
struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> >
|
||||||
{ static int size(const std::list<T> *t) { return int(t->size()); } };
|
{ 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
|
class QSequentialIterableImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1027,19 +1057,37 @@ public:
|
|||||||
int _metaType_id;
|
int _metaType_id;
|
||||||
uint _metaType_flags;
|
uint _metaType_flags;
|
||||||
uint _iteratorCapabilities;
|
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 int(*sizeFunc)(const void *p);
|
||||||
typedef const void * (*atFunc)(const void *p, int);
|
typedef const void * (*atFunc)(const void *p, int);
|
||||||
typedef void (*moveIteratorFunc)(const void *p, void **);
|
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 void (*advanceFunc)(void **p, int);
|
||||||
typedef VariantData (*getFunc)( void * const *p, int metaTypeId, uint flags);
|
typedef VariantData (*getFunc)( void * const *p, int metaTypeId, uint flags);
|
||||||
typedef void (*destroyIterFunc)(void **p);
|
typedef void (*destroyIterFunc)(void **p);
|
||||||
typedef bool (*equalIterFunc)(void * const *p, void * const *other);
|
typedef bool (*equalIterFunc)(void * const *p, void * const *other);
|
||||||
typedef void (*copyIterFunc)(void **, void * const *);
|
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;
|
sizeFunc _size;
|
||||||
atFunc _at;
|
atFunc _at;
|
||||||
moveIteratorFunc _moveToBegin;
|
union {
|
||||||
moveIteratorFunc _moveToEnd;
|
moveIteratorFunc _moveToBegin;
|
||||||
|
moveIteratorFunc2 _moveTo;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
moveIteratorFunc _moveToEnd;
|
||||||
|
appendFunction _append;
|
||||||
|
};
|
||||||
advanceFunc _advance;
|
advanceFunc _advance;
|
||||||
getFunc _get;
|
getFunc _get;
|
||||||
destroyIterFunc _destroyIter;
|
destroyIterFunc _destroyIter;
|
||||||
@ -1066,6 +1114,15 @@ public:
|
|||||||
static void moveToEndImpl(const void *container, void **iterator)
|
static void moveToEndImpl(const void *container, void **iterator)
|
||||||
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->end()); }
|
{ 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>
|
template<class T>
|
||||||
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
|
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
|
||||||
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
|
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
|
||||||
@ -1076,11 +1133,11 @@ public:
|
|||||||
, _iterator(nullptr)
|
, _iterator(nullptr)
|
||||||
, _metaType_id(qMetaTypeId<typename T::value_type>())
|
, _metaType_id(qMetaTypeId<typename T::value_type>())
|
||||||
, _metaType_flags(QTypeInfo<typename T::value_type>::isPointer)
|
, _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>)
|
, _size(sizeImpl<T>)
|
||||||
, _at(atImpl<T>)
|
, _at(atImpl<T>)
|
||||||
, _moveToBegin(moveToBeginImpl<T>)
|
, _moveTo(moveToImpl<T>)
|
||||||
, _moveToEnd(moveToEndImpl<T>)
|
, _append(ContainerCapabilitiesImpl<T>::appendImpl)
|
||||||
, _advance(IteratorOwner<typename T::const_iterator>::advance)
|
, _advance(IteratorOwner<typename T::const_iterator>::advance)
|
||||||
, _get(getImpl<T>)
|
, _get(getImpl<T>)
|
||||||
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
|
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
|
||||||
@ -1094,7 +1151,7 @@ public:
|
|||||||
, _iterator(nullptr)
|
, _iterator(nullptr)
|
||||||
, _metaType_id(QMetaType::UnknownType)
|
, _metaType_id(QMetaType::UnknownType)
|
||||||
, _metaType_flags(0)
|
, _metaType_flags(0)
|
||||||
, _iteratorCapabilities(0)
|
, _iteratorCapabilities(0 | (1 << 4) ) // no iterator capabilities, revision 1
|
||||||
, _size(nullptr)
|
, _size(nullptr)
|
||||||
, _at(nullptr)
|
, _at(nullptr)
|
||||||
, _moveToBegin(nullptr)
|
, _moveToBegin(nullptr)
|
||||||
@ -1107,8 +1164,18 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void moveToBegin() { _moveToBegin(_iterable, &_iterator); }
|
inline void moveToBegin() {
|
||||||
inline void moveToEnd() { _moveToEnd(_iterable, &_iterator); }
|
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 bool equal(const QSequentialIterableImpl&other) const { return _equalIter(&_iterator, &other._iterator); }
|
||||||
inline QSequentialIterableImpl &advance(int i) {
|
inline QSequentialIterableImpl &advance(int i) {
|
||||||
Q_ASSERT(i > 0 || _iteratorCapabilities & BiDirectionalCapability);
|
Q_ASSERT(i > 0 || _iteratorCapabilities & BiDirectionalCapability);
|
||||||
@ -1116,6 +1183,11 @@ public:
|
|||||||
return *this;
|
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); }
|
inline VariantData getCurrent() const { return _get(&_iterator, _metaType_id, _metaType_flags); }
|
||||||
|
|
||||||
VariantData at(int idx) const
|
VariantData at(int idx) const
|
||||||
|
@ -72,40 +72,44 @@ public:
|
|||||||
|
|
||||||
QVariant retrieveTypedData(const QString &format, QMetaType::Type type) const;
|
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)
|
void QMimeDataPrivate::removeData(const QString &format)
|
||||||
{
|
{
|
||||||
for (int i=0; i<dataList.size(); i++) {
|
const auto it = find(format);
|
||||||
if (dataList.at(i).format == format) {
|
if (it != dataList.end())
|
||||||
dataList.removeAt(i);
|
dataList.erase(it);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMimeDataPrivate::setData(const QString &format, const QVariant &data)
|
void QMimeDataPrivate::setData(const QString &format, const QVariant &data)
|
||||||
{
|
{
|
||||||
// remove it first if the format is already here.
|
const auto it = find(format);
|
||||||
removeData(format);
|
if (it == dataList.end())
|
||||||
QMimeDataStruct mimeData;
|
dataList.push_back({format, data});
|
||||||
mimeData.format = format;
|
else
|
||||||
mimeData.data = data;
|
it->data = data;
|
||||||
dataList += mimeData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant QMimeDataPrivate::getData(const QString &format) const
|
QVariant QMimeDataPrivate::getData(const QString &format) const
|
||||||
{
|
{
|
||||||
QVariant data;
|
const auto it = find(format);
|
||||||
for (int i=0; i<dataList.size(); i++) {
|
if (it == dataList.cend())
|
||||||
if (dataList.at(i).format == format) {
|
return {};
|
||||||
data = dataList.at(i).data;
|
else
|
||||||
break;
|
return it->data;
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const
|
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const
|
||||||
@ -635,10 +639,9 @@ QStringList QMimeData::formats() const
|
|||||||
{
|
{
|
||||||
Q_D(const QMimeData);
|
Q_D(const QMimeData);
|
||||||
QStringList list;
|
QStringList list;
|
||||||
const int size = d->dataList.size();
|
list.reserve(static_cast<int>(d->dataList.size()));
|
||||||
list.reserve(size);
|
for (auto &e : d->dataList)
|
||||||
for (int i = 0; i < size; ++i)
|
list += e.format;
|
||||||
list += d->dataList.at(i).format;
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +53,36 @@ public:
|
|||||||
Q_Q(QSignalMapper);
|
Q_Q(QSignalMapper);
|
||||||
q->removeMappings(q->sender());
|
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 *, int> intHash;
|
||||||
QHash<QObject *, QString> stringHash;
|
QHash<QObject *, QString> stringHash;
|
||||||
QHash<QObject *, QWidget*> widgetHash;
|
QHash<QObject *, QWidget*> widgetHash;
|
||||||
QHash<QObject *, QObject*> objectHash;
|
QHash<QObject *, QObject*> objectHash;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -74,11 +99,12 @@ public:
|
|||||||
use lambdas for passing custom parameters to slots. This is less
|
use lambdas for passing custom parameters to slots. This is less
|
||||||
costly and will simplify the code.
|
costly and will simplify the code.
|
||||||
|
|
||||||
The class supports the mapping of particular strings or integers
|
The class supports the mapping of particular strings, integers,
|
||||||
with particular objects using setMapping(). The objects' signals
|
objects and widgets with particular objects using setMapping().
|
||||||
can then be connected to the map() slot which will emit the
|
The objects' signals can then be connected to the map() slot which
|
||||||
mapped() signal with the string or integer associated with the
|
will emit a signal (it could be mappedInt(), mappedString(),
|
||||||
original signalling object. Mappings can be removed later using
|
mappedWidget() and mappedObject()) with a value associated with
|
||||||
|
the original signalling object. Mappings can be removed later using
|
||||||
removeMappings().
|
removeMappings().
|
||||||
|
|
||||||
Example: Suppose we want to create a custom widget that contains
|
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
|
created. We connect each button's \c clicked() signal to the
|
||||||
signal mapper's map() slot, and create a mapping in the signal
|
signal mapper's map() slot, and create a mapping in the signal
|
||||||
mapper from each button to the button's text. Finally we connect
|
mapper from each button to the button's text. Finally we connect
|
||||||
the signal mapper's mapped() signal to the custom widget's \c
|
the signal mapper's mappedString() signal to the custom widget's
|
||||||
clicked() signal. When the user clicks a button, the custom
|
\c clicked() signal. When the user clicks a button, the custom
|
||||||
widget will emit a single \c clicked() signal whose argument is
|
widget will emit a single \c clicked() signal whose argument is
|
||||||
the text of the button the user clicked.
|
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
|
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.
|
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,
|
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.
|
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,
|
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.
|
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,
|
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.
|
There may be at most one object for each sender.
|
||||||
*/
|
*/
|
||||||
@ -259,20 +285,14 @@ void QSignalMapper::map() { map(sender()); }
|
|||||||
*/
|
*/
|
||||||
void QSignalMapper::map(QObject *sender)
|
void QSignalMapper::map(QObject *sender)
|
||||||
{
|
{
|
||||||
Q_D(QSignalMapper);
|
d_func()->emitMappedValues(sender);
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
/*!
|
/*!
|
||||||
\fn void QSignalMapper::mapped(int i)
|
\fn void QSignalMapper::mapped(int i)
|
||||||
|
\obsolete
|
||||||
|
\overload
|
||||||
|
|
||||||
This signal is emitted when map() is signalled from an object that
|
This signal is emitted when map() is signalled from an object that
|
||||||
has an integer mapping set. The object's mapped integer is passed
|
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)
|
\fn void QSignalMapper::mapped(const QString &text)
|
||||||
|
\obsolete
|
||||||
|
\overload
|
||||||
|
|
||||||
This signal is emitted when map() is signalled from an object that
|
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
|
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)
|
\fn void QSignalMapper::mapped(QWidget *widget)
|
||||||
|
\obsolete
|
||||||
|
\overload
|
||||||
|
|
||||||
This signal is emitted when map() is signalled from an object that
|
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
|
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)
|
\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
|
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
|
has an object mapping set. The object provided by the map is passed in
|
||||||
|
@ -66,10 +66,20 @@ public:
|
|||||||
QObject *mapping(QObject *object) const;
|
QObject *mapping(QObject *object) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
|
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedInt(int) instead")
|
||||||
void mapped(int);
|
void mapped(int);
|
||||||
|
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedString(const QString&) instead")
|
||||||
void mapped(const QString &);
|
void mapped(const QString &);
|
||||||
|
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedWidget(QWidget *) instead")
|
||||||
void mapped(QWidget *);
|
void mapped(QWidget *);
|
||||||
|
QT_DEPRECATED_VERSION_X_5_15("Use QSignalMapper::mappedObject(QObject *) instead")
|
||||||
void mapped(QObject *);
|
void mapped(QObject *);
|
||||||
|
#endif
|
||||||
|
void mappedInt(int);
|
||||||
|
void mappedString(const QString &);
|
||||||
|
void mappedWidget(QWidget *);
|
||||||
|
void mappedObject(QObject *);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void map();
|
void map();
|
||||||
|
@ -283,7 +283,7 @@ class QTranslatorPrivate : public QObjectPrivate
|
|||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QTranslator)
|
Q_DECLARE_PUBLIC(QTranslator)
|
||||||
public:
|
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() :
|
QTranslatorPrivate() :
|
||||||
#if defined(QT_USE_MMAP)
|
#if defined(QT_USE_MMAP)
|
||||||
@ -316,6 +316,9 @@ public:
|
|||||||
uint contextLength;
|
uint contextLength;
|
||||||
uint numerusRulesLength;
|
uint numerusRulesLength;
|
||||||
|
|
||||||
|
QString language;
|
||||||
|
QString filePath;
|
||||||
|
|
||||||
bool do_load(const QString &filename, const QString &directory);
|
bool do_load(const QString &filename, const QString &directory);
|
||||||
bool do_load(const uchar *data, qsizetype len, 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,
|
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;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(QT_USE_MMAP)
|
#if defined(QT_USE_MMAP)
|
||||||
if (used_mmap) {
|
if (used_mmap) {
|
||||||
@ -829,7 +834,9 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == QTranslatorPrivate::Contexts) {
|
if (tag == QTranslatorPrivate::Language) {
|
||||||
|
language = QString::fromUtf8((const char*)data, blockLen);
|
||||||
|
} else if (tag == QTranslatorPrivate::Contexts) {
|
||||||
contextArray = data;
|
contextArray = data;
|
||||||
contextLength = blockLen;
|
contextLength = blockLen;
|
||||||
} else if (tag == QTranslatorPrivate::Hashes) {
|
} else if (tag == QTranslatorPrivate::Hashes) {
|
||||||
@ -1091,6 +1098,9 @@ void QTranslatorPrivate::clear()
|
|||||||
qDeleteAll(subTranslators);
|
qDeleteAll(subTranslators);
|
||||||
subTranslators.clear();
|
subTranslators.clear();
|
||||||
|
|
||||||
|
language.clear();
|
||||||
|
filePath.clear();
|
||||||
|
|
||||||
if (QCoreApplicationPrivate::isTranslatorInstalled(q))
|
if (QCoreApplicationPrivate::isTranslatorInstalled(q))
|
||||||
QCoreApplication::postEvent(QCoreApplication::instance(),
|
QCoreApplication::postEvent(QCoreApplication::instance(),
|
||||||
new QEvent(QEvent::LanguageChange));
|
new QEvent(QEvent::LanguageChange));
|
||||||
@ -1132,6 +1142,32 @@ bool QTranslator::isEmpty() const
|
|||||||
&& d->subTranslators.isEmpty();
|
&& 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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "moc_qtranslator.cpp"
|
#include "moc_qtranslator.cpp"
|
||||||
|
@ -63,6 +63,9 @@ public:
|
|||||||
|
|
||||||
virtual bool isEmpty() const;
|
virtual bool isEmpty() const;
|
||||||
|
|
||||||
|
QString language() const;
|
||||||
|
QString filePath() const;
|
||||||
|
|
||||||
bool load(const QString & filename,
|
bool load(const QString & filename,
|
||||||
const QString & directory = QString(),
|
const QString & directory = QString(),
|
||||||
const QString & search_delimiters = 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
|
||||||
#endif
|
#endif
|
||||||
case QMetaType::QDate:
|
case QMetaType::QDate:
|
||||||
*dt = QDateTime(*v_cast<QDate>(d));
|
*dt = v_cast<QDate>(d)->startOfDay();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
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);
|
*static_cast<QCborValue *>(result) = *v_cast<QByteArray>(d);
|
||||||
break;
|
break;
|
||||||
case QMetaType::QDate:
|
case QMetaType::QDate:
|
||||||
*static_cast<QCborValue *>(result) = QCborValue(QDateTime(*v_cast<QDate>(d)));
|
*static_cast<QCborValue *>(result) = QCborValue(v_cast<QDate>(d)->startOfDay());
|
||||||
break;
|
break;
|
||||||
case QMetaType::QDateTime:
|
case QMetaType::QDateTime:
|
||||||
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QDateTime>(d));
|
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QDateTime>(d));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
** Copyright (C) 2018 Intel Corporation
|
** Copyright (C) 2020 Intel Corporation
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** 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++) {
|
for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
|
||||||
if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
|
if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
|
||||||
continue;
|
continue;
|
||||||
|
if (path.isEmpty() && prefixes.at(prefix).contains(QLatin1Char('/')))
|
||||||
|
continue;
|
||||||
if (!suffixes.at(suffix).isEmpty() && name.endsWith(suffixes.at(suffix)))
|
if (!suffixes.at(suffix).isEmpty() && name.endsWith(suffixes.at(suffix)))
|
||||||
continue;
|
continue;
|
||||||
if (loadHints & QLibrary::LoadArchiveMemberHint) {
|
if (loadHints & QLibrary::LoadArchiveMemberHint) {
|
||||||
|
@ -342,7 +342,7 @@ static QString locatePlugin(const QString& fileName)
|
|||||||
QPluginLoader will automatically look for the file with the appropriate
|
QPluginLoader will automatically look for the file with the appropriate
|
||||||
suffix (see QLibrary::isLibrary()).
|
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(),
|
in all plugin locations specified by QCoreApplication::libraryPaths(),
|
||||||
unless the file name has an absolute path. After loading the plugin
|
unless the file name has an absolute path. After loading the plugin
|
||||||
successfully, fileName() returns the fully-qualified file name of
|
successfully, fileName() returns the fully-qualified file name of
|
||||||
|
@ -3185,6 +3185,26 @@ QStateMachine::WrappedEvent::~WrappedEvent()
|
|||||||
\sa QStateMachine::running
|
\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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "qstatemachine.moc"
|
#include "qstatemachine.moc"
|
||||||
|
@ -48,6 +48,10 @@
|
|||||||
#include <QtCore/qset.h>
|
#include <QtCore/qset.h>
|
||||||
#include <QtCore/qvariant.h>
|
#include <QtCore/qvariant.h>
|
||||||
|
|
||||||
|
#if __has_include(<chrono>)
|
||||||
|
# include <chrono>
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_REQUIRE_CONFIG(statemachine);
|
QT_REQUIRE_CONFIG(statemachine);
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -145,6 +149,13 @@ public:
|
|||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
#endif
|
#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:
|
public Q_SLOTS:
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
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