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

This commit is contained in:
Lars Knoll 2019-08-06 12:24:37 +02:00
commit 05b90be3c5
718 changed files with 8677 additions and 4429 deletions

View File

@ -2,6 +2,7 @@ load(qt_build_config)
CONFIG += warning_clean CONFIG += warning_clean
DEFINES += QT_NO_JAVA_STYLE_ITERATORS DEFINES += QT_NO_JAVA_STYLE_ITERATORS
DEFINES += QT_NO_LINKED_LIST
QT_SOURCE_TREE = $$PWD QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD) QT_BUILD_TREE = $$shadowed($$PWD)

View File

@ -1092,7 +1092,7 @@ foreach my $lib (@modules_to_sync) {
# } # }
my $class_header = "$class "; my $class_header = "$class ";
$pri_install_gfiles .= $class_header $pri_install_gfiles .= $class_header
unless ($shadow || $pri_install_gfiles =~ $class_header); unless ($shadow || $pri_install_gfiles =~ m/\b$class_header/);
$injection .= ":$class"; $injection .= ":$class";
} }

View File

@ -1,2 +1 @@
TARGET = arch
SOURCES = arch.cpp SOURCES = arch.cpp

View File

@ -1,2 +1,2 @@
option(host_build) option(host_build)
include(arch.pro) SOURCES = arch.cpp

2
configure vendored
View File

@ -358,7 +358,7 @@ if [ -z "$QT_MAJOR_VERSION" ]; then
fi fi
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# initalize variables # initialize variables
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# QTDIR may be set and point to an old or system-wide Qt installation # QTDIR may be set and point to an old or system-wide Qt installation

View File

@ -252,12 +252,14 @@
"label": "target architecture", "label": "target architecture",
"type": "architecture", "type": "architecture",
"test": "arch", "test": "arch",
"output": "arch",
"log": "arch" "log": "arch"
}, },
"host_architecture": { "host_architecture": {
"label": "host architecture", "label": "host architecture",
"type": "architecture", "type": "architecture",
"test": "arch", "test": "arch",
"output": "arch_host",
"host": true, "host": true,
"pro": "arch_host.pro", "pro": "arch_host.pro",
"log": "arch" "log": "arch"
@ -1323,7 +1325,7 @@
"ccache": { "ccache": {
"label": "Using ccache", "label": "Using ccache",
"autoDetect": false, "autoDetect": false,
"condition": "config.unix && tests.ccache", "condition": "tests.ccache",
"output": [ "privateConfig" ] "output": [ "privateConfig" ]
}, },
"msvc_mp": { "msvc_mp": {

View File

@ -286,20 +286,39 @@ defineTest(qtConfTest_architecture) {
!qtConfTest_compile($${1}): \ !qtConfTest_compile($${1}): \
error("Could not determine $$eval($${1}.label). See config.log for details.") error("Could not determine $$eval($${1}.label). See config.log for details.")
host = $$eval($${1}.host)
isEmpty(host): host = false
file_prefix =
exts = -
$$host {
equals(QMAKE_HOST.os, Windows): \
exts = .exe
} else {
win32 {
exts = .exe
} else:android {
file_prefix = lib
exts = .so
} else:wasm {
exts = .wasm .o
}
}
test = $$eval($${1}.test) test = $$eval($${1}.test)
output = $$eval($${1}.output)
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
unix:exists($$test_out_dir/arch): \ test_out_file =
content = $$cat($$test_out_dir/arch, blob) for(ext, exts) {
else: win32:exists($$test_out_dir/arch.exe): \ equals(ext, -): ext =
content = $$cat($$test_out_dir/arch.exe, blob) f = $$test_out_dir/$$file_prefix$$output$$ext
else: android:exists($$test_out_dir/libarch.so): \ exists($$f) {
content = $$cat($$test_out_dir/libarch.so, blob) test_out_file = $$f
else: wasm:exists($$test_out_dir/arch.wasm): \ break()
content = $$cat($$test_out_dir/arch.wasm, blob) }
else: wasm:exists($$test_out_dir/arch.o): \ }
content = $$cat($$test_out_dir/arch.o, blob) isEmpty(test_out_file): \
else: \
error("$$eval($${1}.label) detection binary not found.") error("$$eval($${1}.label) detection binary not found.")
content = $$cat($$test_out_file, blob)
arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*" arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*" subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"

View File

@ -140,10 +140,10 @@ void GLWidget::initializeGL()
{ {
initializeOpenGLFunctions(); initializeOpenGLFunctions();
qglClearColor(qtPurple.dark()); qglClearColor(qtPurple.darker());
logo = new QtLogo(this, 64); logo = new QtLogo(this, 64);
logo->setColor(qtGreen.dark()); logo->setColor(qtGreen.darker());
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);

View File

@ -130,7 +130,7 @@ void GLWidget::initializeGL()
glEnable(GL_MULTISAMPLE); glEnable(GL_MULTISAMPLE);
logo = new QtLogo(this); logo = new QtLogo(this);
logo->setColor(qtGreen.dark()); logo->setColor(qtGreen.darker());
} }
//! [2] //! [2]
@ -163,7 +163,7 @@ void GLWidget::paintEvent(QPaintEvent *event)
//! [4] //! [4]
//! [6] //! [6]
qglClearColor(qtPurple.dark()); qglClearColor(qtPurple.darker());
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);

View File

@ -91,6 +91,9 @@ FragmentToy::FragmentToy(const QString &fragmentSource, QObject *parent)
} }
} }
FragmentToy::~FragmentToy()
= default;
void FragmentToy::draw(const QSize &windowSize) void FragmentToy::draw(const QSize &windowSize)
{ {
if (!m_program) if (!m_program)
@ -120,7 +123,7 @@ void FragmentToy::draw(const QSize &windowSize)
if (!m_vertex_shader->compileSourceCode(vertex_shader)) { if (!m_vertex_shader->compileSourceCode(vertex_shader)) {
qWarning() << "Failed to compile the vertex shader:" << m_vertex_shader->log(); qWarning() << "Failed to compile the vertex shader:" << m_vertex_shader->log();
} }
if (!m_program->addShader(m_vertex_shader.data())) { if (!m_program->addShader(m_vertex_shader.get())) {
qWarning() << "Failed to add vertex shader to program:" << m_program->log(); qWarning() << "Failed to add vertex shader to program:" << m_program->log();
} }
} }
@ -153,7 +156,7 @@ void FragmentToy::draw(const QSize &windowSize)
} }
if (m_fragment_shader) { if (m_fragment_shader) {
if (!m_program->addShader(m_fragment_shader.data())) { if (!m_program->addShader(m_fragment_shader.get())) {
qWarning() << "Failed to add fragment shader to program:" << m_program->log(); qWarning() << "Failed to add fragment shader to program:" << m_program->log();
} }
} }
@ -197,14 +200,14 @@ void FragmentToy::fileChanged(const QString &path)
m_fragment_file_last_modified = fragment_source.lastModified(); m_fragment_file_last_modified = fragment_source.lastModified();
m_recompile_shaders = true; m_recompile_shaders = true;
if (m_program) { if (m_program) {
m_program->removeShader(m_fragment_shader.data()); m_program->removeShader(m_fragment_shader.get());
m_fragment_shader.reset(nullptr); m_fragment_shader.reset(nullptr);
} }
} }
} else { } else {
m_recompile_shaders = true; m_recompile_shaders = true;
if (m_program) { if (m_program) {
m_program->removeShader(m_fragment_shader.data()); m_program->removeShader(m_fragment_shader.get());
m_fragment_shader.reset(nullptr); m_fragment_shader.reset(nullptr);
} }
} }

View File

@ -62,11 +62,14 @@
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <memory>
class FragmentToy : public QObject, protected QOpenGLFunctions class FragmentToy : public QObject, protected QOpenGLFunctions
{ {
Q_OBJECT Q_OBJECT
public: public:
FragmentToy(const QString &fragmentSource, QObject *parent = 0); explicit FragmentToy(const QString &fragmentSource, QObject *parent = nullptr);
~FragmentToy();
void draw(const QSize &windowSize); void draw(const QSize &windowSize);
@ -79,9 +82,9 @@ private:
QString m_fragment_file; QString m_fragment_file;
QDateTime m_fragment_file_last_modified; QDateTime m_fragment_file_last_modified;
QScopedPointer<QOpenGLShaderProgram> m_program; std::unique_ptr<QOpenGLShaderProgram> m_program;
QScopedPointer<QOpenGLShader> m_vertex_shader; std::unique_ptr<QOpenGLShader> m_vertex_shader;
QScopedPointer<QOpenGLShader> m_fragment_shader; std::unique_ptr<QOpenGLShader> m_fragment_shader;
QOpenGLVertexArrayObject m_vao; QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vertex_buffer; QOpenGLBuffer m_vertex_buffer;
GLuint m_vertex_coord_pos; GLuint m_vertex_coord_pos;

View File

@ -160,9 +160,10 @@ void Window::iconActivated(QSystemTrayIcon::ActivationReason reason)
void Window::showMessage() void Window::showMessage()
{ {
showIconCheckBox->setChecked(true); showIconCheckBox->setChecked(true);
QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon( int selectedIcon = typeComboBox->itemData(typeComboBox->currentIndex()).toInt();
typeComboBox->itemData(typeComboBox->currentIndex()).toInt()); QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon(selectedIcon);
if (msgIcon == QSystemTrayIcon::NoIcon) {
if (selectedIcon == -1) { // custom icon
QIcon icon(iconComboBox->itemIcon(iconComboBox->currentIndex())); QIcon icon(iconComboBox->itemIcon(iconComboBox->currentIndex()));
trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon, trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
durationSpinBox->value() * 1000); durationSpinBox->value() * 1000);
@ -222,7 +223,7 @@ void Window::createMessageGroupBox()
QStyle::SP_MessageBoxCritical), tr("Critical"), QStyle::SP_MessageBoxCritical), tr("Critical"),
QSystemTrayIcon::Critical); QSystemTrayIcon::Critical);
typeComboBox->addItem(QIcon(), tr("Custom icon"), typeComboBox->addItem(QIcon(), tr("Custom icon"),
QSystemTrayIcon::NoIcon); -1);
typeComboBox->setCurrentIndex(1); typeComboBox->setCurrentIndex(1);
durationLabel = new QLabel(tr("Duration:")); durationLabel = new QLabel(tr("Duration:"));

View File

@ -317,7 +317,7 @@ void Dialog::setInteger()
{ {
//! [0] //! [0]
bool ok; bool ok;
int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"), int i = QInputDialog::getInt(this, tr("QInputDialog::getInt()"),
tr("Percentage:"), 25, 0, 100, 1, &ok); tr("Percentage:"), 25, 0, 100, 1, &ok);
if (ok) if (ok)
integerLabel->setText(tr("%1%").arg(i)); integerLabel->setText(tr("%1%").arg(i));

View File

@ -457,7 +457,7 @@ void ArthurStyle::polish(QWidget *widget)
QPalette pal = widget->palette(); QPalette pal = widget->palette();
if (widget->isWindow()) { if (widget->isWindow()) {
pal.setColor(QPalette::Background, QColor(241, 241, 241)); pal.setColor(QPalette::Window, QColor(241, 241, 241));
widget->setPalette(pal); widget->setPalette(pal);
} }
@ -474,7 +474,7 @@ void ArthurStyle::unpolish(QWidget *widget)
void ArthurStyle::polish(QPalette &palette) void ArthurStyle::polish(QPalette &palette)
{ {
palette.setColor(QPalette::Background, QColor(241, 241, 241)); palette.setColor(QPalette::Window, QColor(241, 241, 241));
} }
QRect ArthurStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const QRect ArthurStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const

View File

@ -153,7 +153,7 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
int o = 10; int o = 10;
QBrush bg = palette().brush(QPalette::Background); QBrush bg = palette().brush(QPalette::Window);
painter.fillRect(0, 0, o, o, bg); painter.fillRect(0, 0, o, o, bg);
painter.fillRect(width() - o, 0, o, o, bg); painter.fillRect(width() - o, 0, o, o, bg);
painter.fillRect(0, height() - o, o, o, bg); painter.fillRect(0, height() - o, o, o, bg);

View File

@ -105,7 +105,7 @@ public:
m_green = new LightWidget(Qt::green); m_green = new LightWidget(Qt::green);
vbox->addWidget(m_green); vbox->addWidget(m_green);
QPalette pal = palette(); QPalette pal = palette();
pal.setColor(QPalette::Background, Qt::black); pal.setColor(QPalette::Window, Qt::black);
setPalette(pal); setPalette(pal);
setAutoFillBackground(true); setAutoFillBackground(true);
} }

View File

@ -26,6 +26,10 @@ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND
CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
internal_module {
MODULE = "$${MODULE}_private"
}
# Core, Network, an external module named Foo # Core, Network, an external module named Foo
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE}) CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
@ -112,6 +116,10 @@ win32:!static:!staticlib {
static|staticlib:CMAKE_STATIC_TYPE = true static|staticlib:CMAKE_STATIC_TYPE = true
internal_module {
CMAKE_INTERNAL_MODULE = true
}
CMAKE_DEBUG_TYPE = CMAKE_DEBUG_TYPE =
CMAKE_RELEASE_TYPE = CMAKE_RELEASE_TYPE =
@ -133,6 +141,24 @@ equals(QMAKE_HOST.os, Windows): CMAKE_BIN_SUFFIX = ".exe"
if(build_all|CONFIG(debug, debug|release)): CMAKE_DEBUG_TYPE = debug if(build_all|CONFIG(debug, debug|release)): CMAKE_DEBUG_TYPE = debug
if(build_all|CONFIG(release, debug|release)): CMAKE_RELEASE_TYPE = release if(build_all|CONFIG(release, debug|release)): CMAKE_RELEASE_TYPE = release
# CMAKE_DEBUG_AND_RELEASE is used to tell the _populate_$${CMAKE_MODULE_NAME}_target_properties
# functions whether a Configuration specific generator expression needs to be added to the values
# of INTERFACE_LINK_LIBRARIES and INTERFACE_LINK_OPTIONS. For debug_and_release builds, we do need
# configuration specific values. For singular builds (only release or only debug), we want the
# values to be applied regardless of the configuration.
# This would allow on Linux and macOS (and with a recent enough version of CMake on Windows) to
# build a Debug configuration of an application, even if Qt was built in a Release configuration.
#
# All IMPORTED_LOCATION_<CONFIG> paths are automatically considered by CMake if there is no
# <CONFIG> equivalent to the value specified by CMAKE_BUILD_TYPE.
# This means that when Qt was built in a Release configuration, and the application in a Debug
# configuration, IMPORTED_LOCATION_RELEASE will be used for the Qt libraries.
debug_and_release {
CMAKE_DEBUG_AND_RELEASE = TRUE
} else {
CMAKE_DEBUG_AND_RELEASE = FALSE
}
contains(CONFIG, plugin) { contains(CONFIG, plugin) {
!isEmpty(PLUGIN_EXTENDS):!equals(PLUGIN_EXTENDS, -) { !isEmpty(PLUGIN_EXTENDS):!equals(PLUGIN_EXTENDS, -) {
count(PLUGIN_EXTENDS, 1, greaterThan): \ count(PLUGIN_EXTENDS, 1, greaterThan): \
@ -341,7 +367,7 @@ cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
# Other modules should either create proper tests in tests/auto/cmake or, as # Other modules should either create proper tests in tests/auto/cmake or, as
# a temporary measure, disable the generation of cmake files # a temporary measure, disable the generation of cmake files
# with 'CONFIG -= create_cmake' # with 'CONFIG -= create_cmake'
!equals(CMAKE_MODULE_TESTS, -) { !internal_module:!equals(CMAKE_MODULE_TESTS, -) {
isEmpty(CMAKE_MODULE_TESTS): CMAKE_MODULE_TESTS = $$MODULE_BASE_INDIR/tests/auto/cmake isEmpty(CMAKE_MODULE_TESTS): CMAKE_MODULE_TESTS = $$MODULE_BASE_INDIR/tests/auto/cmake
!exists($$CMAKE_MODULE_TESTS): \ !exists($$CMAKE_MODULE_TESTS): \
error("Missing CMake tests. Either create tests in tests/auto/cmake," \ error("Missing CMake tests. Either create tests in tests/auto/cmake," \

View File

@ -75,7 +75,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
# Handle normal libraries passed as -lfoo # Handle normal libraries passed as -lfoo
set(_lib \"${CMAKE_MATCH_1}\") set(_lib \"${CMAKE_MATCH_1}\")
foreach(_standard_library ${_standard_libraries}) foreach(_standard_library ${_standard_libraries})
if(_standard_library MATCHES \"^${_lib}(\\.lib)?$\") if(_standard_library MATCHES \"^${_lib}(\\\\.lib)?$\")
set(_lib_is_default_linked TRUE) set(_lib_is_default_linked TRUE)
break() break()
endif() endif()
@ -119,7 +119,8 @@ endfunction()
!!ENDIF !!ENDIF
!!IF !equals(TEMPLATE, aux) !!IF !equals(TEMPLATE, aux)
macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION) macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION
IsDebugAndRelease)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -130,24 +131,48 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location}) _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
set(_deps set(_deps
${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES} ${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}
)
set(_static_deps
!!IF !isEmpty(CMAKE_STATIC_TYPE) !!IF !isEmpty(CMAKE_STATIC_TYPE)
${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES} ${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}
!!ENDIF !!ENDIF
) )
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"INTERFACE_LINK_LIBRARIES\" \"${_deps}\"
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location} \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
!!IF !isEmpty(CMAKE_LIB_SONAME) !!IF !isEmpty(CMAKE_LIB_SONAME)
\"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\" \"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
!!ENDIF !!ENDIF
# For backward compatibility with CMake < 2.8.12 # For backward compatibility with CMake < 2.8.12
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_deps}\" \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_deps};${_static_deps}\"
)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_LIBRARIES
\"${_deps}\"
) )
!!IF !isEmpty(CMAKE_STATIC_TYPE)
if(NOT CMAKE_VERSION VERSION_LESS \"3.13\") !!IF !isEmpty(CMAKE_STATIC_TYPE)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES if(NOT "${IsDebugAndRelease}")
\"INTERFACE_LINK_OPTIONS\" \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LINK_FLAGS}\" set(_genex_condition \"1\")
else()
if("${Configuration}" STREQUAL "DEBUG")
set(_genex_condition \"$<CONFIG:Debug>\")
else()
set(_genex_condition \"$<NOT:$<CONFIG:Debug>>\")
endif()
endif()
if(_static_deps)
set(_static_deps_genex \"$<${_genex_condition}:${_static_deps}>\")
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_LIBRARIES
\"${_static_deps_genex}\"
)
endif()
set(_static_link_flags \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LINK_FLAGS}\")
if(NOT CMAKE_VERSION VERSION_LESS \"3.13\" AND _static_link_flags)
set(_static_link_flags_genex \"$<${_genex_condition}:${_static_link_flags}>\")
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_OPTIONS
\"${_static_link_flags_genex}\"
) )
endif() endif()
!!ENDIF !!ENDIF
@ -382,9 +407,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !equals(TEMPLATE, aux) !!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_RELEASE_TYPE) !!IF !isEmpty(CMAKE_RELEASE_TYPE)
!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE !!ELSE
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
@ -395,7 +420,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE !!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE !!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE // CMAKE_STATIC_WINDOWS_BUILD !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
if (EXISTS if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -409,7 +434,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE !!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF !!ENDIF
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
endif() endif()
!!ENDIF // CMAKE_DEBUG_TYPE !!ENDIF // CMAKE_DEBUG_TYPE
@ -419,9 +444,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !isEmpty(CMAKE_DEBUG_TYPE) !!IF !isEmpty(CMAKE_DEBUG_TYPE)
!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE !!ELSE
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
@ -432,7 +457,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE !!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE !!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE // CMAKE_STATIC_WINDOWS_BUILD !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
if (EXISTS if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE) !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -446,7 +471,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE !!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF !!ENDIF
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
endif() endif()
!!ENDIF // CMAKE_RELEASE_TYPE !!ENDIF // CMAKE_RELEASE_TYPE
@ -459,6 +484,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
) )
!!ENDIF // TEMPLATE != aux !!ENDIF // TEMPLATE != aux
!!IF isEmpty(CMAKE_INTERNAL_MODULE)
file(GLOB pluginTargets \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*Plugin.cmake\") file(GLOB pluginTargets \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*Plugin.cmake\")
macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION) macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
@ -481,6 +508,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endforeach() endforeach()
endif() endif()
!!ENDIF // isEmpty(CMAKE_INTERNAL_MODULE)
!!IF !isEmpty(CMAKE_MODULE_EXTRAS) !!IF !isEmpty(CMAKE_MODULE_EXTRAS)
include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\") include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")

View File

@ -37,6 +37,9 @@ defineTest(addExclusiveBuilds) {
addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS) addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS)
} }
# Default directories to process QMAKE_DEFAULT_DIRS_TO_PROCESS = QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR LEX_DIR YACC_DIR
QMAKE_DIR_REPLACE_SANE += QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR LEX_DIR YACC_DIR QMAKE_DIR_REPLACE_SANE += $$QMAKE_DEFAULT_DIRS_TO_PROCESS
QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR $$QMAKE_DIR_REPLACE_SANE QMAKE_DIR_REPLACE = \
OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR \
$$QMAKE_DEFAULT_DIRS_TO_PROCESS
unset(QMAKE_DEFAULT_DIRS_TO_PROCESS)

View File

@ -27,6 +27,24 @@ QT_TOOL_ENV = qtver qtmver qtvertag qtdocs builddir
qtPrepareTool(QDOC, qdoc) qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV = QT_TOOL_ENV =
# On Windows, put the includes into a .inc file which QDoc will read, if the project
# has too many includes. We do this to overcome a command-line limit on Windows.
WIN_INCLUDETEMP=
INCLUDE_PATHS=$$INCPATH
win32:count(INCLUDE_PATHS, 30, >) {
WIN_INCLUDETEMP = $$OUT_PWD/qdocincludepaths.inc
WIN_INCLUDETEMP_CONTENT =
for (inc, INCLUDE_PATHS): \
WIN_INCLUDETEMP_CONTENT += -I$$inc
write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONTENT)|error()
}
isEmpty(WIN_INCLUDETEMP) {
QDOC_INCLUDE_PATHS=$(INCPATH)
} else {
QDOC_INCLUDE_PATHS=@$$shell_quote($$WIN_INCLUDETEMP)
}
!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator) !build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
qtPrepareTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner) qtPrepareTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner)
@ -75,12 +93,13 @@ qtattributionsscanner.CONFIG += phony
QMAKE_EXTRA_TARGETS += qtattributionsscanner QMAKE_EXTRA_TARGETS += qtattributionsscanner
doc_command = $$QDOC $$QMAKE_DOCS doc_command = $$QDOC $$QMAKE_DOCS
prepare_docs { prepare_docs {
prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors $(INCPATH) prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors $$QDOC_INCLUDE_PATHS
generate_docs.commands += $$doc_command -generate $$DOC_INDEXES $(INCPATH) generate_docs.commands += $$doc_command -generate $$DOC_INDEXES $$QDOC_INCLUDE_PATHS
prepare_docs.depends += qtattributionsscanner prepare_docs.depends += qtattributionsscanner
} else { } else {
html_docs.commands += $$doc_command $$DOC_INDEXES $(INCPATH) html_docs.commands += $$doc_command $$DOC_INDEXES $(QDOC_INCLUDE_PATHS)
html_docs.depends += qtattributionsscanner html_docs.depends += qtattributionsscanner
} }

View File

@ -117,7 +117,7 @@ unset(QT_FOR_PRIVATE)
QMAKE_USE_PRIVATE += $$QMAKE_USE_FOR_PRIVATE QMAKE_USE_PRIVATE += $$QMAKE_USE_FOR_PRIVATE
unset(QMAKE_USE_FOR_PRIVATE) unset(QMAKE_USE_FOR_PRIVATE)
!internal_module:CONFIG += create_cmake CONFIG += create_cmake
contains(TARGET, QtAddOn.*): \ contains(TARGET, QtAddOn.*): \
DEFINES += QT_BUILD_ADDON_$${ucmodule}_LIB DEFINES += QT_BUILD_ADDON_$${ucmodule}_LIB

View File

@ -304,7 +304,6 @@ headersclean:!internal_module {
header_check.variable_out = PRE_TARGETDEPS header_check.variable_out = PRE_TARGETDEPS
header_check.name = headercheck ${QMAKE_FILE_IN} header_check.name = headercheck ${QMAKE_FILE_IN}
header_check.commands = $$hcleanCOMMAND header_check.commands = $$hcleanCOMMAND
silent:header_check.commands = @echo compiling[header] ${QMAKE_FILE_IN} && $$hcleanCOMMAND
QMAKE_EXTRA_COMPILERS += header_check QMAKE_EXTRA_COMPILERS += header_check
} }
unset(hcleanCOMMAND) unset(hcleanCOMMAND)

View File

@ -46,11 +46,17 @@ import json
import subprocess import subprocess
from distutils.version import StrictVersion from distutils.version import StrictVersion
def is_available(object):
if "isAvailable" in object:
return object["isAvailable"] # introduced in Xcode 11
else:
return "unavailable" not in object["availability"]
def is_suitable_runtime(runtimes, runtime_name, platform, min_version): def is_suitable_runtime(runtimes, runtime_name, platform, min_version):
for runtime in runtimes: for runtime in runtimes:
identifier = runtime["identifier"] identifier = runtime["identifier"]
if (runtime["name"] == runtime_name or identifier == runtime_name) \ if (runtime["name"] == runtime_name or identifier == runtime_name) \
and "unavailable" not in runtime["availability"] \ and is_available(runtime) \
and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \ and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \
and StrictVersion(runtime["version"]) >= min_version: and StrictVersion(runtime["version"]) >= min_version:
return True return True
@ -77,6 +83,6 @@ if __name__ == "__main__":
for runtime_name in device_dict: for runtime_name in device_dict:
if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target): if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target):
for device in device_dict[runtime_name]: for device in device_dict[runtime_name]:
if "unavailable" not in device["availability"] \ if is_available(device) \
and (args.state is None or device["state"].lower() in args.state): and (args.state is None or device["state"].lower() in args.state):
print(device["udid"]) print(device["udid"])

View File

@ -58,9 +58,9 @@ debug_and_release:!build_pass: return()
DOCKER_ENABLED = 1 DOCKER_ENABLED = 1
equals(QMAKE_HOST.os, Darwin) | equals(QMAKE_HOST.os, Windows) { equals(QMAKE_HOST.os, Darwin) {
DOCKER_ENABLED = 0 DOCKER_ENABLED = 0
message("Not using docker network test server on macOS and Windows, see QTQAINFRA-2717 and QTQAINFRA-2750") message("Not using docker network test server on macOS, see QTQAINFRA-2717 and QTQAINFRA-2750")
} }
TESTSERVER_VERSION = "" TESTSERVER_VERSION = ""

View File

@ -105,24 +105,24 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \
$(SOURCE_PATH)/src/corelib/text/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/text/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp \
$(SOURCE_PATH)/src/corelib/text/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/text/qstring.cpp \
$(SOURCE_PATH)/src/corelib/text/qstringlist.cpp \
$(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp \
$(SOURCE_PATH)/src/corelib/time/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \ $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \ $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \ $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qhash.cpp \ $(SOURCE_PATH)/src/corelib/tools/qhash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \
$(SOURCE_PATH)/src/corelib/tools/qmap.cpp \ $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \
$(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \ $(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \ $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \
$(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp \
$(QTSRCS) $(QTSRCS2) $(QTSRCS) $(QTSRCS2)
# QTSRCS and QTSRCS2 come from Makefile.unix.* (concatenated with this # QTSRCS and QTSRCS2 come from Makefile.unix.* (concatenated with this
# by configure); QTSRCS2 may include *.mm entries on macOS. # by configure); QTSRCS2 may include *.mm entries on macOS.
@ -302,13 +302,13 @@ qglobal.o: $(SOURCE_PATH)/src/corelib/global/qglobal.cpp
qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qbytearray.o: $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp qbytearray.o: $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp qvsnprintf.o: $(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp
@ -338,22 +338,22 @@ qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp qstring.o: $(SOURCE_PATH)/src/corelib/text/qstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qstringbuilder.o: $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp qstringbuilder.o: $(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp qlocale.o: $(SOURCE_PATH)/src/corelib/text/qlocale.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp qlocale_tools.o: $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_unix.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp qlocale_unix.o: $(SOURCE_PATH)/src/corelib/text/qlocale_unix.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp qlocale_win.o: $(SOURCE_PATH)/src/corelib/text/qlocale_win.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qversionnumber.o: $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp qversionnumber.o: $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp
@ -407,7 +407,7 @@ qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/text/qregexp.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp
@ -428,7 +428,7 @@ qfileinfo.o: $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp
qdatetime.o: $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp qdatetime.o: $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp qstringlist.o: $(SOURCE_PATH)/src/corelib/text/qstringlist.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp

View File

@ -196,6 +196,9 @@ qmake_pch.obj:
{$(SOURCE_PATH)\src\corelib\serialization}.cpp{}.obj:: {$(SOURCE_PATH)\src\corelib\serialization}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $< $(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\text}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\time}.cpp{}.obj:: {$(SOURCE_PATH)\src\corelib\time}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $< $(CXX) $(CXXFLAGS) $<

View File

@ -167,14 +167,8 @@ MakefileGenerator::initOutPaths()
ProString &pathRef = v[dkey].first(); ProString &pathRef = v[dkey].first();
pathRef = fileFixify(pathRef.toQString(), FileFixifyFromOutdir); pathRef = fileFixify(pathRef.toQString(), FileFixifyFromOutdir);
#ifdef Q_OS_WIN if (!pathRef.endsWith(Option::dir_sep))
// We don't want to add a separator for DLLDESTDIR on Windows (###why?) pathRef += Option::dir_sep;
if (dkey != "DLLDESTDIR")
#endif
{
if(!pathRef.endsWith(Option::dir_sep))
pathRef += Option::dir_sep;
}
if (noIO() || (project->first("TEMPLATE") == "subdirs")) if (noIO() || (project->first("TEMPLATE") == "subdirs"))
continue; continue;
@ -2233,21 +2227,6 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
return true; return true;
} }
bool
MakefileGenerator::writeStubMakefile(QTextStream &t)
{
t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
//const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
t << "first all clean install distclean uninstall: qmake\n"
<< "qmake_all:\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
bool bool
MakefileGenerator::writeMakefile(QTextStream &t) MakefileGenerator::writeMakefile(QTextStream &t)
{ {
@ -2299,9 +2278,9 @@ QString MakefileGenerator::buildArgs(bool withExtra)
//could get stored argv, but then it would have more options than are //could get stored argv, but then it would have more options than are
//probably necesary this will try to guess the bare minimum.. //probably necesary this will try to guess the bare minimum..
QString MakefileGenerator::build_args() QString MakefileGenerator::fullBuildArgs()
{ {
QString ret = "$(QMAKE)"; QString ret;
//output //output
QString ofile = fileFixify(Option::output.fileName()); QString ofile = fileFixify(Option::output.fileName());
@ -2326,7 +2305,7 @@ MakefileGenerator::writeHeader(QTextStream &t)
t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl; t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl;
t << "# Template: " << var("TEMPLATE") << Qt::endl; t << "# Template: " << var("TEMPLATE") << Qt::endl;
if(!project->isActiveConfig("build_pass")) if(!project->isActiveConfig("build_pass"))
t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << Qt::endl; t << "# Command: " << var("QMAKE_QMAKE") << fullBuildArgs() << Qt::endl;
t << "#############################################################################\n"; t << "#############################################################################\n";
t << Qt::endl; t << Qt::endl;
QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
@ -2792,7 +2771,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
<< "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl; << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl;
} }
QString qmake = build_args(); QString qmake = "$(QMAKE)" + fullBuildArgs();
if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) {
t << escapeDependencyPath(ofile) << ": " t << escapeDependencyPath(ofile) << ": "
<< escapeDependencyPath(fileFixify(project->projectFile())) << " "; << escapeDependencyPath(fileFixify(project->projectFile())) << " ";
@ -3429,9 +3408,9 @@ MakefileGenerator::writePkgConfigFile()
t << Qt::endl; t << Qt::endl;
// requires // requires
const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' '); const QString requiresString = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
if (!requires.isEmpty()) { if (!requiresString.isEmpty()) {
t << "Requires: " << requires << Qt::endl; t << "Requires: " << requiresString << Qt::endl;
} }
t << Qt::endl; t << Qt::endl;

View File

@ -58,7 +58,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
bool resolveDependenciesInFrameworks = false; bool resolveDependenciesInFrameworks = false;
QHash<QString, bool> init_compiler_already; QHash<QString, bool> init_compiler_already;
QString makedir, chkexists; QString makedir, chkexists;
QString build_args(); QString fullBuildArgs();
//internal caches //internal caches
mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache; mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache;
@ -90,7 +90,6 @@ protected:
void writeExtraCompilerTargets(QTextStream &t); void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t); void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t); bool writeDummyMakefile(QTextStream &t);
virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t); virtual bool writeMakefile(QTextStream &t);
virtual void writeDefaultVariables(QTextStream &t); virtual void writeDefaultVariables(QTextStream &t);

View File

@ -57,6 +57,7 @@ private:
QList<Build *> makefiles; QList<Build *> makefiles;
void clearBuilds(); void clearBuilds();
MakefileGenerator *processBuild(const ProString &); MakefileGenerator *processBuild(const ProString &);
void accumulateVariableFromBuilds(const ProKey &name, Build *build) const;
public: public:
@ -95,9 +96,6 @@ BuildsMetaMakefileGenerator::init()
if(builds.count() > 1 && Option::output.fileName() == "-") { if(builds.count() > 1 && Option::output.fileName() == "-") {
use_single_build = true; use_single_build = true;
warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS."); warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS.");
} else if(0 && !use_single_build && project->first("TEMPLATE") == "subdirs") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot specify multiple builds with TEMPLATE subdirs.");
} }
if(!use_single_build) { if(!use_single_build) {
for(int i = 0; i < builds.count(); i++) { for(int i = 0; i < builds.count(); i++) {
@ -188,6 +186,7 @@ BuildsMetaMakefileGenerator::write()
if(!build->makefile) { if(!build->makefile) {
ret = false; ret = false;
} else if(build == glue) { } else if(build == glue) {
accumulateVariableFromBuilds("QMAKE_INTERNAL_INCLUDED_FILES", build);
ret = build->makefile->writeProjectMakefile(); ret = build->makefile->writeProjectMakefile();
} else { } else {
ret = build->makefile->write(); ret = build->makefile->write();
@ -230,6 +229,16 @@ MakefileGenerator
return nullptr; return nullptr;
} }
void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &name, Build *dst) const
{
ProStringList &values = dst->makefile->projectFile()->values(name);
for (auto build : makefiles) {
if (build != dst)
values += build->makefile->projectFile()->values(name);
}
values.removeDuplicates();
}
class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator
{ {
protected: protected:
@ -327,17 +336,13 @@ SubdirsMetaMakefileGenerator::init()
hasError |= tmpError; hasError |= tmpError;
} }
sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name);
if(0 && sub->makefile->type() == SUBDIRSMETATYPE) { const QString output_name = Option::output.fileName();
subs.append(sub); Option::output.setFileName(sub->output_file);
} else { hasError |= !sub->makefile->write();
const QString output_name = Option::output.fileName(); delete sub;
Option::output.setFileName(sub->output_file); qmakeClearCaches();
hasError |= !sub->makefile->write(); sub = nullptr;
delete sub; Option::output.setFileName(output_name);
qmakeClearCaches();
sub = nullptr;
Option::output.setFileName(output_name);
}
Option::output_dir = old_output_dir; Option::output_dir = old_output_dir;
qmake_setpwd(oldpwd); qmake_setpwd(oldpwd);

View File

@ -497,21 +497,20 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
// Make sure we keep the dependency order of libraries // Make sure we keep the dependency order of libraries
lflags[arch].removeAll(opt); lflags[arch].removeAll(opt);
lflags[arch].append(opt); lflags[arch].append(opt);
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) { } else if (target_mode == TARG_MAC_MODE
if (opt.length() > 10) { && (opt == "-framework" || opt == "-force_load")) {
opt = opt.mid(10).trimmed(); // Handle space separated options
} else { ProString dashOpt = opt;
opt = l.at(++lit); opt = l.at(++lit);
if (opt.startsWith("-Xarch")) if (opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part opt = l.at(++lit); // The user has done the right thing and prefixed each part
}
for(int x = 0; x < lflags[arch].size(); ++x) { for(int x = 0; x < lflags[arch].size(); ++x) {
if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) { if (lflags[arch].at(x) == dashOpt && lflags[arch].at(++x) == opt) {
lflags[arch].remove(x - 1, 2); lflags[arch].remove(x - 1, 2);
break; break;
} }
} }
lflags[arch].append("-framework"); lflags[arch].append(dashOpt);
lflags[arch].append(opt); lflags[arch].append(opt);
} else { } else {
lflags[arch].append(opt); lflags[arch].append(opt);

View File

@ -42,7 +42,6 @@ class UnixMakefileGenerator : public MakefileGenerator
protected: protected:
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
#ifdef Q_OS_WIN // MinGW x-compiling for QNX #ifdef Q_OS_WIN // MinGW x-compiling for QNX
QString installRoot() const override; QString installRoot() const override;
#endif #endif

View File

@ -66,8 +66,6 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
if (project->first("TEMPLATE") == "app" || if (project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" || project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") { project->first("TEMPLATE") == "aux") {
if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))
return true;
writeMakeParts(t); writeMakeParts(t);
return MakefileGenerator::writeMakefile(t); return MakefileGenerator::writeMakefile(t);
} else if (project->first("TEMPLATE") == "subdirs") { } else if (project->first("TEMPLATE") == "subdirs") {

View File

@ -93,18 +93,6 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
project->first("TEMPLATE") == "aux") { project->first("TEMPLATE") == "aux") {
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
writePkgConfigFile(); writePkgConfigFile();
if(Option::mkfile::do_stub_makefile) {
t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << escapeDependencyPath(*it) << ' ';
t << "first all clean install distclean uninstall: qmake\n"
<< "qmake_all:\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
writeMingwParts(t); writeMingwParts(t);
return MakefileGenerator::writeMakefile(t); return MakefileGenerator::writeMakefile(t);
} }
@ -127,7 +115,7 @@ QString MingwMakefileGenerator::installRoot() const
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)"); return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
} }
void createLdResponseFile(const QString &fileName, const ProStringList &objList) static void createResponseFile(const QString &fileName, const ProStringList &objList)
{ {
QString filePath = Option::output_dir + QDir::separator() + fileName; QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath); QFile file(filePath);
@ -151,23 +139,6 @@ void createLdResponseFile(const QString &fileName, const ProStringList &objList)
} }
} }
void createArObjectScriptFile(const QString &fileName, const QString &target, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream t(&file);
// ### quoting?
t << "CREATE " << target << Qt::endl;
for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
t << "ADDMOD " << *it << Qt::endl;
}
t << "SAVE\n";
t.flush();
file.close();
}
}
void MingwMakefileGenerator::writeMingwParts(QTextStream &t) void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
{ {
writeStandardParts(t); writeStandardParts(t);
@ -294,26 +265,25 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) { if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
objectsLinkLine = "$(OBJECTS)"; objectsLinkLine = "$(OBJECTS)";
} else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { } else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); QString ar_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty()) { if (!var("BUILD_NAME").isEmpty()) {
ar_script_file += "." + var("BUILD_NAME"); ar_response_file += "." + var("BUILD_NAME");
} }
if (!var("MAKEFILE").isEmpty()) if (!var("MAKEFILE").isEmpty())
ar_script_file += "." + var("MAKEFILE"); ar_response_file += "." + var("MAKEFILE");
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
// Strip off any options since the ar commands will be read from file. QString ar_cmd = var("QMAKE_LIB");
QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
if (ar_cmd.isEmpty()) if (ar_cmd.isEmpty())
ar_cmd = "ar"; ar_cmd = "ar -rc";
createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); createResponseFile(ar_response_file, project->values("OBJECTS"));
objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file); objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file);
} else { } else {
QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty()) if (!var("BUILD_NAME").isEmpty())
ld_response_file += "." + var("BUILD_NAME"); ld_response_file += "." + var("BUILD_NAME");
if (!var("MAKEFILE").isEmpty()) if (!var("MAKEFILE").isEmpty())
ld_response_file += "." + var("MAKEFILE"); ld_response_file += "." + var("MAKEFILE");
createLdResponseFile(ld_response_file, project->values("OBJECTS")); createResponseFile(ld_response_file, project->values("OBJECTS"));
objectsLinkLine = "@" + escapeFilePath(ld_response_file); objectsLinkLine = "@" + escapeFilePath(ld_response_file);
} }
Win32MakefileGenerator::writeObjectsPart(t); Win32MakefileGenerator::writeObjectsPart(t);

View File

@ -48,10 +48,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
if(project->first("TEMPLATE") == "app" || if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" || project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") { project->first("TEMPLATE") == "aux") {
#if 0
if(Option::mkfile::do_stub_makefile)
return MakefileGenerator::writeStubMakefile(t);
#endif
writeNmakeParts(t); writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t); return MakefileGenerator::writeMakefile(t);
} }

View File

@ -238,7 +238,7 @@ ProString &ProString::append(const ProString &other, bool *pending)
QChar *ptr; QChar *ptr;
if (pending && !*pending) { if (pending && !*pending) {
ptr = prepareExtend(1 + other.m_length, 0, m_length); ptr = prepareExtend(1 + other.m_length, 0, m_length);
*ptr++ = 32; *ptr++ = QLatin1Char(' ');
} else { } else {
ptr = prepareExtend(other.m_length, 0, m_length); ptr = prepareExtend(other.m_length, 0, m_length);
} }
@ -276,7 +276,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski
QChar *ptr = prepareExtend(totalLength, 0, m_length); QChar *ptr = prepareExtend(totalLength, 0, m_length);
for (int i = startIdx; i < sz; ++i) { for (int i = startIdx; i < sz; ++i) {
if (putSpace) if (putSpace)
*ptr++ = 32; *ptr++ = QLatin1Char(' ');
else else
putSpace = true; putSpace = true;
const ProString &str = other.at(i); const ProString &str = other.at(i);

View File

@ -68,6 +68,7 @@ class ProString {
public: public:
ProString(); ProString();
ProString(const ProString &other); ProString(const ProString &other);
ProString &operator=(const ProString &) = default;
PROITEM_EXPLICIT ProString(const QString &str); PROITEM_EXPLICIT ProString(const QString &str);
PROITEM_EXPLICIT ProString(const QStringRef &str); PROITEM_EXPLICIT ProString(const QStringRef &str);
PROITEM_EXPLICIT ProString(const char *str); PROITEM_EXPLICIT ProString(const char *str);
@ -432,11 +433,12 @@ public:
ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); } ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); }
ProFunctionDef(ProFunctionDef &&other) noexcept ProFunctionDef(ProFunctionDef &&other) noexcept
: m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; } : m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; }
~ProFunctionDef() { m_pro->deref(); } ~ProFunctionDef() { if (m_pro) m_pro->deref(); }
ProFunctionDef &operator=(const ProFunctionDef &o) ProFunctionDef &operator=(const ProFunctionDef &o)
{ {
if (this != &o) { if (this != &o) {
m_pro->deref(); if (m_pro)
m_pro->deref();
m_pro = o.m_pro; m_pro = o.m_pro;
m_pro->ref(); m_pro->ref();
m_offset = o.m_offset; m_offset = o.m_offset;

View File

@ -1130,48 +1130,35 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
} }
superdir = qdfi.path(); superdir = qdfi.path();
} }
QString sdir = inDir;
QString dir = m_outputDir; QString dir = m_outputDir;
forever { forever {
conffile = sdir + QLatin1String("/.qmake.conf");
if (!m_vfs->exists(conffile, flags))
conffile.clear();
cachefile = dir + QLatin1String("/.qmake.cache"); cachefile = dir + QLatin1String("/.qmake.cache");
if (!m_vfs->exists(cachefile, flags)) if (!m_vfs->exists(cachefile, flags))
cachefile.clear(); cachefile.clear();
if (!cachefile.isEmpty()) { if (!conffile.isEmpty() || !cachefile.isEmpty()) {
if (dir != sdir)
m_sourceRoot = sdir;
m_buildRoot = dir; m_buildRoot = dir;
break; break;
} }
if (dir == superdir) if (dir == superdir)
goto no_cache; goto no_cache;
QFileInfo qdfi(dir);
if (qdfi.isRoot()) {
cachefile.clear();
break;
}
dir = qdfi.path();
}
QString sdir = inDir;
forever {
conffile = sdir + QLatin1String("/.qmake.conf");
if (!m_vfs->exists(conffile, flags))
conffile.clear();
if (!conffile.isEmpty()) {
if (sdir != m_buildRoot)
m_sourceRoot = sdir;
break;
}
QFileInfo qsdfi(sdir); QFileInfo qsdfi(sdir);
if (qsdfi.isRoot()) { QFileInfo qdfi(dir);
conffile.clear(); if (qsdfi.isRoot() || qdfi.isRoot())
break; goto no_cache;
}
sdir = qsdfi.path(); sdir = qsdfi.path();
dir = qdfi.path();
} }
} else { } else {
m_buildRoot = QFileInfo(cachefile).path(); m_buildRoot = QFileInfo(cachefile).path();
} }
if (!conffile.isEmpty()) m_conffile = QDir::cleanPath(conffile);
m_conffile = QDir::cleanPath(conffile); m_cachefile = QDir::cleanPath(cachefile);
if (!cachefile.isEmpty())
m_cachefile = QDir::cleanPath(cachefile);
} }
no_cache: no_cache:
@ -1583,8 +1570,8 @@ void QMakeEvaluator::updateFeaturePaths()
} }
for (int i = 0; i < feature_roots.count(); ++i) for (int i = 0; i < feature_roots.count(); ++i)
if (!feature_roots.at(i).endsWith((ushort)'/')) if (!feature_roots.at(i).endsWith(QLatin1Char('/')))
feature_roots[i].append((ushort)'/'); feature_roots[i].append(QLatin1Char('/'));
feature_roots.removeDuplicates(); feature_roots.removeDuplicates();

View File

@ -621,7 +621,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
if (c != term) { if (c != term) {
parseError(fL1S("Missing %1 terminator [found %2]") parseError(fL1S("Missing %1 terminator [found %2]")
.arg(QChar(term)) .arg(QChar(term))
.arg(c ? QString(c) : QString::fromLatin1("end-of-line"))); .arg(c ? QString(QChar(c)) : QString::fromLatin1("end-of-line")));
m_inError = true; m_inError = true;
// Just parse on, as if there was a terminator ... // Just parse on, as if there was a terminator ...
} else { } else {

View File

@ -111,7 +111,6 @@ private:
struct BlockScope { struct BlockScope {
BlockScope() : start(nullptr), braceLevel(0), special(false), inBranch(false), nest(NestNone) {} BlockScope() : start(nullptr), braceLevel(0), special(false), inBranch(false), nest(NestNone) {}
BlockScope(const BlockScope &other) { *this = other; }
ushort *start; // Where this block started; store length here ushort *start; // Where this block started; store length here
int braceLevel; // Nesting of braces in scope int braceLevel; // Nesting of braces in scope
bool special; // Single-line conditionals inside loops, etc. cannot have else branches bool special; // Single-line conditionals inside loops, etc. cannot have else branches

View File

@ -93,7 +93,6 @@ bool Option::mkfile::do_deps = true;
bool Option::mkfile::do_mocs = true; bool Option::mkfile::do_mocs = true;
bool Option::mkfile::do_dep_heuristics = true; bool Option::mkfile::do_dep_heuristics = true;
bool Option::mkfile::do_preprocess = false; bool Option::mkfile::do_preprocess = false;
bool Option::mkfile::do_stub_makefile = false;
QStringList Option::mkfile::project_files; QStringList Option::mkfile::project_files;
static Option::QMAKE_MODE default_mode(QString progname) static Option::QMAKE_MODE default_mode(QString progname)
@ -254,8 +253,6 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
Option::mkfile::do_deps = false; Option::mkfile::do_deps = false;
} else if (arg == "-nomoc") { } else if (arg == "-nomoc") {
Option::mkfile::do_mocs = false; Option::mkfile::do_mocs = false;
} else if (arg == "-createstub") {
Option::mkfile::do_stub_makefile = true;
} else if (arg == "-nodependheuristics") { } else if (arg == "-nodependheuristics") {
Option::mkfile::do_dep_heuristics = false; Option::mkfile::do_dep_heuristics = false;
} else if (arg == "-E") { } else if (arg == "-E") {

View File

@ -189,7 +189,6 @@ struct Option
static bool do_mocs; static bool do_mocs;
static bool do_dep_heuristics; static bool do_dep_heuristics;
static bool do_preprocess; static bool do_preprocess;
static bool do_stub_makefile;
static int cachefile_depth; static int cachefile_depth;
static QStringList project_files; static QStringList project_files;
}; };

View File

@ -178,6 +178,9 @@ public class QtNative
return fdDesc.detachFd(); return fdDesc.detachFd();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
return -1; return -1;
} catch (SecurityException e) {
Log.e(QtTAG, "Exception when opening file", e);
return -1;
} }
} }

View File

@ -62,7 +62,7 @@ QByteArray QLatin1Codec::convertFromUnicode(const QChar *ch, int len, ConverterS
char *d = r.data(); char *d = r.data();
int invalid = 0; int invalid = 0;
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
if (ch[i] > 0xff) { if (ch[i] > QChar(0xff)) {
d[i] = replacement; d[i] = replacement;
++invalid; ++invalid;
} else { } else {
@ -112,28 +112,28 @@ QString QLatin15Codec::convertToUnicode(const char* chars, int len, ConverterSta
while(len--) { while(len--) {
switch(uc->unicode()) { switch(uc->unicode()) {
case 0xa4: case 0xa4:
*uc = 0x20ac; *uc = QChar(0x20ac);
break; break;
case 0xa6: case 0xa6:
*uc = 0x0160; *uc = QChar(0x0160);
break; break;
case 0xa8: case 0xa8:
*uc = 0x0161; *uc = QChar(0x0161);
break; break;
case 0xb4: case 0xb4:
*uc = 0x017d; *uc = QChar(0x017d);
break; break;
case 0xb8: case 0xb8:
*uc = 0x017e; *uc = QChar(0x017e);
break; break;
case 0xbc: case 0xbc:
*uc = 0x0152; *uc = QChar(0x0152);
break; break;
case 0xbd: case 0xbd:
*uc = 0x0153; *uc = QChar(0x0153);
break; break;
case 0xbe: case 0xbe:
*uc = 0x0178; *uc = QChar(0x0178);
break; break;
default: default:
break; break;

View File

@ -544,11 +544,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#if !QT_CONFIG(icu) #if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache; QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec; QTextCodec *codec;
if (cache) { codec = cache->value(name);
codec = cache->value(name); if (codec)
if (codec) return codec;
return codec;
}
for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) { for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) {
QTextCodec *cursor = *it; QTextCodec *cursor = *it;
@ -560,8 +558,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
QList<QByteArray> aliases = cursor->aliases(); QList<QByteArray> aliases = cursor->aliases();
for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) { for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) {
if (qTextCodecNameMatch(*ait, name)) { if (qTextCodecNameMatch(*ait, name)) {
if (cache) cache->insert(name, cursor);
cache->insert(name, cursor);
return cursor; return cursor;
} }
} }

View File

@ -951,10 +951,10 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
} }
uint code = (endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple); uint code = (endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple);
if (QChar::requiresSurrogates(code)) { if (QChar::requiresSurrogates(code)) {
*qch++ = QChar::highSurrogate(code); *qch++ = QChar(QChar::highSurrogate(code));
*qch++ = QChar::lowSurrogate(code); *qch++ = QChar(QChar::lowSurrogate(code));
} else { } else {
*qch++ = code; *qch++ = QChar(code);
} }
num = 0; num = 0;
} }

View File

@ -596,7 +596,7 @@
"qDoubleSnprintf(argv[0], 1, invalidLocale, \"invalid format\", a);", "qDoubleSnprintf(argv[0], 1, invalidLocale, \"invalid format\", a);",
"qDoubleSscanf(argv[0], invalidLocale, \"invalid format\", &a, &argc);" "qDoubleSscanf(argv[0], invalidLocale, \"invalid format\", &a, &argc);"
], ],
"qmake": "DEFINES += QDSP_P_H=$$shell_quote(\\\"@PWD@/tools/qdoublescanprint_p.h\\\")" "qmake": "DEFINES += QDSP_P_H=$$shell_quote(\\\"@PWD@/text/qdoublescanprint_p.h\\\")"
} }
} }
}, },

View File

@ -36,6 +36,7 @@ qtConfig(animation): include(animation/animation.pri)
include(global/global.pri) include(global/global.pri)
include(thread/thread.pri) include(thread/thread.pri)
include(tools/tools.pri) include(tools/tools.pri)
include(text/text.pri)
include(time/time.pri) include(time/time.pri)
include(io/io.pri) include(io/io.pri)
include(itemmodels/itemmodels.pri) include(itemmodels/itemmodels.pri)

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2019 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.
@ -613,7 +613,8 @@ using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
# define Q_ALWAYS_INLINE inline # define Q_ALWAYS_INLINE inline
#endif #endif
#if defined(Q_CC_GNU) && defined(Q_OS_WIN) #if defined(Q_CC_GNU) && defined(Q_OS_WIN) && !defined(QT_NO_DATA_RELOCATION)
// ### Qt6: you can remove me
# define QT_INIT_METAOBJECT __attribute__((init_priority(101))) # define QT_INIT_METAOBJECT __attribute__((init_priority(101)))
#else #else
# define QT_INIT_METAOBJECT # define QT_INIT_METAOBJECT
@ -1002,6 +1003,29 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
# endif # endif
#endif #endif
// Work around MSVC warning about use of 3-arg algorithms
// until we can depend on the C++14 4-arg ones.
//
// These algortithms do NOT check for equal length.
// They need to be treated as if they called the 3-arg version (which they do)!
#ifdef Q_CC_MSVC
# define QT_3ARG_ALG(alg, f1, l1, f2, l2) \
std::alg(f1, l1, f2, l2)
#else
# define QT_3ARG_ALG(alg, f1, l1, f2, l2) \
[&f1, &l1, &f2, &l2]() { \
Q_UNUSED(l2); \
return std::alg(f1, l1, f2); \
}()
#endif
template <typename ForwardIterator1, typename ForwardIterator2>
inline bool qt_is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2)
{
return QT_3ARG_ALG(is_permutation, first1, last1, first2, last2);
}
#undef QT_3ARG_ALG
// this adds const to non-const objects (like std::as_const) // this adds const to non-const objects (like std::as_const)
template <typename T> template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; } Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }

View File

@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 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.
@ -180,6 +181,12 @@
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT) #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
# define Q_OS_WINDOWS # define Q_OS_WINDOWS
# define Q_OS_WIN # define Q_OS_WIN
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// On Windows, pointers to dllimport'ed variables are not constant expressions,
// so to keep to certain initializations (like QMetaObject) constexpr, we need
// to use functions instead.
# define QT_NO_DATA_RELOCATION
# endif
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View File

@ -55,6 +55,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <qglobal.h> #include <qglobal.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# ifdef Q_CC_MINGW
// <unistd.h> must be included before any other header pulls in <time.h>.
# include <unistd.h> // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r()
# endif
# define _POSIX_ # define _POSIX_
# include <limits.h> # include <limits.h>
# undef _POSIX_ # undef _POSIX_

View File

@ -153,7 +153,7 @@ QDirPrivate::QDirPrivate(const QDirPrivate &copy)
bool QDirPrivate::exists() const bool QDirPrivate::exists() const
{ {
if (fileEngine.isNull()) { if (!fileEngine) {
QFileSystemEngine::fillMetaData(dirEntry, metaData, QFileSystemEngine::fillMetaData(dirEntry, metaData,
QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); // always stat QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); // always stat
return metaData.exists() && metaData.isDirectory(); return metaData.exists() && metaData.isDirectory();
@ -226,7 +226,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
return; return;
QString absoluteName; QString absoluteName;
if (fileEngine.isNull()) { if (!fileEngine) {
if (!dirEntry.isRelative() && dirEntry.isClean()) { if (!dirEntry.isRelative() && dirEntry.isClean()) {
absoluteDirEntry = dirEntry; absoluteDirEntry = dirEntry;
return; return;
@ -693,7 +693,7 @@ QString QDir::absolutePath() const
QString QDir::canonicalPath() const QString QDir::canonicalPath() const
{ {
const QDirPrivate* d = d_ptr.constData(); const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) { if (!d->fileEngine) {
QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData); QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData);
return answer.filePath(); return answer.filePath();
} }
@ -947,6 +947,12 @@ QString QDir::fromNativeSeparators(const QString &pathName)
int i = pathName.indexOf(QLatin1Char('\\')); int i = pathName.indexOf(QLatin1Char('\\'));
if (i != -1) { if (i != -1) {
QString n(pathName); QString n(pathName);
if (n.startsWith(QLatin1String("\\\\?\\"))) {
n.remove(0, 4);
i = n.indexOf(QLatin1Char('\\'));
if (i == -1)
return n;
}
QChar * const data = n.data(); QChar * const data = n.data();
data[i++] = QLatin1Char('/'); data[i++] = QLatin1Char('/');
@ -1496,7 +1502,7 @@ bool QDir::mkdir(const QString &dirName) const
} }
QString fn = filePath(dirName); QString fn = filePath(dirName);
if (d->fileEngine.isNull()) if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false); return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->mkdir(fn, false); return d->fileEngine->mkdir(fn, false);
} }
@ -1520,7 +1526,7 @@ bool QDir::rmdir(const QString &dirName) const
} }
QString fn = filePath(dirName); QString fn = filePath(dirName);
if (d->fileEngine.isNull()) if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false); return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->rmdir(fn, false); return d->fileEngine->rmdir(fn, false);
@ -1548,7 +1554,7 @@ bool QDir::mkpath(const QString &dirPath) const
} }
QString fn = filePath(dirPath); QString fn = filePath(dirPath);
if (d->fileEngine.isNull()) if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true); return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->mkdir(fn, true); return d->fileEngine->mkdir(fn, true);
} }
@ -1574,7 +1580,7 @@ bool QDir::rmpath(const QString &dirPath) const
} }
QString fn = filePath(dirPath); QString fn = filePath(dirPath);
if (d->fileEngine.isNull()) if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true); return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->rmdir(fn, true); return d->fileEngine->rmdir(fn, true);
} }
@ -1647,7 +1653,7 @@ bool QDir::isReadable() const
{ {
const QDirPrivate* d = d_ptr.constData(); const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) { if (!d->fileEngine) {
if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission)) if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission))
QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission); QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission);
@ -1692,7 +1698,7 @@ bool QDir::exists() const
*/ */
bool QDir::isRoot() const bool QDir::isRoot() const
{ {
if (d_ptr->fileEngine.isNull()) if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRoot(); return d_ptr->dirEntry.isRoot();
return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag;
} }
@ -1724,7 +1730,7 @@ bool QDir::isRoot() const
*/ */
bool QDir::isRelative() const bool QDir::isRelative() const
{ {
if (d_ptr->fileEngine.isNull()) if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRelative(); return d_ptr->dirEntry.isRelative();
return d_ptr->fileEngine->isRelativePath(); return d_ptr->fileEngine->isRelativePath();
} }
@ -1741,7 +1747,7 @@ bool QDir::makeAbsolute()
{ {
const QDirPrivate *d = d_ptr.constData(); const QDirPrivate *d = d_ptr.constData();
QScopedPointer<QDirPrivate> dir; QScopedPointer<QDirPrivate> dir;
if (!d->fileEngine.isNull()) { if (!!d->fileEngine) {
QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
if (QDir::isRelativePath(absolutePath)) if (QDir::isRelativePath(absolutePath))
return false; return false;
@ -1774,8 +1780,8 @@ bool QDir::operator==(const QDir &dir) const
if (d == other) if (d == other)
return true; return true;
Qt::CaseSensitivity sensitive; Qt::CaseSensitivity sensitive;
if (d->fileEngine.isNull() || other->fileEngine.isNull()) { if (!d->fileEngine || !other->fileEngine) {
if (d->fileEngine.data() != other->fileEngine.data()) // one is native, the other is a custom file-engine if (d->fileEngine.get() != other->fileEngine.get()) // one is native, the other is a custom file-engine
return false; return false;
sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive; sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive;
@ -2339,6 +2345,11 @@ static QString qt_cleanPath(const QString &path, bool *ok)
if (path.isEmpty()) if (path.isEmpty())
return path; return path;
QString name = path; QString name = path;
#if defined (Q_OS_WIN)
if (name.startsWith(QLatin1String("\\\\?\\")))
name.remove(0, 4);
#endif
QChar dir_separator = QDir::separator(); QChar dir_separator = QDir::separator();
if (dir_separator != QLatin1Char('/')) if (dir_separator != QLatin1Char('/'))
name.replace(dir_separator, QLatin1Char('/')); name.replace(dir_separator, QLatin1Char('/'));

View File

@ -54,6 +54,8 @@
#include "qfilesystementry_p.h" #include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h" #include "qfilesystemmetadata_p.h"
#include <memory>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDirPrivate : public QSharedData class QDirPrivate : public QSharedData
@ -82,7 +84,7 @@ public:
static inline QChar getFilterSepChar(const QString &nameFilter); static inline QChar getFilterSepChar(const QString &nameFilter);
static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0); static inline QStringList splitFilters(const QString &nameFilter, QChar sep = {});
void setPath(const QString &path); void setPath(const QString &path);
@ -98,7 +100,7 @@ public:
QDir::SortFlags sort; QDir::SortFlags sort;
QDir::Filters filters; QDir::Filters filters;
QScopedPointer<QAbstractFileEngine> fileEngine; std::unique_ptr<QAbstractFileEngine> fileEngine;
QFileSystemEntry dirEntry; QFileSystemEntry dirEntry;
mutable QFileSystemEntry absoluteDirEntry; mutable QFileSystemEntry absoluteDirEntry;

View File

@ -107,6 +107,8 @@
#include <QtCore/private/qfilesystemengine_p.h> #include <QtCore/private/qfilesystemengine_p.h>
#include <QtCore/private/qfileinfo_p.h> #include <QtCore/private/qfileinfo_p.h>
#include <memory>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
template <class Iterator> template <class Iterator>
@ -132,7 +134,7 @@ public:
void checkAndPushDirectory(const QFileInfo &); void checkAndPushDirectory(const QFileInfo &);
bool matchesFilters(const QString &fileName, const QFileInfo &fi) const; bool matchesFilters(const QString &fileName, const QFileInfo &fi) const;
QScopedPointer<QAbstractFileEngine> engine; std::unique_ptr<QAbstractFileEngine> engine;
QFileSystemEntry dirEntry; QFileSystemEntry dirEntry;
const QStringList nameFilters; const QStringList nameFilters;
@ -435,7 +437,7 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags) QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
{ {
const QDirPrivate *other = dir.d_ptr.constData(); const QDirPrivate *other = dir.d_ptr.constData();
d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, !other->fileEngine.isNull())); d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, bool(other->fileEngine)));
} }
/*! /*!

View File

@ -55,6 +55,8 @@
# include "qcoreapplication.h" # include "qcoreapplication.h"
#endif #endif
#include <private/qmemory_p.h>
#ifdef QT_NO_QOBJECT #ifdef QT_NO_QOBJECT
#define tr(X) QString::fromLatin1(X) #define tr(X) QString::fromLatin1(X)
#endif #endif
@ -85,10 +87,9 @@ QFilePrivate::openExternalFile(int flags, int fd, QFile::FileHandleFlags handleF
Q_UNUSED(fd); Q_UNUSED(fd);
return false; return false;
#else #else
delete fileEngine; auto fs = qt_make_unique<QFSFileEngine>();
fileEngine = nullptr; auto fe = fs.get();
QFSFileEngine *fe = new QFSFileEngine; fileEngine = std::move(fs);
fileEngine = fe;
return fe->open(QIODevice::OpenMode(flags), fd, handleFlags); return fe->open(QIODevice::OpenMode(flags), fd, handleFlags);
#endif #endif
} }
@ -101,10 +102,9 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
Q_UNUSED(fh); Q_UNUSED(fh);
return false; return false;
#else #else
delete fileEngine; auto fs = qt_make_unique<QFSFileEngine>();
fileEngine = nullptr; auto fe = fs.get();
QFSFileEngine *fe = new QFSFileEngine; fileEngine = std::move(fs);
fileEngine = fe;
return fe->open(QIODevice::OpenMode(flags), fh, handleFlags); return fe->open(QIODevice::OpenMode(flags), fh, handleFlags);
#endif #endif
} }
@ -112,8 +112,8 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
QAbstractFileEngine *QFilePrivate::engine() const QAbstractFileEngine *QFilePrivate::engine() const
{ {
if (!fileEngine) if (!fileEngine)
fileEngine = QAbstractFileEngine::create(fileName); fileEngine.reset(QAbstractFileEngine::create(fileName));
return fileEngine; return fileEngine.get();
} }
//************* QFile //************* QFile
@ -334,10 +334,7 @@ QFile::setFileName(const QString &name)
file_already_open(*this, "setFileName"); file_already_open(*this, "setFileName");
close(); close();
} }
if(d->fileEngine) { //get a new file engine later d->fileEngine.reset(); //get a new file engine later
delete d->fileEngine;
d->fileEngine = nullptr;
}
d->fileName = name; d->fileName = name;
} }

View File

@ -42,6 +42,8 @@
#include "qfiledevice_p.h" #include "qfiledevice_p.h"
#include "qfsfileengine_p.h" #include "qfsfileengine_p.h"
#include <private/qmemory_p.h>
#ifdef QT_NO_QOBJECT #ifdef QT_NO_QOBJECT
#define tr(X) QString::fromLatin1(X) #define tr(X) QString::fromLatin1(X)
#endif #endif
@ -53,24 +55,20 @@ QT_BEGIN_NAMESPACE
#endif #endif
QFileDevicePrivate::QFileDevicePrivate() QFileDevicePrivate::QFileDevicePrivate()
: fileEngine(nullptr), : cachedSize(0),
cachedSize(0),
error(QFile::NoError), lastWasWrite(false) error(QFile::NoError), lastWasWrite(false)
{ {
writeBufferChunkSize = QFILE_WRITEBUFFER_SIZE; writeBufferChunkSize = QFILE_WRITEBUFFER_SIZE;
} }
QFileDevicePrivate::~QFileDevicePrivate() QFileDevicePrivate::~QFileDevicePrivate()
{ = default;
delete fileEngine;
fileEngine = nullptr;
}
QAbstractFileEngine * QFileDevicePrivate::engine() const QAbstractFileEngine * QFileDevicePrivate::engine() const
{ {
if (!fileEngine) if (!fileEngine)
fileEngine = new QFSFileEngine; fileEngine = qt_make_unique<QFSFileEngine>();
return fileEngine; return fileEngine.get();
} }
void QFileDevicePrivate::setError(QFileDevice::FileError err) void QFileDevicePrivate::setError(QFileDevice::FileError err)

View File

@ -53,6 +53,8 @@
#include "private/qiodevice_p.h" #include "private/qiodevice_p.h"
#include <memory>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractFileEngine; class QAbstractFileEngine;
@ -75,7 +77,7 @@ protected:
void setError(QFileDevice::FileError err, const QString &errorString); void setError(QFileDevice::FileError err, const QString &errorString);
void setError(QFileDevice::FileError err, int errNum); void setError(QFileDevice::FileError err, int errNum);
mutable QAbstractFileEngine *fileEngine; mutable std::unique_ptr<QAbstractFileEngine> fileEngine;
mutable qint64 cachedSize; mutable qint64 cachedSize;
QFileDevice::FileHandleFlags handleFlags; QFileDevice::FileHandleFlags handleFlags;

View File

@ -707,11 +707,11 @@ bool QFileInfo::exists(const QString &file)
return false; return false;
QFileSystemEntry entry(file); QFileSystemEntry entry(file);
QFileSystemMetaData data; QFileSystemMetaData data;
QAbstractFileEngine *engine = std::unique_ptr<QAbstractFileEngine> engine
QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, data); {QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, data)};
// Expensive fallback to non-QFileSystemEngine implementation // Expensive fallback to non-QFileSystemEngine implementation
if (engine) if (engine)
return QFileInfo(new QFileInfoPrivate(entry, data, engine)).exists(); return QFileInfo(new QFileInfoPrivate(entry, data, std::move(engine))).exists();
QFileSystemEngine::fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute); QFileSystemEngine::fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute);
return data.exists(); return data.exists();

View File

@ -61,6 +61,8 @@
#include <QtCore/private/qfilesystementry_p.h> #include <QtCore/private/qfilesystementry_p.h>
#include <QtCore/private/qfilesystemmetadata_p.h> #include <QtCore/private/qfilesystemmetadata_p.h>
#include <memory>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFileInfoPrivate : public QSharedData class QFileInfoPrivate : public QSharedData
@ -126,10 +128,10 @@ public:
metaData = QFileSystemMetaData(); metaData = QFileSystemMetaData();
} }
inline QFileInfoPrivate(const QFileSystemEntry &file, const QFileSystemMetaData &data, QAbstractFileEngine *engine) inline QFileInfoPrivate(const QFileSystemEntry &file, const QFileSystemMetaData &data, std::unique_ptr<QAbstractFileEngine> engine)
: fileEntry(file), : fileEntry(file),
metaData(data), metaData(data),
fileEngine(engine), fileEngine{std::move(engine)},
cachedFlags(0), cachedFlags(0),
#ifndef QT_NO_FSFILEENGINE #ifndef QT_NO_FSFILEENGINE
isDefaultConstructed(false), isDefaultConstructed(false),
@ -163,7 +165,7 @@ public:
QFileSystemEntry fileEntry; QFileSystemEntry fileEntry;
mutable QFileSystemMetaData metaData; mutable QFileSystemMetaData metaData;
QScopedPointer<QAbstractFileEngine> const fileEngine; std::unique_ptr<QAbstractFileEngine> const fileEngine;
mutable QString fileNames[QAbstractFileEngine::NFileNames]; mutable QString fileNames[QAbstractFileEngine::NFileNames];
mutable QString fileOwners[2]; // QAbstractFileEngine::FileOwner: OwnerUser and OwnerGroup mutable QString fileOwners[2]; // QAbstractFileEngine::FileOwner: OwnerUser and OwnerGroup

View File

@ -822,6 +822,8 @@ QString QFileSystemEngine::resolveUserName(uint userId)
#endif #endif
if (pw) if (pw)
return QFile::decodeName(QByteArray(pw->pw_name)); return QFile::decodeName(QByteArray(pw->pw_name));
#else // Integrity || WASM
Q_UNUSED(userId);
#endif #endif
return QString(); return QString();
} }
@ -859,6 +861,8 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
#endif #endif
if (gr) if (gr)
return QFile::decodeName(QByteArray(gr->gr_name)); return QFile::decodeName(QByteArray(gr->gr_name));
#else // Integrity || WASM
Q_UNUSED(groupId);
#endif #endif
return QString(); return QString();
} }

View File

@ -40,13 +40,54 @@
#include "qplatformdefs.h" #include "qplatformdefs.h"
#include "qfilesystemiterator_p.h" #include "qfilesystemiterator_p.h"
#if QT_CONFIG(textcodec)
# include <qtextcodec.h>
# include <private/qutfcodec_p.h>
#endif
#ifndef QT_NO_FILESYSTEMITERATOR #ifndef QT_NO_FILESYSTEMITERATOR
#include <memory>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static bool checkNameDecodable(const char *d_name, qsizetype len)
{
// This function is called in a loop from advance() below, but the loop is
// usually run only once.
#if QT_CONFIG(textcodec)
// We identify the codecs by their RFC 2978 MIBenum values. In this
// function:
// 3 US-ASCII (ANSI X3.4-1986)
// 4 Latin1 (ISO-8859-1)
// 106 UTF-8
QTextCodec *codec = QTextCodec::codecForLocale();
# ifdef QT_LOCALE_IS_UTF8
int mibEnum = 106;
# else
int mibEnum = codec->mibEnum();
# endif
if (Q_LIKELY(mibEnum == 106)) // UTF-8
return QUtf8::isValidUtf8(d_name, len).isValidUtf8;
if (mibEnum == 3) // US-ASCII
return QtPrivate::isAscii(QLatin1String(d_name, len));
if (mibEnum == 4) // Latin 1
return true;
// fall back to generic QTextCodec
QTextCodec::ConverterState cs(QTextCodec::IgnoreHeader);
codec->toUnicode(d_name, len, &cs);
return cs.invalidChars == 0 && cs.remainingChars == 0;
#else
// if we have no text codecs, then QString::fromLocal8Bit is fromLatin1
return true;
#endif
}
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters, QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters,
const QStringList &nameFilters, QDirIterator::IteratorFlags flags) const QStringList &nameFilters, QDirIterator::IteratorFlags flags)
: nativePath(entry.nativeFilePath()) : nativePath(entry.nativeFilePath())
@ -81,9 +122,9 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
dirEntry = QT_READDIR(dir); dirEntry = QT_READDIR(dir);
if (dirEntry) { if (dirEntry) {
// process entries with correct UTF-8 names only qsizetype len = strlen(dirEntry->d_name);
if (QFile::encodeName(QFile::decodeName(dirEntry->d_name)) == dirEntry->d_name) { if (checkNameDecodable(dirEntry->d_name, len)) {
fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath()); fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name, len), QFileSystemEntry::FromNativePath());
metaData.fillFromDirEnt(*dirEntry); metaData.fillFromDirEnt(*dirEntry);
return true; return true;
} }

View File

@ -422,16 +422,27 @@ void QInotifyFileSystemWatcherEngine::readFromInotify()
} }
} }
template <typename Hash, typename Key>
typename Hash::const_iterator
find_last_in_equal_range(const Hash &c, const Key &key)
{
// find c.equal_range(key).second - 1 without backwards iteration:
auto i = c.find(key);
const auto end = c.cend();
if (i == end)
return end;
decltype(i) prev;
do {
prev = i;
++i;
} while (i != end && i.key() == key);
return prev;
}
QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const
{ {
QHash<int, QString>::const_iterator i = idToPath.find(id); auto i = find_last_in_equal_range(idToPath, id);
while (i != idToPath.constEnd() && i.key() == id) { return i == idToPath.cend() ? QString() : i.value() ;
if ((i + 1) == idToPath.constEnd() || (i + 1).key() != id) {
return i.value();
}
++i;
}
return QString();
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -167,19 +167,21 @@ QFSFileEngine::QFSFileEngine(QFSFileEnginePrivate &dd)
/*! /*!
\internal \internal
*/ */
bool QFSFileEngine::processOpenModeFlags(QIODevice::OpenMode *mode) ProcessOpenModeResult processOpenModeFlags(QIODevice::OpenMode openMode)
{ {
QIODevice::OpenMode &openMode = *mode; ProcessOpenModeResult result;
result.ok = false;
if ((openMode & QFile::NewOnly) && (openMode & QFile::ExistingOnly)) { if ((openMode & QFile::NewOnly) && (openMode & QFile::ExistingOnly)) {
qWarning("NewOnly and ExistingOnly are mutually exclusive"); qWarning("NewOnly and ExistingOnly are mutually exclusive");
setError(QFile::OpenError, QLatin1String("NewOnly and ExistingOnly are mutually exclusive")); result.error = QLatin1String("NewOnly and ExistingOnly are mutually exclusive");
return false; return result;
} }
if ((openMode & QFile::ExistingOnly) && !(openMode & (QFile::ReadOnly | QFile::WriteOnly))) { if ((openMode & QFile::ExistingOnly) && !(openMode & (QFile::ReadOnly | QFile::WriteOnly))) {
qWarning("ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite"); qWarning("ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite");
setError(QFile::OpenError, QLatin1String("ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite")); result.error = QLatin1String(
return false; "ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite");
return result;
} }
// Either Append or NewOnly implies WriteOnly // Either Append or NewOnly implies WriteOnly
@ -190,7 +192,9 @@ bool QFSFileEngine::processOpenModeFlags(QIODevice::OpenMode *mode)
if ((openMode & QFile::WriteOnly) && !(openMode & (QFile::ReadOnly | QFile::Append | QFile::NewOnly))) if ((openMode & QFile::WriteOnly) && !(openMode & (QFile::ReadOnly | QFile::Append | QFile::NewOnly)))
openMode |= QFile::Truncate; openMode |= QFile::Truncate;
return true; result.ok = true;
result.openMode = openMode;
return result;
} }
/*! /*!
@ -234,16 +238,19 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode)
return false; return false;
} }
if (!processOpenModeFlags(&openMode)) const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false; return false;
}
d->openMode = openMode; d->openMode = res.openMode;
d->lastFlushFailed = false; d->lastFlushFailed = false;
d->tried_stat = 0; d->tried_stat = 0;
d->fh = nullptr; d->fh = nullptr;
d->fd = -1; d->fd = -1;
return d->nativeOpen(openMode); return d->nativeOpen(d->openMode);
} }
/*! /*!
@ -262,17 +269,20 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, FILE *fh, QFile::FileHand
Q_D(QFSFileEngine); Q_D(QFSFileEngine);
if (!processOpenModeFlags(&openMode)) const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false; return false;
}
d->openMode = openMode; d->openMode = res.openMode;
d->lastFlushFailed = false; d->lastFlushFailed = false;
d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle); d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
d->fileEntry.clear(); d->fileEntry.clear();
d->tried_stat = 0; d->tried_stat = 0;
d->fd = -1; d->fd = -1;
return d->openFh(openMode, fh); return d->openFh(d->openMode, fh);
} }
/*! /*!
@ -321,10 +331,13 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd, QFile::FileHandle
{ {
Q_D(QFSFileEngine); Q_D(QFSFileEngine);
if (!processOpenModeFlags(&openMode)) const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false; return false;
}
d->openMode = openMode; d->openMode = res.openMode;
d->lastFlushFailed = false; d->lastFlushFailed = false;
d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle); d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
d->fileEntry.clear(); d->fileEntry.clear();
@ -332,7 +345,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd, QFile::FileHandle
d->fd = -1; d->fd = -1;
d->tried_stat = 0; d->tried_stat = 0;
return d->openFd(openMode, fd); return d->openFd(d->openMode, fd);
} }

View File

@ -61,6 +61,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
struct ProcessOpenModeResult {
bool ok;
QIODevice::OpenMode openMode;
QString error;
};
Q_CORE_EXPORT ProcessOpenModeResult processOpenModeFlags(QIODevice::OpenMode mode);
class QFSFileEnginePrivate; class QFSFileEnginePrivate;
class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine
@ -131,9 +138,6 @@ public:
protected: protected:
QFSFileEngine(QFSFileEnginePrivate &dd); QFSFileEngine(QFSFileEnginePrivate &dd);
private:
inline bool processOpenModeFlags(QIODevice::OpenMode *mode);
}; };
class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate

View File

@ -312,7 +312,7 @@ void toString(QString &appendTo, const IPv6Address address)
} }
} }
const QChar colon = ushort(':'); const QChar colon = u':';
if (zeroRunLength < 4) if (zeroRunLength < 4)
zeroRunOffset = -1; zeroRunOffset = -1;
else if (zeroRunOffset == 0) else if (zeroRunOffset == 0)

View File

@ -202,6 +202,7 @@ void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)
vars.insert(it.key(), it.value()); vars.insert(it.key(), it.value());
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
const OrderedNameMapMutexLocker locker(this, &other);
auto nit = other.nameMap.constBegin(); auto nit = other.nameMap.constBegin();
const auto nend = other.nameMap.constEnd(); const auto nend = other.nameMap.constEnd();
for ( ; nit != nend; ++nit) for ( ; nit != nend; ++nit)
@ -275,7 +276,6 @@ bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const
return true; return true;
if (d) { if (d) {
if (other.d) { if (other.d) {
QProcessEnvironmentPrivate::OrderedMutexLocker locker(d, other.d);
return d->vars == other.d->vars; return d->vars == other.d->vars;
} else { } else {
return isEmpty(); return isEmpty();
@ -322,7 +322,6 @@ bool QProcessEnvironment::contains(const QString &name) const
{ {
if (!d) if (!d)
return false; return false;
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->vars.contains(d->prepareName(name)); return d->vars.contains(d->prepareName(name));
} }
@ -373,7 +372,6 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa
if (!d) if (!d)
return defaultValue; return defaultValue;
QProcessEnvironmentPrivate::MutexLocker locker(d);
const auto it = d->vars.constFind(d->prepareName(name)); const auto it = d->vars.constFind(d->prepareName(name));
if (it == d->vars.constEnd()) if (it == d->vars.constEnd())
return defaultValue; return defaultValue;
@ -398,7 +396,6 @@ QStringList QProcessEnvironment::toStringList() const
{ {
if (!d) if (!d)
return QStringList(); return QStringList();
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->toList(); return d->toList();
} }
@ -412,7 +409,6 @@ QStringList QProcessEnvironment::keys() const
{ {
if (!d) if (!d)
return QStringList(); return QStringList();
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->keys(); return d->keys();
} }
@ -429,7 +425,6 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e)
return; return;
// our re-impl of detach() detaches from null // our re-impl of detach() detaches from null
QProcessEnvironmentPrivate::MutexLocker locker(e.d);
d->insert(*e.d); d->insert(*e.d);
} }

View File

@ -146,16 +146,22 @@ public:
inline QString nameToString(const Key &name) const { return name; } inline QString nameToString(const Key &name) const { return name; }
inline Value prepareValue(const QString &value) const { return value; } inline Value prepareValue(const QString &value) const { return value; }
inline QString valueToString(const Value &value) const { return value; } inline QString valueToString(const Value &value) const { return value; }
struct MutexLocker {
MutexLocker(const QProcessEnvironmentPrivate *) {}
};
struct OrderedMutexLocker {
OrderedMutexLocker(const QProcessEnvironmentPrivate *,
const QProcessEnvironmentPrivate *) {}
};
#else #else
struct NameMapMutexLocker : public QMutexLocker
{
NameMapMutexLocker(const QProcessEnvironmentPrivate *d) : QMutexLocker(&d->nameMapMutex) {}
};
struct OrderedNameMapMutexLocker : public QOrderedMutexLocker
{
OrderedNameMapMutexLocker(const QProcessEnvironmentPrivate *d1,
const QProcessEnvironmentPrivate *d2)
: QOrderedMutexLocker(&d1->nameMapMutex, &d2->nameMapMutex)
{}
};
inline Key prepareName(const QString &name) const inline Key prepareName(const QString &name) const
{ {
const NameMapMutexLocker locker(this);
Key &ent = nameMap[name]; Key &ent = nameMap[name];
if (ent.isEmpty()) if (ent.isEmpty())
ent = name.toLocal8Bit(); ent = name.toLocal8Bit();
@ -164,40 +170,27 @@ public:
inline QString nameToString(const Key &name) const inline QString nameToString(const Key &name) const
{ {
const QString sname = QString::fromLocal8Bit(name); const QString sname = QString::fromLocal8Bit(name);
nameMap[sname] = name; {
const NameMapMutexLocker locker(this);
nameMap[sname] = name;
}
return sname; return sname;
} }
inline Value prepareValue(const QString &value) const { return Value(value); } inline Value prepareValue(const QString &value) const { return Value(value); }
inline QString valueToString(const Value &value) const { return value.string(); } inline QString valueToString(const Value &value) const { return value.string(); }
struct MutexLocker : public QMutexLocker
{
MutexLocker(const QProcessEnvironmentPrivate *d) : QMutexLocker(&d->mutex) {}
};
struct OrderedMutexLocker : public QOrderedMutexLocker
{
OrderedMutexLocker(const QProcessEnvironmentPrivate *d1,
const QProcessEnvironmentPrivate *d2) :
QOrderedMutexLocker(&d1->mutex, &d2->mutex)
{}
};
QProcessEnvironmentPrivate() : QSharedData() {} QProcessEnvironmentPrivate() : QSharedData() {}
QProcessEnvironmentPrivate(const QProcessEnvironmentPrivate &other) : QProcessEnvironmentPrivate(const QProcessEnvironmentPrivate &other) :
QSharedData() QSharedData(), vars(other.vars)
{ {
// This being locked ensures that the functions that only assign
// d pointers don't need explicit locking.
// We don't need to lock our own mutex, as this object is new and // We don't need to lock our own mutex, as this object is new and
// consequently not shared. For the same reason, non-const methods // consequently not shared. For the same reason, non-const methods
// do not need a lock, as they detach objects (however, we need to // do not need a lock, as they detach objects (however, we need to
// ensure that they really detach before using prepareName()). // ensure that they really detach before using prepareName()).
MutexLocker locker(&other); NameMapMutexLocker locker(&other);
vars = other.vars;
nameMap = other.nameMap; nameMap = other.nameMap;
// We need to detach our members, so that our mutex can protect them. // We need to detach our nameMap, so that our mutex can protect it.
// As we are being detached, they likely would be detached a moment later anyway. // As we are being detached, it likely would be detached a moment later anyway.
vars.detach();
nameMap.detach(); nameMap.detach();
} }
#endif #endif
@ -208,8 +201,7 @@ public:
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
typedef QHash<QString, Key> NameHash; typedef QHash<QString, Key> NameHash;
mutable NameHash nameMap; mutable NameHash nameMap;
mutable QMutex nameMapMutex;
mutable QMutex mutex;
#endif #endif
static QProcessEnvironment fromList(const QStringList &list); static QProcessEnvironment fromList(const QStringList &list);

View File

@ -438,7 +438,6 @@ void QProcessPrivate::startProcess()
int envc = 0; int envc = 0;
char **envp = 0; char **envp = 0;
if (environment.d.constData()) { if (environment.d.constData()) {
QProcessEnvironmentPrivate::MutexLocker locker(environment.d);
envp = _q_dupEnvironment(environment.d.constData()->vars, &envc); envp = _q_dupEnvironment(environment.d.constData()->vars, &envc);
} }
@ -970,7 +969,6 @@ bool QProcessPrivate::startDetached(qint64 *pid)
int envc = 0; int envc = 0;
char **envp = nullptr; char **envp = nullptr;
if (environment.d.constData()) { if (environment.d.constData()) {
QProcessEnvironmentPrivate::MutexLocker locker(environment.d);
envp = _q_dupEnvironment(environment.d.constData()->vars, &envc); envp = _q_dupEnvironment(environment.d.constData()->vars, &envc);
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2018 Intel Corporation. ** Copyright (C) 2019 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.
@ -279,14 +279,14 @@ static inline QStringList *resourceSearchPaths()
This enum is used by compressionAlgorithm() to indicate which algorithm the This enum is used by compressionAlgorithm() to indicate which algorithm the
RCC tool used to compress the payload. RCC tool used to compress the payload.
\value NoCompression Contents are not compressed (isCompressed() is false). \value NoCompression Contents are not compressed
\value ZlibCompression Contents are compressed using \l{zlib}{https://zlib.net} and can \value ZlibCompression Contents are compressed using \l{zlib}{https://zlib.net} and can
be decompressed using the qUncompress() function. be decompressed using the qUncompress() function.
\value ZstdCompression Contents are compressed using \l{zstd}{https://zstd.net}. To \value ZstdCompression Contents are compressed using \l{zstd}{https://zstd.net}. To
decompress, use the \c{ZSTD_decompress} function from the zstd decompress, use the \c{ZSTD_decompress} function from the zstd
library. library.
\sa compressionAlgorithm(), isCompressed() \sa compressionAlgorithm()
*/ */
class QResourcePrivate { class QResourcePrivate {
@ -551,13 +551,20 @@ bool QResource::isValid() const
\sa isDir() \sa isDir()
*/ */
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\obsolete
Returns \c true if the resource represents a file and the data backing it Returns \c true if the resource represents a file and the data backing it
is in a compressed format, false otherwise. If the data is compressed, is in a compressed format, false otherwise. If the data is compressed,
check compressionAlgorithm() to verify what algorithm to use to decompress check compressionAlgorithm() to verify what algorithm to use to decompress
the data. the data.
\note This function is deprecated and can be replaced with
\code
compressionAlgorithm() != NoCompression
\endcode
\sa data(), compressionAlgorithm(), isFile() \sa data(), compressionAlgorithm(), isFile()
*/ */
@ -565,6 +572,7 @@ bool QResource::isCompressed() const
{ {
return compressionAlgorithm() != NoCompression; return compressionAlgorithm() != NoCompression;
} }
#endif
/*! /*!
\since 5.13 \since 5.13
@ -582,7 +590,7 @@ bool QResource::isCompressed() const
See \l{http://facebook.github.io/zstd/zstd_manual.html}{Zstandard manual}. See \l{http://facebook.github.io/zstd/zstd_manual.html}{Zstandard manual}.
\sa isCompressed(), data(), isFile() \sa data(), isFile()
*/ */
QResource::Compression QResource::compressionAlgorithm() const QResource::Compression QResource::compressionAlgorithm() const
{ {
@ -606,11 +614,11 @@ qint64 QResource::size() const
/*! /*!
Returns direct access to a read only segment of data that this resource Returns direct access to a read only segment of data that this resource
represents. If the resource is compressed the data returns is represents. If the resource is compressed the data returned is compressed
compressed and qUncompress() must be used to access the data. If the and the appropriate library functions must be used to access the data. If
resource is a directory \nullptr is returned. the resource is a directory \nullptr is returned.
\sa size(), isCompressed(), isFile() \sa size(), compressionAlgorithm(), isFile()
*/ */
const uchar *QResource::data() const const uchar *QResource::data() const
@ -940,12 +948,15 @@ bool QResourceRoot::mappingRootSubdir(const QString &path, QString *match) const
Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree, Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree,
const unsigned char *name, const unsigned char *data) const unsigned char *name, const unsigned char *data)
{ {
if (resourceGlobalData.isDestroyed())
return false;
QMutexLocker lock(resourceMutex()); QMutexLocker lock(resourceMutex());
if (version >= 0x01 && version <= 0x3 && resourceList()) { ResourceList *list = resourceList();
if (version >= 0x01 && version <= 0x3) {
bool found = false; bool found = false;
QResourceRoot res(version, tree, name, data); QResourceRoot res(version, tree, name, data);
for(int i = 0; i < resourceList()->size(); ++i) { for (int i = 0; i < list->size(); ++i) {
if(*resourceList()->at(i) == res) { if (*list->at(i) == res) {
found = true; found = true;
break; break;
} }
@ -953,7 +964,7 @@ Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree,
if(!found) { if(!found) {
QResourceRoot *root = new QResourceRoot(version, tree, name, data); QResourceRoot *root = new QResourceRoot(version, tree, name, data);
root->ref.ref(); root->ref.ref();
resourceList()->append(root); list->append(root);
} }
return true; return true;
} }
@ -967,11 +978,12 @@ Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tre
return false; return false;
QMutexLocker lock(resourceMutex()); QMutexLocker lock(resourceMutex());
if (version >= 0x01 && version <= 0x3 && resourceList()) { if (version >= 0x01 && version <= 0x3) {
QResourceRoot res(version, tree, name, data); QResourceRoot res(version, tree, name, data);
for(int i = 0; i < resourceList()->size(); ) { ResourceList *list = resourceList();
if(*resourceList()->at(i) == res) { for (int i = 0; i < list->size(); ) {
QResourceRoot *root = resourceList()->takeAt(i); if (*list->at(i) == res) {
QResourceRoot *root = list->takeAt(i);
if(!root->ref.deref()) if(!root->ref.deref())
delete root; delete root;
} else { } else {
@ -1217,7 +1229,7 @@ QResource::unregisterResource(const QString &rccFilename, const QString &resourc
if(res->type() == QResourceRoot::Resource_File) { if(res->type() == QResourceRoot::Resource_File) {
QDynamicFileResourceRoot *root = reinterpret_cast<QDynamicFileResourceRoot*>(res); QDynamicFileResourceRoot *root = reinterpret_cast<QDynamicFileResourceRoot*>(res);
if (root->mappingFile() == rccFilename && root->mappingRoot() == r) { if (root->mappingFile() == rccFilename && root->mappingRoot() == r) {
resourceList()->removeAt(i); list->removeAt(i);
if(!root->ref.deref()) { if(!root->ref.deref()) {
delete root; delete root;
return true; return true;
@ -1288,7 +1300,7 @@ QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot)
if(res->type() == QResourceRoot::Resource_Buffer) { if(res->type() == QResourceRoot::Resource_Buffer) {
QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res); QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res);
if (root->mappingBuffer() == rccData && root->mappingRoot() == r) { if (root->mappingBuffer() == rccData && root->mappingRoot() == r) {
resourceList()->removeAt(i); list->removeAt(i);
if(!root->ref.deref()) { if(!root->ref.deref()) {
delete root; delete root;
return true; return true;
@ -1366,9 +1378,15 @@ bool QResourceFileEngine::open(QIODevice::OpenMode flags)
qWarning("QResourceFileEngine::open: Missing file name"); qWarning("QResourceFileEngine::open: Missing file name");
return false; return false;
} }
if(flags & QIODevice::WriteOnly) if (flags & QIODevice::WriteOnly)
return false; return false;
d->uncompress(); if (d->resource.compressionAlgorithm() != QResource::NoCompression) {
d->uncompress();
if (d->uncompressed.isNull()) {
d->errorString = QSystemError::stdString(EIO);
return false;
}
}
if (!d->resource.isValid()) { if (!d->resource.isValid()) {
d->errorString = QSystemError::stdString(ENOENT); d->errorString = QSystemError::stdString(ENOENT);
return false; return false;
@ -1395,7 +1413,7 @@ qint64 QResourceFileEngine::read(char *data, qint64 len)
len = size()-d->offset; len = size()-d->offset;
if(len <= 0) if(len <= 0)
return 0; return 0;
if(d->resource.isCompressed()) if (!d->uncompressed.isNull())
memcpy(data, d->uncompressed.constData()+d->offset, len); memcpy(data, d->uncompressed.constData()+d->offset, len);
else else
memcpy(data, d->resource.data()+d->offset, len); memcpy(data, d->resource.data()+d->offset, len);
@ -1431,9 +1449,9 @@ bool QResourceFileEngine::link(const QString &)
qint64 QResourceFileEngine::size() const qint64 QResourceFileEngine::size() const
{ {
Q_D(const QResourceFileEngine); Q_D(const QResourceFileEngine);
if(!d->resource.isValid()) if (!d->resource.isValid())
return 0; return 0;
if (d->resource.isCompressed()) { if (d->resource.compressionAlgorithm() != QResource::NoCompression) {
d->uncompress(); d->uncompress();
return d->uncompressed.size(); return d->uncompressed.size();
} }
@ -1596,7 +1614,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
Q_UNUSED(flags); Q_UNUSED(flags);
qint64 max = resource.size(); qint64 max = resource.size();
if (resource.isCompressed()) { if (resource.compressionAlgorithm() != QResource::NoCompression) {
uncompress(); uncompress();
max = uncompressed.size(); max = uncompressed.size();
} }
@ -1609,7 +1627,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
} }
const uchar *address = resource.data(); const uchar *address = resource.data();
if (resource.isCompressed()) if (resource.compressionAlgorithm() != QResource::NoCompression)
address = reinterpret_cast<const uchar *>(uncompressed.constData()); address = reinterpret_cast<const uchar *>(uncompressed.constData());
return const_cast<uchar *>(address) + offset; return const_cast<uchar *>(address) + offset;

View File

@ -72,7 +72,6 @@ public:
bool isValid() const; bool isValid() const;
bool isCompressed() const;
Compression compressionAlgorithm() const; Compression compressionAlgorithm() const;
qint64 size() const; qint64 size() const;
const uchar *data() const; const uchar *data() const;
@ -84,6 +83,10 @@ public:
QT_DEPRECATED_X("Use QDir::searchPaths() instead") QT_DEPRECATED_X("Use QDir::searchPaths() instead")
static QStringList searchPaths(); static QStringList searchPaths();
#endif #endif
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_VERSION_X_5_15("Use QResource::compressionAlgorithm() instead")
bool isCompressed() const;
#endif
static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString()); static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString()); static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());

View File

@ -150,8 +150,7 @@ QSaveFile::~QSaveFile()
QFileDevice::close(); QFileDevice::close();
if (d->fileEngine) { if (d->fileEngine) {
d->fileEngine->remove(); d->fileEngine->remove();
delete d->fileEngine; d->fileEngine.reset();
d->fileEngine = nullptr;
} }
} }
@ -197,6 +196,7 @@ bool QSaveFile::open(OpenMode mode)
return false; return false;
} }
unsetError(); unsetError();
d->writeError = QFileDevice::NoError;
if ((mode & (ReadOnly | WriteOnly)) == 0) { if ((mode & (ReadOnly | WriteOnly)) == 0) {
qWarning("QSaveFile::open: Open mode not specified"); qWarning("QSaveFile::open: Open mode not specified");
return false; return false;
@ -234,7 +234,7 @@ bool QSaveFile::open(OpenMode mode)
} }
auto openDirectly = [&]() { auto openDirectly = [&]() {
d->fileEngine = QAbstractFileEngine::create(d->finalFileName); d->fileEngine.reset(QAbstractFileEngine::create(d->finalFileName));
if (d->fileEngine->open(mode | QIODevice::Unbuffered)) { if (d->fileEngine->open(mode | QIODevice::Unbuffered)) {
d->useTemporaryFile = false; d->useTemporaryFile = false;
QFileDevice::open(mode); QFileDevice::open(mode);
@ -251,8 +251,7 @@ bool QSaveFile::open(OpenMode mode)
if (openDirectly()) if (openDirectly())
return true; return true;
d->setError(d->fileEngine->error(), d->fileEngine->errorString()); d->setError(d->fileEngine->error(), d->fileEngine->errorString());
delete d->fileEngine; d->fileEngine.reset();
d->fileEngine = nullptr;
} else { } else {
QString msg = QString msg =
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback " QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback "
@ -264,18 +263,17 @@ bool QSaveFile::open(OpenMode mode)
} }
#endif #endif
d->fileEngine = new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared); d->fileEngine.reset(new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared));
// if the target file exists, we'll copy its permissions below, // if the target file exists, we'll copy its permissions below,
// but until then, let's ensure the temporary file is not accessible // but until then, let's ensure the temporary file is not accessible
// to a third party // to a third party
int perm = (existingFile.exists() ? 0600 : 0666); int perm = (existingFile.exists() ? 0600 : 0666);
static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, perm); static_cast<QTemporaryFileEngine *>(d->fileEngine.get())->initialize(d->finalFileName, perm);
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine. // Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) { if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
QFileDevice::FileError err = d->fileEngine->error(); QFileDevice::FileError err = d->fileEngine->error();
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) { if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) {
delete d->fileEngine;
if (openDirectly()) if (openDirectly())
return true; return true;
err = d->fileEngine->error(); err = d->fileEngine->error();
@ -284,8 +282,7 @@ bool QSaveFile::open(OpenMode mode)
if (err == QFileDevice::UnspecifiedError) if (err == QFileDevice::UnspecifiedError)
err = QFileDevice::OpenError; err = QFileDevice::OpenError;
d->setError(err, d->fileEngine->errorString()); d->setError(err, d->fileEngine->errorString());
delete d->fileEngine; d->fileEngine.reset();
d->fileEngine = nullptr;
return false; return false;
} }
@ -331,30 +328,26 @@ bool QSaveFile::commit()
} }
QFileDevice::close(); // calls flush() QFileDevice::close(); // calls flush()
const auto fe = std::move(d->fileEngine);
// Sync to disk if possible. Ignore errors (e.g. not supported). // Sync to disk if possible. Ignore errors (e.g. not supported).
d->fileEngine->syncToDisk(); fe->syncToDisk();
if (d->useTemporaryFile) { if (d->useTemporaryFile) {
if (d->writeError != QFileDevice::NoError) { if (d->writeError != QFileDevice::NoError) {
d->fileEngine->remove(); fe->remove();
d->writeError = QFileDevice::NoError; d->writeError = QFileDevice::NoError;
delete d->fileEngine;
d->fileEngine = nullptr;
return false; return false;
} }
// atomically replace old file with new file // atomically replace old file with new file
// Can't use QFile::rename for that, must use the file engine directly // Can't use QFile::rename for that, must use the file engine directly
Q_ASSERT(d->fileEngine); Q_ASSERT(fe);
if (!d->fileEngine->renameOverwrite(d->finalFileName)) { if (!fe->renameOverwrite(d->finalFileName)) {
d->setError(d->fileEngine->error(), d->fileEngine->errorString()); d->setError(fe->error(), fe->errorString());
d->fileEngine->remove(); fe->remove();
delete d->fileEngine;
d->fileEngine = nullptr;
return false; return false;
} }
} }
delete d->fileEngine;
d->fileEngine = nullptr;
return true; return true;
} }

View File

@ -297,7 +297,7 @@ QT_BEGIN_NAMESPACE
\li "<APPROOT>/tmp" \li "<APPROOT>/tmp"
\row \li HomeLocation \row \li HomeLocation
\li "<APPROOT>/files" \li "<APPROOT>/files"
\li "<APPROOT>" (not writable) \li system defined
\row \li DataLocation \row \li DataLocation
\li "<APPROOT>/files", "<USER>/<APPNAME>/files" \li "<APPROOT>/files", "<USER>/<APPNAME>/files"
\li "<APPROOT>/Library/Application Support" \li "<APPROOT>/Library/Application Support"

View File

@ -71,6 +71,28 @@ static void appendOrganizationAndApp(QString &path)
#endif #endif
} }
#if QT_CONFIG(regularexpression)
static QLatin1String xdg_key_name(QStandardPaths::StandardLocation type)
{
switch (type) {
case QStandardPaths::DesktopLocation:
return QLatin1String("DESKTOP");
case QStandardPaths::DocumentsLocation:
return QLatin1String("DOCUMENTS");
case QStandardPaths::PicturesLocation:
return QLatin1String("PICTURES");
case QStandardPaths::MusicLocation:
return QLatin1String("MUSIC");
case QStandardPaths::MoviesLocation:
return QLatin1String("VIDEOS");
case QStandardPaths::DownloadLocation:
return QLatin1String("DOWNLOAD");
default:
return QLatin1String();
}
}
#endif
QString QStandardPaths::writableLocation(StandardLocation type) QString QStandardPaths::writableLocation(StandardLocation type)
{ {
switch (type) { switch (type) {
@ -182,61 +204,32 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (xdgConfigHome.isEmpty()) if (xdgConfigHome.isEmpty())
xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); xdgConfigHome = QDir::homePath() + QLatin1String("/.config");
QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs")); QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs"));
if (!isTestModeEnabled() && file.open(QIODevice::ReadOnly)) { const QLatin1String key = xdg_key_name(type);
QHash<QString, QString> lines; if (!key.isEmpty() && !isTestModeEnabled() && file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file); QTextStream stream(&file);
// Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop" // Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop"
QRegularExpression exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); QRegularExpression exp(QLatin1String("^XDG_(.*)_DIR=(.*)$"));
QString result;
while (!stream.atEnd()) { while (!stream.atEnd()) {
const QString &line = stream.readLine(); const QString &line = stream.readLine();
QRegularExpressionMatch match = exp.match(line); QRegularExpressionMatch match = exp.match(line);
if (match.hasMatch()) { if (match.hasMatch() && match.capturedView(1) == key) {
const QStringList lst = match.capturedTexts(); QStringView value = match.capturedView(2);
const QString key = lst.at(1);
QString value = lst.at(2);
if (value.length() > 2 if (value.length() > 2
&& value.startsWith(QLatin1Char('\"')) && value.startsWith(QLatin1Char('\"'))
&& value.endsWith(QLatin1Char('\"'))) && value.endsWith(QLatin1Char('\"')))
value = value.mid(1, value.length() - 2); value = value.mid(1, value.length() - 2);
// Store the key and value: "DESKTOP", "$HOME/Desktop"
lines[key] = value;
}
}
QString key;
switch (type) {
case DesktopLocation:
key = QLatin1String("DESKTOP");
break;
case DocumentsLocation:
key = QLatin1String("DOCUMENTS");
break;
case PicturesLocation:
key = QLatin1String("PICTURES");
break;
case MusicLocation:
key = QLatin1String("MUSIC");
break;
case MoviesLocation:
key = QLatin1String("VIDEOS");
break;
case DownloadLocation:
key = QLatin1String("DOWNLOAD");
break;
default:
break;
}
if (!key.isEmpty()) {
QString value = lines.value(key);
if (!value.isEmpty()) {
// value can start with $HOME // value can start with $HOME
if (value.startsWith(QLatin1String("$HOME"))) if (value.startsWith(QLatin1String("$HOME")))
value = QDir::homePath() + value.midRef(5); result = QDir::homePath() + value.mid(5);
if (value.length() > 1 && value.endsWith(QLatin1Char('/'))) else
value.chop(1); result = value.toString();
return value; if (result.length() > 1 && result.endsWith(QLatin1Char('/')))
result.chop(1);
} }
} }
if (!result.isNull())
return result;
} }
#endif // QT_CONFIG(regularexpression) #endif // QT_CONFIG(regularexpression)

View File

@ -468,8 +468,18 @@ inline bool QStorageIterator::next()
size_t len = strlen(buffer.data()); size_t len = strlen(buffer.data());
if (len == 0) if (len == 0)
return false; return false;
if (ptr[len - 1] == '\n') while (Q_UNLIKELY(ptr[len - 1] != '\n' && !feof(fp))) {
ptr[len - 1] = '\0'; // buffer wasn't large enough. Enlarge and try again.
// (we're readidng from the kernel, so OOM is unlikely)
buffer.resize((buffer.size() + 4096) & ~4095);
ptr = buffer.data();
if (fgets(ptr + len, buffer.size() - len, fp) == nullptr)
return false;
len += strlen(ptr + len);
Q_ASSERT(len < size_t(buffer.size()));
}
ptr[len - 1] = '\0';
// parse the line // parse the line
bool ok; bool ok;

View File

@ -544,10 +544,10 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
QAbstractFileEngine *QTemporaryFilePrivate::engine() const QAbstractFileEngine *QTemporaryFilePrivate::engine() const
{ {
if (!fileEngine) { if (!fileEngine) {
fileEngine = new QTemporaryFileEngine(&templateName); fileEngine.reset(new QTemporaryFileEngine(&templateName));
resetFileEngine(); resetFileEngine();
} }
return fileEngine; return fileEngine.get();
} }
void QTemporaryFilePrivate::resetFileEngine() const void QTemporaryFilePrivate::resetFileEngine() const
@ -555,7 +555,7 @@ void QTemporaryFilePrivate::resetFileEngine() const
if (!fileEngine) if (!fileEngine)
return; return;
QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine); QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine.get());
if (fileName.isEmpty()) if (fileName.isEmpty())
tef->initialize(templateName, 0600); tef->initialize(templateName, 0600);
else else
@ -568,7 +568,7 @@ void QTemporaryFilePrivate::materializeUnnamedFile()
if (!fileName.isEmpty() || !fileEngine) if (!fileName.isEmpty() || !fileEngine)
return; return;
auto *tef = static_cast<QTemporaryFileEngine *>(fileEngine); auto *tef = static_cast<QTemporaryFileEngine *>(fileEngine.get());
fileName = tef->fileName(QAbstractFileEngine::DefaultName); fileName = tef->fileName(QAbstractFileEngine::DefaultName);
#endif #endif
} }
@ -792,7 +792,7 @@ void QTemporaryFile::setAutoRemove(bool b)
QString QTemporaryFile::fileName() const QString QTemporaryFile::fileName() const
{ {
Q_D(const QTemporaryFile); Q_D(const QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine); auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef && tef->isReallyOpen()) if (tef && tef->isReallyOpen())
const_cast<QTemporaryFilePrivate *>(d)->materializeUnnamedFile(); const_cast<QTemporaryFilePrivate *>(d)->materializeUnnamedFile();
@ -841,7 +841,7 @@ void QTemporaryFile::setFileTemplate(const QString &name)
bool QTemporaryFile::rename(const QString &newName) bool QTemporaryFile::rename(const QString &newName)
{ {
Q_D(QTemporaryFile); Q_D(QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine); auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (!tef || !tef->isReallyOpen() || !tef->filePathWasTemplate) if (!tef || !tef->isReallyOpen() || !tef->filePathWasTemplate)
return QFile::rename(newName); return QFile::rename(newName);
@ -947,7 +947,7 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file)
bool QTemporaryFile::open(OpenMode flags) bool QTemporaryFile::open(OpenMode flags)
{ {
Q_D(QTemporaryFile); Q_D(QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine); auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef && tef->isReallyOpen()) { if (tef && tef->isReallyOpen()) {
setOpenMode(flags); setOpenMode(flags);
return true; return true;
@ -961,7 +961,7 @@ bool QTemporaryFile::open(OpenMode flags)
d->resetFileEngine(); d->resetFileEngine();
if (QFile::open(flags)) { if (QFile::open(flags)) {
tef = static_cast<QTemporaryFileEngine *>(d->fileEngine); tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef->isUnnamedFile()) if (tef->isUnnamedFile())
d->fileName.clear(); d->fileName.clear();
else else

View File

@ -59,9 +59,9 @@ enum TLDMatchType {
static bool containsTLDEntry(QStringView entry, TLDMatchType match) static bool containsTLDEntry(QStringView entry, TLDMatchType match)
{ {
const QStringView matchSymbols[] = { const QStringView matchSymbols[] = {
QStringViewLiteral(""), u"",
QStringViewLiteral("*"), u"*",
QStringViewLiteral("!"), u"!",
}; };
const auto symbol = matchSymbols[match]; const auto symbol = matchSymbols[match];
int index = qt_hash(entry, qt_hash(symbol)) % tldCount; int index = qt_hash(entry, qt_hash(symbol)) % tldCount;

View File

@ -1010,7 +1010,7 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro
for (int i = needsLowercasing; i >= 0; --i) { for (int i = needsLowercasing; i >= 0; --i) {
ushort c = schemeData[i].unicode(); ushort c = schemeData[i].unicode();
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
schemeData[i] = c + 0x20; schemeData[i] = QChar(c + 0x20);
} }
} }

View File

@ -2220,9 +2220,8 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString
bool skipped = false; bool skipped = false;
// copy all basic code points verbatim to output. // copy all basic code points verbatim to output.
for (uint j = 0; j < (uint) ucLength; ++j) { for (uint j = 0; j < (uint) ucLength; ++j) {
ushort js = s[j].unicode(); if (s[j].unicode() < 0x80)
if (js < 0x80) *d++ = s[j];
*d++ = js;
else else
skipped = true; skipped = true;
} }

View File

@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE
*/ */
/*! /*!
\fn QUrlQuery(std::initializer_list<QPair<QString, QString>> list) \fn QUrlQuery::QUrlQuery(std::initializer_list<QPair<QString, QString>> list)
\since 5.13 \since 5.13
@ -293,9 +293,9 @@ void QUrlQueryPrivate::setQuery(const QString &query)
const QChar *delimiter = nullptr; const QChar *delimiter = nullptr;
while (pos != end) { while (pos != end) {
// scan for the component parts of this pair // scan for the component parts of this pair
if (!delimiter && pos->unicode() == valueDelimiter) if (!delimiter && *pos == valueDelimiter)
delimiter = pos; delimiter = pos;
if (pos->unicode() == pairDelimiter) if (*pos == pairDelimiter)
break; break;
++pos; ++pos;
} }
@ -584,8 +584,8 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
*/ */
void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter) void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter)
{ {
d->valueDelimiter = valueDelimiter.unicode(); d->valueDelimiter = valueDelimiter;
d->pairDelimiter = pairDelimiter.unicode(); d->pairDelimiter = pairDelimiter;
} }
/*! /*!

View File

@ -532,21 +532,16 @@ void QAbstractItemModelPrivate::invalidatePersistentIndex(const QModelIndex &ind
} }
} }
namespace { using DefaultRoleNames = QHash<int, QByteArray>;
struct DefaultRoleNames : public QHash<int, QByteArray> Q_GLOBAL_STATIC_WITH_ARGS(DefaultRoleNames, qDefaultRoleNames, (
{ {
DefaultRoleNames() { { Qt::DisplayRole, "display" },
(*this)[Qt::DisplayRole] = "display"; { Qt::DecorationRole, "decoration" },
(*this)[Qt::DecorationRole] = "decoration"; { Qt::EditRole, "edit" },
(*this)[Qt::EditRole] = "edit"; { Qt::ToolTipRole, "toolTip" },
(*this)[Qt::ToolTipRole] = "toolTip"; { Qt::StatusTipRole, "statusTip" },
(*this)[Qt::StatusTipRole] = "statusTip"; { Qt::WhatsThisRole, "whatsThis" },
(*this)[Qt::WhatsThisRole] = "whatsThis"; }))
}
};
}
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames)
const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames() const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()
{ {

View File

@ -64,11 +64,7 @@ struct QSortFilterProxyModelDataChanged
static inline QSet<int> qVectorToSet(const QVector<int> &vector) static inline QSet<int> qVectorToSet(const QVector<int> &vector)
{ {
QSet<int> set; return {vector.begin(), vector.end()};
set.reserve(vector.size());
for(int i=0; i < vector.size(); ++i)
set << vector.at(i);
return set;
} }
class QSortFilterProxyModelLessThan class QSortFilterProxyModelLessThan
@ -130,7 +126,7 @@ struct QRowsRemoval
{ {
} }
bool contains(QModelIndex parent, int row) bool contains(QModelIndex parent, int row) const
{ {
do { do {
if (parent == parent_source) if (parent == parent_source)
@ -470,8 +466,8 @@ bool QSortFilterProxyModelPrivate::filterRecursiveAcceptsRow(int source_row, con
void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent) void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent)
{ {
if (Mapping *m = source_index_mapping.take(source_parent)) { if (Mapping *m = source_index_mapping.take(source_parent)) {
for (int i = 0; i < m->mapped_children.size(); ++i) for (const QModelIndex &mappedIdx : qAsConst(m->mapped_children))
remove_from_mapping(m->mapped_children.at(i)); remove_from_mapping(mappedIdx);
delete m; delete m;
} }
} }
@ -607,9 +603,9 @@ void QSortFilterProxyModelPrivate::sort()
Q_Q(QSortFilterProxyModel); Q_Q(QSortFilterProxyModel);
emit q->layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint); emit q->layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint);
QModelIndexPairList source_indexes = store_persistent_indexes(); QModelIndexPairList source_indexes = store_persistent_indexes();
IndexMap::const_iterator it = source_index_mapping.constBegin(); const auto end = source_index_mapping.constEnd();
for (; it != source_index_mapping.constEnd(); ++it) { for (auto it = source_index_mapping.constBegin(); it != end; ++it) {
QModelIndex source_parent = it.key(); const QModelIndex &source_parent = it.key();
Mapping *m = it.value(); Mapping *m = it.value();
sort_source_rows(m->source_rows, source_parent); sort_source_rows(m->source_rows, source_parent);
build_source_to_proxy_mapping(m->source_rows, m->proxy_rows); build_source_to_proxy_mapping(m->source_rows, m->proxy_rows);
@ -735,13 +731,14 @@ void QSortFilterProxyModelPrivate::remove_source_items(
if (!proxy_parent.isValid() && source_parent.isValid()) if (!proxy_parent.isValid() && source_parent.isValid())
return; // nothing to do (already removed) return; // nothing to do (already removed)
QVector<QPair<int, int> > proxy_intervals; const auto proxy_intervals = proxy_intervals_for_source_items(
proxy_intervals = proxy_intervals_for_source_items(source_to_proxy, source_items); source_to_proxy, source_items);
for (int i = proxy_intervals.size()-1; i >= 0; --i) { const auto end = proxy_intervals.rend();
QPair<int, int> interval = proxy_intervals.at(i); for (auto it = proxy_intervals.rbegin(); it != end; ++it) {
int proxy_start = interval.first; const QPair<int, int> &interval = *it;
int proxy_end = interval.second; const int proxy_start = interval.first;
const int proxy_end = interval.second;
remove_proxy_interval(source_to_proxy, proxy_to_source, proxy_start, proxy_end, remove_proxy_interval(source_to_proxy, proxy_to_source, proxy_start, proxy_end,
proxy_parent, orient, emit_signal); proxy_parent, orient, emit_signal);
} }
@ -875,15 +872,15 @@ void QSortFilterProxyModelPrivate::insert_source_items(
if (!proxy_parent.isValid() && source_parent.isValid()) if (!proxy_parent.isValid() && source_parent.isValid())
return; // nothing to do (source_parent is not mapped) return; // nothing to do (source_parent is not mapped)
QVector<QPair<int, QVector<int> > > proxy_intervals; const auto proxy_intervals = proxy_intervals_for_source_items_to_add(
proxy_intervals = proxy_intervals_for_source_items_to_add(
proxy_to_source, source_items, source_parent, orient); proxy_to_source, source_items, source_parent, orient);
for (int i = proxy_intervals.size()-1; i >= 0; --i) { const auto end = proxy_intervals.rend();
QPair<int, QVector<int> > interval = proxy_intervals.at(i); for (auto it = proxy_intervals.rbegin(); it != end; ++it) {
int proxy_start = interval.first; const QPair<int, QVector<int> > &interval = *it;
QVector<int> source_items = interval.second; const int proxy_start = interval.first;
int proxy_end = proxy_start + source_items.size() - 1; const QVector<int> &source_items = interval.second;
const int proxy_end = proxy_start + source_items.size() - 1;
if (emit_signal) { if (emit_signal) {
if (orient == Qt::Vertical) if (orient == Qt::Vertical)
@ -1195,8 +1192,8 @@ QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() con
Q_Q(const QSortFilterProxyModel); Q_Q(const QSortFilterProxyModel);
QModelIndexPairList source_indexes; QModelIndexPairList source_indexes;
source_indexes.reserve(persistent.indexes.count()); source_indexes.reserve(persistent.indexes.count());
for (QPersistentModelIndexData *data : qAsConst(persistent.indexes)) { for (const QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {
QModelIndex proxy_index = data->index; const QModelIndex &proxy_index = data->index;
QModelIndex source_index = q->mapToSource(proxy_index); QModelIndex source_index = q->mapToSource(proxy_index);
source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index))); source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index)));
} }
@ -1217,9 +1214,9 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes(
const int numSourceIndexes = source_indexes.count(); const int numSourceIndexes = source_indexes.count();
from.reserve(numSourceIndexes); from.reserve(numSourceIndexes);
to.reserve(numSourceIndexes); to.reserve(numSourceIndexes);
for (int i = 0; i < numSourceIndexes; ++i) { for (const auto &indexPair : source_indexes) {
QModelIndex source_index = source_indexes.at(i).second; const QPersistentModelIndex &source_index = indexPair.second;
QModelIndex old_proxy_index = source_indexes.at(i).first; const QModelIndex &old_proxy_index = indexPair.first;
create_mapping(source_index.parent()); create_mapping(source_index.parent());
QModelIndex proxy_index = q->mapFromSource(source_index); QModelIndex proxy_index = q->mapFromSource(source_index);
from << old_proxy_index; from << old_proxy_index;
@ -1264,7 +1261,7 @@ void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_pare
const QVector<QModelIndex> mappedChildren = m->mapped_children; const QVector<QModelIndex> mappedChildren = m->mapped_children;
QVector<int> indexesToRemove; QVector<int> indexesToRemove;
for (int i = 0; i < mappedChildren.size(); ++i) { for (int i = 0; i < mappedChildren.size(); ++i) {
const QModelIndex source_child_index = mappedChildren.at(i); const QModelIndex &source_child_index = mappedChildren.at(i);
if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) { if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) {
indexesToRemove.push_back(i); indexesToRemove.push_back(i);
remove_from_mapping(source_child_index); remove_from_mapping(source_child_index);
@ -2296,10 +2293,9 @@ QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const
{ {
Q_D(const QSortFilterProxyModel); Q_D(const QSortFilterProxyModel);
QModelIndexList source_indexes; QModelIndexList source_indexes;
const int numIndexes = indexes.count(); source_indexes.reserve(indexes.count());
source_indexes.reserve(numIndexes); for (const QModelIndex &idx : indexes)
for (int i = 0; i < numIndexes; ++i) source_indexes << mapToSource(idx);
source_indexes << mapToSource(indexes.at(i));
return d->model->mimeData(source_indexes); return d->model->mimeData(source_indexes);
} }

View File

@ -514,10 +514,9 @@ Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version);
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void QMacKeyValueObserver::addObserver() void QMacKeyValueObserver::addObserver(NSKeyValueObservingOptions options)
{ {
[object addObserver:observer forKeyPath:keyPath [object addObserver:observer forKeyPath:keyPath options:options context:callback.get()];
options:NSKeyValueObservingOptionNew context:callback.get()];
} }
void QMacKeyValueObserver::removeObserver() { void QMacKeyValueObserver::removeObserver() {

View File

@ -350,8 +350,12 @@ public:
QMacKeyValueObserver() {} QMacKeyValueObserver() {}
// Note: QMacKeyValueObserver must not outlive the object observed! // Note: QMacKeyValueObserver must not outlive the object observed!
QMacKeyValueObserver(id object, NSString *keyPath, Callback callback) QMacKeyValueObserver(id object, NSString *keyPath, Callback callback,
: object(object), keyPath(keyPath), callback(new Callback(callback)) { addObserver(); } NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
: object(object), keyPath(keyPath), callback(new Callback(callback))
{
addObserver(options);
}
QMacKeyValueObserver(const QMacKeyValueObserver &other) QMacKeyValueObserver(const QMacKeyValueObserver &other)
: QMacKeyValueObserver(other.object, other.keyPath, *other.callback.get()) {} : QMacKeyValueObserver(other.object, other.keyPath, *other.callback.get()) {}
@ -381,7 +385,7 @@ private:
std::swap(first.callback, second.callback); std::swap(first.callback, second.callback);
} }
void addObserver(); void addObserver(NSKeyValueObservingOptions options);
id object = nil; id object = nil;
NSString *keyPath = nullptr; NSString *keyPath = nullptr;

View File

@ -57,7 +57,7 @@
#include <qt_windows.h> #include <qt_windows.h>
namespace std { template <typename T> class function; } #include <functional>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -953,7 +953,7 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co
return self; return self;
if (self->d.relatedMetaObjects) { if (self->d.relatedMetaObjects) {
Q_ASSERT(priv(self->d.data)->revision >= 2); Q_ASSERT(priv(self->d.data)->revision >= 2);
const QMetaObject * const *e = self->d.relatedMetaObjects; const auto *e = self->d.relatedMetaObjects;
if (e) { if (e) {
while (*e) { while (*e) {
if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name)) if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name))

View File

@ -747,7 +747,7 @@ void QMetaObjectBuilder::addMetaObject
if ((members & RelatedMetaObjects) != 0) { if ((members & RelatedMetaObjects) != 0) {
Q_ASSERT(priv(prototype->d.data)->revision >= 2); Q_ASSERT(priv(prototype->d.data)->revision >= 2);
const QMetaObject * const *objects = prototype->d.relatedMetaObjects; const auto *objects = prototype->d.relatedMetaObjects;
if (objects) { if (objects) {
while (*objects != 0) { while (*objects != 0) {
addRelatedMetaObject(*objects); addRelatedMetaObject(*objects);
@ -1464,16 +1464,16 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
// Create the relatedMetaObjects block if we need one. // Create the relatedMetaObjects block if we need one.
if (d->relatedMetaObjects.size() > 0) { if (d->relatedMetaObjects.size() > 0) {
ALIGN(size, QMetaObject *); using SuperData = QMetaObject::SuperData;
const QMetaObject **objects = ALIGN(size, SuperData);
reinterpret_cast<const QMetaObject **>(buf + size); auto objects = reinterpret_cast<SuperData *>(buf + size);
if (buf) { if (buf) {
meta->d.relatedMetaObjects = objects; meta->d.relatedMetaObjects = objects;
for (index = 0; index < d->relatedMetaObjects.size(); ++index) for (index = 0; index < d->relatedMetaObjects.size(); ++index)
objects[index] = d->relatedMetaObjects[index]; objects[index] = d->relatedMetaObjects[index];
objects[index] = 0; objects[index] = nullptr;
} }
size += sizeof(QMetaObject *) * (d->relatedMetaObjects.size() + 1); size += sizeof(SuperData) * (d->relatedMetaObjects.size() + 1);
} }
// Align the final size and return it. // Align the final size and return it.

View File

@ -216,7 +216,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QQueue) \ F(QQueue) \
F(QStack) \ F(QStack) \
F(QSet) \ F(QSet) \
F(QLinkedList) /*end*/
#define QT_FOR_EACH_AUTOMATIC_TEMPLATE_2ARG(F) \ #define QT_FOR_EACH_AUTOMATIC_TEMPLATE_2ARG(F) \
F(QHash, class) \ F(QHash, class) \

View File

@ -93,12 +93,6 @@ QAbstractDynamicMetaObject::~QAbstractDynamicMetaObject()
{ {
} }
struct QSlotObjectBaseDeleter { // for use with QScopedPointer<QSlotObjectBase,...>
static void cleanup(QtPrivate::QSlotObjectBase *slot) {
if (slot) slot->destroyIfLastRef();
}
};
static int *queuedConnectionTypes(const QList<QByteArray> &typeNames) static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
{ {
int *types = new int [typeNames.count() + 1]; int *types = new int [typeNames.count() + 1];
@ -3380,7 +3374,7 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
type &= Qt::UniqueConnection - 1; type &= Qt::UniqueConnection - 1;
} }
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection); std::unique_ptr<QObjectPrivate::Connection> c{new QObjectPrivate::Connection};
c->sender = s; c->sender = s;
c->signal_index = signal_index; c->signal_index = signal_index;
c->receiver.storeRelaxed(r); c->receiver.storeRelaxed(r);
@ -3394,14 +3388,14 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
c->argumentTypes.storeRelaxed(types); c->argumentTypes.storeRelaxed(types);
c->callFunction = callFunction; c->callFunction = callFunction;
QObjectPrivate::get(s)->addConnection(signal_index, c.data()); QObjectPrivate::get(s)->addConnection(signal_index, c.get());
locker.unlock(); locker.unlock();
QMetaMethod smethod = QMetaObjectPrivate::signal(smeta, signal_index); QMetaMethod smethod = QMetaObjectPrivate::signal(smeta, signal_index);
if (smethod.isValid()) if (smethod.isValid())
s->connectNotify(smethod); s->connectNotify(smethod);
return c.take(); return c.release();
} }
/*! /*!
@ -3791,10 +3785,16 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (c->isSlotObject) { if (c->isSlotObject) {
c->slotObj->ref(); c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
struct Deleter {
void operator()(QtPrivate::QSlotObjectBase *slot) const {
if (slot) slot->destroyIfLastRef();
}
};
const std::unique_ptr<QtPrivate::QSlotObjectBase, Deleter> obj{c->slotObj};
{ {
Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data()); Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.get());
obj->call(receiver, argv); obj->call(receiver, argv);
} }
} else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) { } else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
@ -4947,7 +4947,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
type = static_cast<Qt::ConnectionType>(type ^ Qt::UniqueConnection); type = static_cast<Qt::ConnectionType>(type ^ Qt::UniqueConnection);
} }
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection); std::unique_ptr<QObjectPrivate::Connection> c{new QObjectPrivate::Connection};
c->sender = s; c->sender = s;
c->signal_index = signal_index; c->signal_index = signal_index;
QThreadData *td = r->d_func()->threadData; QThreadData *td = r->d_func()->threadData;
@ -4962,8 +4962,8 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
c->ownArgumentTypes = false; c->ownArgumentTypes = false;
} }
QObjectPrivate::get(s)->addConnection(signal_index, c.data()); QObjectPrivate::get(s)->addConnection(signal_index, c.get());
QMetaObject::Connection ret(c.take()); QMetaObject::Connection ret(c.release());
locker.unlock(); locker.unlock();
QMetaMethod method = QMetaObjectPrivate::signal(senderMetaObject, signal_index); QMetaMethod method = QMetaObjectPrivate::signal(senderMetaObject, signal_index);

View File

@ -486,8 +486,11 @@ class Q_CORE_EXPORT QAbstractMetaCallEvent : public QEvent
{ {
public: public:
QAbstractMetaCallEvent(const QObject *sender, int signalId, QSemaphore *semaphore = nullptr) QAbstractMetaCallEvent(const QObject *sender, int signalId, QSemaphore *semaphore = nullptr)
: QEvent(MetaCall), signalId_(signalId), sender_(sender), semaphore_(semaphore) : QEvent(MetaCall), signalId_(signalId), sender_(sender)
{} #if QT_CONFIG(thread)
, semaphore_(semaphore)
#endif
{ Q_UNUSED(semaphore); }
~QAbstractMetaCallEvent(); ~QAbstractMetaCallEvent();
virtual void placeMetaCall(QObject *object) = 0; virtual void placeMetaCall(QObject *object) = 0;
@ -498,7 +501,9 @@ public:
private: private:
int signalId_; int signalId_;
const QObject *sender_; const QObject *sender_;
#if QT_CONFIG(thread)
QSemaphore *semaphore_; QSemaphore *semaphore_;
#endif
}; };
class Q_CORE_EXPORT QMetaCallEvent : public QAbstractMetaCallEvent class Q_CORE_EXPORT QMetaCallEvent : public QAbstractMetaCallEvent

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2019 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.
@ -572,13 +572,42 @@ struct Q_CORE_EXPORT QMetaObject
int static_metacall(Call, int, void **) const; int static_metacall(Call, int, void **) const;
static int metacall(QObject *, Call, int, void **); static int metacall(QObject *, Call, int, void **);
template <const QMetaObject &MO> static constexpr const QMetaObject *staticMetaObject()
{
return &MO;
}
struct SuperData {
const QMetaObject *direct;
SuperData() = default;
constexpr SuperData(std::nullptr_t) : direct(nullptr) {}
constexpr SuperData(const QMetaObject *mo) : direct(mo) {}
constexpr const QMetaObject *operator->() const { return operator const QMetaObject *(); }
#ifdef QT_NO_DATA_RELOCATION
using Getter = const QMetaObject *(*)();
Getter indirect = nullptr;
constexpr SuperData(Getter g) : direct(nullptr), indirect(g) {}
constexpr operator const QMetaObject *() const
{ return indirect ? indirect() : direct; }
template <const QMetaObject &MO> static constexpr SuperData link()
{ return SuperData(QMetaObject::staticMetaObject<MO>); }
#else
constexpr operator const QMetaObject *() const
{ return direct; }
template <const QMetaObject &MO> static constexpr SuperData link()
{ return SuperData(QMetaObject::staticMetaObject<MO>()); }
#endif
};
struct { // private data struct { // private data
const QMetaObject *superdata; SuperData superdata;
const QByteArrayData *stringdata; const QByteArrayData *stringdata;
const uint *data; const uint *data;
typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **); typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **);
StaticMetacallFunction static_metacall; StaticMetacallFunction static_metacall;
const QMetaObject * const *relatedMetaObjects; const SuperData *relatedMetaObjects;
void *extradata; //reserved for future use void *extradata; //reserved for future use
} d; } d;

View File

@ -38,7 +38,6 @@
****************************************************************************/ ****************************************************************************/
#include "qglobal.h" #include "qglobal.h"
#if QT_DEPRECATED_SINCE(5, 10)
#include "qsignalmapper.h" #include "qsignalmapper.h"
#include "qhash.h" #include "qhash.h"
@ -64,7 +63,6 @@ public:
/*! /*!
\class QSignalMapper \class QSignalMapper
\inmodule QtCore \inmodule QtCore
\obsolete The recommended solution is connecting the signal to a lambda.
\brief The QSignalMapper class bundles signals from identifiable senders. \brief The QSignalMapper class bundles signals from identifiable senders.
\ingroup objectmodel \ingroup objectmodel
@ -72,7 +70,9 @@ public:
This class collects a set of parameterless signals, and re-emits This class collects a set of parameterless signals, and re-emits
them with integer, string or widget parameters corresponding to them with integer, string or widget parameters corresponding to
the object that sent the signal. the object that sent the signal. Note that in most cases you can
use lambdas for passing custom parameters to slots. This is less
costly and will simplify the code.
The class supports the mapping of particular strings or integers The class supports the mapping of particular strings or integers
with particular objects using setMapping(). The objects' signals with particular objects using setMapping(). The objects' signals
@ -314,5 +314,3 @@ void QSignalMapper::map(QObject *sender)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qsignalmapper.cpp" #include "moc_qsignalmapper.cpp"
#endif

View File

@ -42,8 +42,6 @@
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
#if QT_DEPRECATED_SINCE(5, 10)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSignalMapperPrivate; class QSignalMapperPrivate;
@ -53,7 +51,7 @@ class Q_CORE_EXPORT QSignalMapper : public QObject
Q_OBJECT Q_OBJECT
Q_DECLARE_PRIVATE(QSignalMapper) Q_DECLARE_PRIVATE(QSignalMapper)
public: public:
QT_DEPRECATED explicit QSignalMapper(QObject *parent = nullptr); explicit QSignalMapper(QObject *parent = nullptr);
~QSignalMapper(); ~QSignalMapper();
void setMapping(QObject *sender, int id); void setMapping(QObject *sender, int id);
@ -84,6 +82,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif
#endif // QSIGNALMAPPER_H #endif // QSIGNALMAPPER_H

View File

@ -528,7 +528,8 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
// memory, so no need to use QFile to copy it again. // memory, so no need to use QFile to copy it again.
Q_ASSERT(!d->resource); Q_ASSERT(!d->resource);
d->resource = new QResource(realname); d->resource = new QResource(realname);
if (resource->isValid() && !resource->isCompressed() && resource->size() >= MagicLength if (resource->isValid() && resource->compressionAlgorithm() == QResource::NoCompression
&& resource->size() >= MagicLength
&& !memcmp(resource->data(), magic, MagicLength)) { && !memcmp(resource->data(), magic, MagicLength)) {
d->unmapLength = resource->size(); d->unmapLength = resource->size();
d->unmapPointer = reinterpret_cast<char *>(const_cast<uchar *>(resource->data())); d->unmapPointer = reinterpret_cast<char *>(const_cast<uchar *>(resource->data()));

View File

@ -362,7 +362,7 @@ class Q_CORE_EXPORT QVariant
static inline QVariant fromValue(const T &value) static inline QVariant fromValue(const T &value)
{ return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); } { return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); }
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L #if (QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L) || defined(Q_CLANG_QDOC)
template<typename... Types> template<typename... Types>
static inline QVariant fromStdVariant(const std::variant<Types...> &value) static inline QVariant fromStdVariant(const std::variant<Types...> &value)
{ {

View File

@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
but if other instances of QPluginLoader are using the same but if other instances of QPluginLoader are using the same
library, the call will fail, and unloading will only happen when library, the call will fail, and unloading will only happen when
every instance has called unload(). Right before the unloading every instance has called unload(). Right before the unloading
happen, the root component will also be deleted. happens, the root component will also be deleted.
See \l{How to Create Qt Plugins} for more information about See \l{How to Create Qt Plugins} for more information about
how to make your application extensible through plugins. how to make your application extensible through plugins.

View File

@ -273,7 +273,7 @@ QCborValue QCborArray::at(qsizetype i) const
not be empty. not be empty.
QCborValueRef has the exact same API as \l QCborValue, with one important QCborValueRef has the exact same API as \l QCborValue, with one important
difference: if you assign new values to it, this map will be updated with difference: if you assign new values to it, this array will be updated with
that new value. that new value.
\sa operator[](), at(), last(), insert(), prepend(), append(), \sa operator[](), at(), last(), insert(), prepend(), append(),
@ -287,7 +287,7 @@ QCborValue QCborArray::at(qsizetype i) const
not be empty. not be empty.
QCborValueRef has the exact same API as \l QCborValue, with one important QCborValueRef has the exact same API as \l QCborValue, with one important
difference: if you assign new values to it, this map will be updated with difference: if you assign new values to it, this array will be updated with
that new value. that new value.
\sa operator[](), at(), first(), insert(), prepend(), append(), \sa operator[](), at(), first(), insert(), prepend(), append(),
@ -302,7 +302,7 @@ QCborValue QCborArray::at(qsizetype i) const
with undefined entries, until it has an entry at the specified index. with undefined entries, until it has an entry at the specified index.
QCborValueRef has the exact same API as \l QCborValue, with one important QCborValueRef has the exact same API as \l QCborValue, with one important
difference: if you assign new values to it, this map will be updated with difference: if you assign new values to it, this array will be updated with
that new value. that new value.
\sa at(), first(), last(), insert(), prepend(), append(), \sa at(), first(), last(), insert(), prepend(), append(),

View File

@ -1972,7 +1972,15 @@ inline void QCborStreamReader::preparse()
if (lastError() == QCborError::NoError) { if (lastError() == QCborError::NoError) {
type_ = cbor_value_get_type(&d->currentElement); type_ = cbor_value_get_type(&d->currentElement);
if (type_ != CborInvalidType) { if (type_ == CborInvalidType) {
// We may have reached the end.
if (d->device && d->containerStack.isEmpty()) {
d->buffer.clear();
if (d->bufferStart)
d->device->skip(d->bufferStart);
d->bufferStart = 0;
}
} else {
d->lastError = {}; d->lastError = {};
// Undo the type mapping that TinyCBOR does (we have an explicit type // Undo the type mapping that TinyCBOR does (we have an explicit type
// for negative integer and we don't have separate types for Boolean, // for negative integer and we don't have separate types for Boolean,

View File

@ -175,7 +175,7 @@ void Base::removeItems(int pos, int numItems)
length -= numItems; length -= numItems;
} }
int Object::indexOf(const QString &key, bool *exists) const int Object::indexOf(QStringView key, bool *exists) const
{ {
int min = 0; int min = 0;
int n = length; int n = length;
@ -257,7 +257,7 @@ bool Array::isValid(int maxSize) const
} }
bool Entry::operator ==(const QString &key) const bool Entry::operator ==(QStringView key) const
{ {
if (value.latinKey) if (value.latinKey)
return (shallowLatin1Key() == key); return (shallowLatin1Key() == key);
@ -270,7 +270,7 @@ bool Entry::operator==(QLatin1String key) const
if (value.latinKey) if (value.latinKey)
return shallowLatin1Key() == key; return shallowLatin1Key() == key;
else else
return shallowKey() == key; return shallowKey() == QString(key); // ### conversion to QString
} }
bool Entry::operator ==(const Entry &other) const bool Entry::operator ==(const Entry &other) const

View File

@ -66,11 +66,13 @@
#include <limits.h> #include <limits.h>
#include <limits> #include <limits>
#include <type_traits>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// in qstring.cpp // in qstring.cpp
void qt_to_latin1_unchecked(uchar *dst, const ushort *uc, qsizetype len); void qt_to_latin1_unchecked(uchar *dst, const ushort *uc, qsizetype len);
void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept;
/* /*
This defines a binary data structure for Json data. The data structure is optimised for fast reading This defines a binary data structure for Json data. The data structure is optimised for fast reading
@ -153,16 +155,24 @@ typedef qle_uint offset;
// round the size up to the next 4 byte boundary // round the size up to the next 4 byte boundary
inline int alignedSize(int size) { return (size + 3) & ~3; } inline int alignedSize(int size) { return (size + 3) & ~3; }
static inline bool useCompressed(const QString &s) const int MaxLatin1Length = 0x7fff;
static inline bool useCompressed(QStringView s)
{ {
if (s.length() >= 0x8000) if (s.length() > MaxLatin1Length)
return false; return false;
return QtPrivate::isLatin1(s); return QtPrivate::isLatin1(s);
} }
static inline int qStringSize(const QString &string, bool compress) static inline bool useCompressed(QLatin1String s)
{ {
int l = 2 + string.length(); return s.size() <= MaxLatin1Length;
}
template <typename T>
static inline int qStringSize(T string, bool compress)
{
int l = 2 + string.size();
if (!compress) if (!compress)
l *= 2; l *= 2;
return alignedSize(l); return alignedSize(l);
@ -214,37 +224,49 @@ public:
return maxSize >= 0 && uint(d->length) <= maxSize / sizeof(ushort); return maxSize >= 0 && uint(d->length) <= maxSize / sizeof(ushort);
} }
inline String &operator=(const QString &str) inline String &operator=(QStringView str)
{ {
d->length = str.length(); d->length = str.length();
#if Q_BYTE_ORDER == Q_BIG_ENDIAN qToLittleEndian<quint16>(str.utf16(), str.length(), d->utf16);
const ushort *uc = (const ushort *)str.unicode(); fillTrailingZeros();
for (int i = 0; i < str.length(); ++i)
d->utf16[i] = uc[i];
#else
memcpy(d->utf16, str.unicode(), str.length()*sizeof(ushort));
#endif
if (str.length() & 1)
d->utf16[str.length()] = 0;
return *this; return *this;
} }
inline bool operator ==(const QString &str) const { inline String &operator=(QLatin1String str)
{
d->length = str.size();
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
for (int i = 0; i < str.size(); ++i)
d->utf16[i] = str[i].unicode();
#else
qt_from_latin1((ushort *)d->utf16, str.data(), str.size());
#endif
fillTrailingZeros();
return *this;
}
void fillTrailingZeros()
{
if (d->length & 1)
d->utf16[d->length] = 0;
}
inline bool operator ==(QStringView str) const {
int slen = str.length(); int slen = str.length();
int l = d->length; int l = d->length;
if (slen != l) if (slen != l)
return false; return false;
const ushort *s = (const ushort *)str.constData(); const ushort *s = (const ushort *)str.utf16();
const qle_ushort *a = d->utf16; const qle_ushort *a = d->utf16;
const ushort *b = s; const ushort *b = s;
while (l-- && *a == *b) while (l-- && *a == *b)
a++,b++; a++,b++;
return (l == -1); return (l == -1);
} }
inline bool operator !=(const QString &str) const { inline bool operator !=(QStringView str) const {
return !operator ==(str); return !operator ==(str);
} }
inline bool operator >=(const QString &str) const { inline bool operator >=(QStringView str) const {
// ### // ###
return toString() >= str; return toString() >= str;
} }
@ -292,18 +314,34 @@ public:
return byteSize() <= maxSize; return byteSize() <= maxSize;
} }
inline Latin1String &operator=(const QString &str) inline Latin1String &operator=(QStringView str)
{ {
int len = d->length = str.length(); int len = d->length = str.length();
uchar *l = (uchar *)d->latin1; uchar *l = (uchar *)d->latin1;
const ushort *uc = (const ushort *)str.unicode(); const ushort *uc = (const ushort *)str.utf16();
qt_to_latin1_unchecked(l, uc, len); qt_to_latin1_unchecked(l, uc, len);
for ( ; (quintptr)(l+len) & 0x3; ++len) fillTrailingZeros();
l[len] = 0;
return *this; return *this;
} }
inline Latin1String &operator=(QLatin1String str)
{
int len = d->length = str.size();
uchar *l = (uchar *)d->latin1;
memcpy(l, str.data(), len);
fillTrailingZeros();
return *this;
}
void fillTrailingZeros()
{
uchar *l = (uchar *)d->latin1;
for (int len = d->length; (quintptr)(l + len) & 0x3; ++len)
l[len] = 0;
}
QLatin1String toQLatin1String() const noexcept { QLatin1String toQLatin1String() const noexcept {
return QLatin1String(d->latin1, d->length); return QLatin1String(d->latin1, d->length);
} }
@ -351,11 +389,11 @@ public:
{ \ { \
return lhs.toQLatin1String() op rhs; \ return lhs.toQLatin1String() op rhs; \
} \ } \
inline bool operator op(const QString &lhs, Latin1String rhs) noexcept \ inline bool operator op(QStringView lhs, Latin1String rhs) noexcept \
{ \ { \
return lhs op rhs.toQLatin1String(); \ return lhs op rhs.toQLatin1String(); \
} \ } \
inline bool operator op(Latin1String lhs, const QString &rhs) noexcept \ inline bool operator op(Latin1String lhs, QStringView rhs) noexcept \
{ \ { \
return lhs.toQLatin1String() op rhs; \ return lhs.toQLatin1String() op rhs; \
} \ } \
@ -419,7 +457,8 @@ inline bool String::operator<(const Latin1String &str) const
} }
static inline void copyString(char *dest, const QString &str, bool compress) template <typename T>
static inline void copyString(char *dest, T str, bool compress)
{ {
if (compress) { if (compress) {
Latin1String string(dest); Latin1String string(dest);
@ -469,7 +508,7 @@ public:
Entry *entryAt(int i) const { Entry *entryAt(int i) const {
return reinterpret_cast<Entry *>(((char *)this) + table()[i]); return reinterpret_cast<Entry *>(((char *)this) + table()[i]);
} }
int indexOf(const QString &key, bool *exists) const; int indexOf(QStringView key, bool *exists) const;
int indexOf(QLatin1String key, bool *exists) const; int indexOf(QLatin1String key, bool *exists) const;
bool isValid(int maxSize) const; bool isValid(int maxSize) const;
@ -577,9 +616,9 @@ public:
return shallowKey().isValid(maxSize); return shallowKey().isValid(maxSize);
} }
bool operator ==(const QString &key) const; bool operator ==(QStringView key) const;
inline bool operator !=(const QString &key) const { return !operator ==(key); } inline bool operator !=(QStringView key) const { return !operator ==(key); }
inline bool operator >=(const QString &key) const; inline bool operator >=(QStringView key) const;
bool operator==(QLatin1String key) const; bool operator==(QLatin1String key) const;
inline bool operator!=(QLatin1String key) const { return !operator ==(key); } inline bool operator!=(QLatin1String key) const { return !operator ==(key); }
@ -589,7 +628,7 @@ public:
bool operator >=(const Entry &other) const; bool operator >=(const Entry &other) const;
}; };
inline bool Entry::operator >=(const QString &key) const inline bool Entry::operator >=(QStringView key) const
{ {
if (value.latinKey) if (value.latinKey)
return (shallowLatin1Key() >= key); return (shallowLatin1Key() >= key);
@ -602,10 +641,10 @@ inline bool Entry::operator >=(QLatin1String key) const
if (value.latinKey) if (value.latinKey)
return shallowLatin1Key() >= key; return shallowLatin1Key() >= key;
else else
return shallowKey() >= key; return shallowKey() >= QString(key); // ### conversion to QString
} }
inline bool operator <(const QString &key, const Entry &e) inline bool operator <(QStringView key, const Entry &e)
{ return e >= key; } { return e >= key; }
inline bool operator<(QLatin1String key, const Entry &e) inline bool operator<(QLatin1String key, const Entry &e)

View File

@ -845,7 +845,7 @@ bool QJsonArray::operator!=(const QJsonArray &other) const
The return value is of type QJsonValueRef, a helper class for QJsonArray The return value is of type QJsonValueRef, a helper class for QJsonArray
and QJsonObject. When you get an object of type QJsonValueRef, you can and QJsonObject. When you get an object of type QJsonValueRef, you can
use it as if it were a reference to a QJsonValue. If you assign to it, use it as if it were a reference to a QJsonValue. If you assign to it,
the assignment will apply to the character in the QJsonArray of QJsonObject the assignment will apply to the element in the QJsonArray or QJsonObject
from which you got the reference. from which you got the reference.
\sa operator+() \sa operator+()

View File

@ -421,7 +421,7 @@ QJsonArray QCborArray::toJsonArray() const
} }
/*! /*!
Recursively converts every \l QCborValue value in this array to JSON using Recursively converts every \l QCborValue value in this map to JSON using
QCborValue::toJsonValue() and creates a string key for all keys that aren't QCborValue::toJsonValue() and creates a string key for all keys that aren't
strings, then returns the corresponding QJsonObject composed of those strings, then returns the corresponding QJsonObject composed of those
associations. associations.

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