summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt6CoreMacros.cmake15
-rw-r--r--src/corelib/configure.cmake2
-rw-r--r--src/corelib/doc/src/cmake/cmake-configure-variables.qdoc1
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp6
-rw-r--r--src/corelib/global/qoperatingsystemversion.h1
-rw-r--r--src/corelib/global/qttranslation.qdoc2
-rw-r--r--src/corelib/io/qrandomaccessasyncfile_darwin.mm24
-rw-r--r--src/corelib/itemmodels/qrangemodel_impl.h18
-rw-r--r--src/corelib/itemmodels/qrangemodeladapter.h232
-rw-r--r--src/corelib/itemmodels/qrangemodeladapter.qdoc61
-rw-r--r--src/corelib/kernel/qassociativeiterable.h2
-rw-r--r--src/corelib/kernel/qcore_mac.mm32
-rw-r--r--src/corelib/kernel/qcore_mac_p.h17
-rw-r--r--src/corelib/kernel/qiterable.h6
-rw-r--r--src/corelib/kernel/qmetaassociation.h6
-rw-r--r--src/corelib/kernel/qmetasequence.h61
-rw-r--r--src/corelib/kernel/qsequentialiterable.h3
-rw-r--r--src/corelib/kernel/qvariant.h10
-rw-r--r--src/corelib/platform/windows/qbstr_p.h3
-rw-r--r--src/corelib/platform/windows/qcomobject_p.h1
-rw-r--r--src/corelib/platform/windows/qcomptr_p.h1
-rw-r--r--src/corelib/platform/windows/qcomvariant_p.h1
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration.cpp1
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration_p.h1
-rw-r--r--src/corelib/platform/windows/qt_winrtbase_p.h1
-rw-r--r--src/corelib/thread/qfuture_impl.h9
-rw-r--r--src/corelib/thread/qfutureinterface.h4
-rw-r--r--src/corelib/thread/qreadwritelock.cpp8
-rw-r--r--src/corelib/tools/qarraydata.cpp2
-rw-r--r--src/corelib/tools/qeasingcurve.cpp4
30 files changed, 337 insertions, 198 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index b69d0285de2..c1f9aee0180 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -3677,21 +3677,6 @@ macro(qt6_standard_project_setup)
if(NOT DEFINED QT_I18N_SOURCE_LANGUAGE)
set(QT_I18N_SOURCE_LANGUAGE ${__qt_sps_arg_I18N_SOURCE_LANGUAGE})
endif()
-
- if(CMAKE_GENERATOR STREQUAL "Xcode")
- # Ensure we always use device SDK for Xcode for single-arch Qt builds
- set(qt_osx_arch_count 0)
- if(QT_OSX_ARCHITECTURES)
- list(LENGTH QT_OSX_ARCHITECTURES qt_osx_arch_count)
- endif()
- if(NOT qt_osx_arch_count GREATER 1 AND "${CMAKE_OSX_SYSROOT}" MATCHES "^[a-z]+simulator$")
- # Xcode expects the base SDK to be the device SDK
- set(simulator_sysroot "${CMAKE_OSX_SYSROOT}")
- string(REGEX REPLACE "simulator" "os" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
- set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}" CACHE STRING "" FORCE)
- set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "${simulator_sysroot}")
- endif()
- endif()
endif()
endmacro()
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 7216f2920fe..4386b907c13 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -1285,7 +1285,7 @@ qt_feature("openssl-hash" PRIVATE
qt_feature("async-io" PRIVATE
LABEL "Async File I/O"
PURPOSE "Provides support for asynchronous file I/O."
- CONDITION (QT_FEATURE_thread AND QT_FEATURE_future) OR APPLE
+ CONDITION (QT_FEATURE_thread AND QT_FEATURE_future) OR APPLE OR (LINUX AND QT_FEATURE_liburing) OR (WIN32 AND QT_FEATURE_windows_ioring)
)
qt_configure_add_summary_section(NAME "Qt Core")
diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
index 0a0dc0b3c50..42cb3ecb42b 100644
--- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
+++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
@@ -133,7 +133,6 @@ use, for example, library files referenced from a Qt installation.
\summary {Forces or disables release package signing regardless of the build type.}
\cmakevariablesince 6.7
-\preliminarycmakevariable
\cmakevariableandroidonly
When set to \c Release, the \c --release flag is passed to the \c
diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp
index d27a71526d8..32364fa8eb4 100644
--- a/src/corelib/global/qoperatingsystemversion.cpp
+++ b/src/corelib/global/qoperatingsystemversion.cpp
@@ -486,6 +486,12 @@ const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11_22H2;
*/
/*!
+ \variable QOperatingSystemVersion::Windows11_25H2
+ \brief a version corresponding to Windows 11 Version 25H2 (version 10.0.26200).
+ \since 6.11
+ */
+
+/*!
\variable QOperatingSystemVersion::OSXMavericks
\brief a version corresponding to OS X Mavericks (version 10.9).
\since 5.9
diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h
index 75801a7ddcf..99866692f8c 100644
--- a/src/corelib/global/qoperatingsystemversion.h
+++ b/src/corelib/global/qoperatingsystemversion.h
@@ -148,6 +148,7 @@ public:
static constexpr QOperatingSystemVersionBase Android14 { QOperatingSystemVersionBase::Android, 14, 0 };
static constexpr QOperatingSystemVersionBase Windows11_23H2 { QOperatingSystemVersionBase::Windows, 10, 0, 22631 };
static constexpr QOperatingSystemVersionBase Windows11_24H2 { QOperatingSystemVersionBase::Windows, 10, 0, 26100 };
+ static constexpr QOperatingSystemVersionBase Windows11_25H2 { QOperatingSystemVersionBase::Windows, 10, 0, 26200 };
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) && !defined(Q_QDOC)
};
diff --git a/src/corelib/global/qttranslation.qdoc b/src/corelib/global/qttranslation.qdoc
index 191b3777db6..c8b3764614e 100644
--- a/src/corelib/global/qttranslation.qdoc
+++ b/src/corelib/global/qttranslation.qdoc
@@ -179,7 +179,7 @@
\fn QString qTrId(const char *id, int n = -1)
\relates <QtTranslation>
\reentrant
- \since 6.9
+ \since 6.11
\brief The qTrId function is an alias for qtTrId.
diff --git a/src/corelib/io/qrandomaccessasyncfile_darwin.mm b/src/corelib/io/qrandomaccessasyncfile_darwin.mm
index 7231d12fe7d..fca225263ba 100644
--- a/src/corelib/io/qrandomaccessasyncfile_darwin.mm
+++ b/src/corelib/io/qrandomaccessasyncfile_darwin.mm
@@ -95,10 +95,8 @@ void QRandomAccessAsyncFilePrivate::close()
// cancel all operations
m_mutex.lock();
m_opToCancel = kAllOperationIds;
- m_numChannelsToClose = m_ioChannel ? 1 : 0;
for (const auto &op : m_operations) {
if (op.channel) {
- ++m_numChannelsToClose;
closeIoChannel(op.channel);
}
}
@@ -212,8 +210,8 @@ QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const
void QRandomAccessAsyncFilePrivate::notifyIfOperationsAreCompleted()
{
QMutexLocker locker(&m_mutex);
+ --m_numChannelsToClose;
if (m_opToCancel == kAllOperationIds) {
- --m_numChannelsToClose;
if (m_numChannelsToClose == 0 && m_runningOps.isEmpty())
m_cancellationCondition.wakeOne();
}
@@ -222,11 +220,19 @@ void QRandomAccessAsyncFilePrivate::notifyIfOperationsAreCompleted()
dispatch_io_t QRandomAccessAsyncFilePrivate::createMainChannel(int fd)
{
auto sharedThis = this;
- return dispatch_io_create(DISPATCH_IO_RANDOM, fd,
- dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0),
- ^(int /*error*/) {
- sharedThis->notifyIfOperationsAreCompleted();
- });
+ auto channel =
+ dispatch_io_create(DISPATCH_IO_RANDOM, fd,
+ dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0),
+ ^(int /*error*/) {
+ // main I/O channel uses kInvalidOperationId
+ // as its identifier
+ sharedThis->notifyIfOperationsAreCompleted();
+ });
+ if (channel) {
+ QMutexLocker locker(&m_mutex);
+ ++m_numChannelsToClose;
+ }
+ return channel;
}
dispatch_io_t QRandomAccessAsyncFilePrivate::duplicateIoChannel(OperationId opId)
@@ -247,6 +253,7 @@ dispatch_io_t QRandomAccessAsyncFilePrivate::duplicateIoChannel(OperationId opId
if (channel) {
QMutexLocker locker(&m_mutex);
m_runningOps.insert(opId);
+ ++m_numChannelsToClose;
}
return channel;
}
@@ -593,6 +600,7 @@ void QRandomAccessAsyncFilePrivate::executeOpen(OperationInfo &opInfo)
// So we need to notify the condition variable in
// both cases.
Q_ASSERT(sharedThis->m_runningOps.isEmpty());
+ Q_ASSERT(sharedThis->m_numChannelsToClose == 0);
sharedThis->m_cancellationCondition.wakeOne();
} else {
auto context = sharedThis->q_ptr;
diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h
index f6b08099fe7..7eca3094a66 100644
--- a/src/corelib/itemmodels/qrangemodel_impl.h
+++ b/src/corelib/itemmodels/qrangemodel_impl.h
@@ -239,17 +239,15 @@ namespace QRangeModelDetails
: std::true_type
{};
- // we use std::rotate in moveRows/Columns, which requires std::swap and the
- // iterators to be at least a forward iterator
- template <typename It, typename = void>
- struct test_rotate : std::false_type {};
-
+ // we use std::rotate in moveRows/Columns, which requires the values (which
+ // might be const if we only get a const iterator) to be swappable, and the
+ // iterator type to be at least a forward iterator
template <typename It>
- struct test_rotate<It, std::void_t<decltype(std::swap(*std::declval<It>(),
- *std::declval<It>()))>>
- : std::is_base_of<std::forward_iterator_tag,
- typename std::iterator_traits<It>::iterator_category>
- {};
+ using test_rotate = std::conjunction<
+ std::is_swappable<decltype(*std::declval<It>())>,
+ std::is_base_of<std::forward_iterator_tag,
+ typename std::iterator_traits<It>::iterator_category>
+ >;
template <typename C, typename = void>
struct test_splice : std::false_type {};
diff --git a/src/corelib/itemmodels/qrangemodeladapter.h b/src/corelib/itemmodels/qrangemodeladapter.h
index bd3342e6185..0234c402248 100644
--- a/src/corelib/itemmodels/qrangemodeladapter.h
+++ b/src/corelib/itemmodels/qrangemodeladapter.h
@@ -19,13 +19,11 @@ class QT_TECH_PREVIEW_API QRangeModelAdapter
#ifdef Q_QDOC
using range_type = Range;
- using const_row_reference = typename std::iterator_traits<Range>::const_reference;
- using row_reference = typename std::iterator_traits<Range>::reference;
#else
using range_type = QRangeModelDetails::wrapped_t<Range>;
+#endif
using const_row_reference = typename Impl::const_row_reference;
using row_reference = typename Impl::row_reference;
-#endif
using range_features = typename QRangeModelDetails::range_traits<range_type>;
using row_type = std::remove_reference_t<row_reference>;
using row_features = QRangeModelDetails::range_traits<typename Impl::wrapped_row_type>;
@@ -78,16 +76,22 @@ class QT_TECH_PREVIEW_API QRangeModelAdapter
template <typename C>
using if_compatible_row_range = std::enable_if_t<is_compatible_row_range<C>, bool>;
template <typename Data>
- static constexpr bool is_compatible_data = true;
- // std::is_convertible_v<Data, decltype(*std::begin(std::declval<const_row_reference>()))>;
+ static constexpr bool is_compatible_data = std::is_convertible_v<Data, data_type>;
template <typename Data>
using if_compatible_data = std::enable_if_t<is_compatible_data<Data>, bool>;
template <typename C>
static constexpr bool is_compatible_data_range = is_compatible_data<
+ typename QRangeModelDetails::data_type<
+ typename QRangeModelDetails::row_traits<
decltype(*std::begin(std::declval<C&>()))
- >;
+ >::item_type
+ >::type
+ >;
template <typename C>
- using if_compatible_data_range = std::enable_if_t<is_compatible_data_range<C>, bool>;
+ using if_compatible_column_data = std::enable_if_t<is_compatible_data<C>
+ || is_compatible_data_range<C>, bool>;
+ template <typename C>
+ using if_compatible_column_range = std::enable_if_t<is_compatible_data_range<C>, bool>;
template <typename R>
using if_assignable_range = std::enable_if_t<std::is_assignable_v<range_type, R>, bool>;
@@ -141,6 +145,7 @@ public:
}
DataReference(const DataReference &other) = default;
+ DataReference(DataReference &&other) = default;
// reference (not std::reference_wrapper) semantics
DataReference &operator=(const DataReference &other)
@@ -149,29 +154,23 @@ public:
return *this;
}
+ DataReference &operator=(DataReference &&other)
+ {
+ *this = other.get();
+ return *this;
+ }
+
~DataReference() = default;
DataReference &operator=(const value_type &value)
{
- constexpr Qt::ItemDataRole dataRole = Qt::RangeModelAdapterRole;
+ assign(value);
+ return *this;
+ }
- if (m_index.isValid()) {
- auto model = const_cast<QAbstractItemModel *>(m_index.model());
- [[maybe_unused]] bool couldWrite = false;
- if constexpr (std::is_same_v<q20::remove_cvref_t<value_type>, QVariant>)
- couldWrite = model->setData(m_index, value, dataRole);
- else
- couldWrite = model->setData(m_index, QVariant::fromValue(value), dataRole);
-#ifndef QT_NO_DEBUG
- if (!couldWrite) {
- qWarning() << "Writing value of type" << QMetaType::fromType<value_type>().name()
- << "to role" << dataRole << "at index" << m_index
- << "of the model failed";
- }
- } else {
- qCritical("Data reference for invalid index, can't write to model");
-#endif
- }
+ DataReference &operator=(value_type &&value)
+ {
+ assign(std::move(value));
return *this;
}
@@ -196,6 +195,33 @@ public:
private:
QModelIndex m_index;
+ template <typename Value>
+ void assign(Value &&value)
+ {
+ constexpr Qt::ItemDataRole dataRole = Qt::RangeModelAdapterRole;
+
+ if (m_index.isValid()) {
+ auto model = const_cast<QAbstractItemModel *>(m_index.model());
+ [[maybe_unused]] bool couldWrite = false;
+ if constexpr (std::is_same_v<q20::remove_cvref_t<Value>, QVariant>) {
+ couldWrite = model->setData(m_index, value, dataRole);
+ } else {
+ couldWrite = model->setData(m_index,
+ QVariant::fromValue(std::forward<Value>(value)),
+ dataRole);
+ }
+#ifndef QT_NO_DEBUG
+ if (!couldWrite) {
+ qWarning() << "Writing value of type"
+ << QMetaType::fromType<q20::remove_cvref_t<Value>>().name()
+ << "to role" << dataRole << "at index" << m_index << "failed";
+ }
+ } else {
+ qCritical("Data reference for invalid index, can't write to model");
+#endif
+ }
+ }
+
friend inline bool comparesEqual(const DataReference &lhs, const DataReference &rhs)
{
return lhs.m_index == rhs.m_index
@@ -1020,60 +1046,55 @@ public:
template <typename NewRange = range_type, if_assignable_range<NewRange> = true>
void setRange(NewRange &&newRange)
{
- using namespace QRangeModelDetails;
-
- auto *impl = storage.implementation();
- const QModelIndex root = storage.root();
- const qsizetype newLastRow = qsizetype(Impl::size(refTo(newRange))) - 1;
- auto *oldRange = impl->childRange(root);
- const qsizetype oldLastRow = qsizetype(Impl::size(oldRange)) - 1;
-
- if (!root.isValid()) {
- impl->beginResetModel();
- impl->deleteOwnedRows();
- } else if constexpr (is_tree<Impl>) {
- if (oldLastRow > 0) {
- impl->beginRemoveRows(root, 0, model()->rowCount(root) - 1);
- impl->deleteRemovedRows(refTo(oldRange));
- impl->endRemoveRows();
- }
- if (newLastRow > 0)
- impl->beginInsertRows(root, 0, newLastRow);
- } else {
- Q_ASSERT_X(false, "QRangeModelAdapter::setRange",
- "Internal error: The root index in a table or list must be invalid.");
- }
- refTo(oldRange) = std::forward<NewRange>(newRange);
- if (!root.isValid()) {
- impl->endResetModel();
- } else if constexpr (is_tree<Impl>) {
- if (newLastRow > 0) {
- Q_ASSERT(model()->hasChildren(root));
- // if it was moved, then newRange is now likely to be empty. Get
- // the inserted row.
- impl->setParentRow(refTo(impl->childRange(storage.root())),
- pointerTo(impl->rowData(root)));
- impl->endInsertRows();
- }
- }
- if constexpr (Impl::itemsAreQObjects) {
- if (model()->autoConnectPolicy() == QRangeModel::AutoConnectPolicy::Full) {
- const auto begin = QRangeModelDetails::begin(refTo(oldRange));
- const auto end = QRangeModelDetails::end(refTo(oldRange));
- int rowIndex = 0;
- for (auto it = begin; it != end; ++it, ++rowIndex)
- impl->autoConnectPropertiesInRow(*it, rowIndex, root);
- }
- }
+ setRangeImpl(qsizetype(Impl::size(QRangeModelDetails::refTo(newRange))) - 1,
+ [&newRange](auto &oldRange) {
+ oldRange = std::forward<NewRange>(newRange);
+ });
}
- template <typename NewRange = range_type, if_assignable_range<NewRange> = true>
+ template <typename NewRange = range_type, if_assignable_range<NewRange> = true,
+ unless_adapter<NewRange> = true>
QRangeModelAdapter &operator=(NewRange &&newRange)
{
setRange(std::forward<NewRange>(newRange));
return *this;
}
+ template <typename Row, if_assignable_range<std::initializer_list<Row>> = true>
+ void setRange(std::initializer_list<Row> newRange)
+ {
+ setRangeImpl(qsizetype(newRange.size() - 1), [&newRange](auto &oldRange) {
+ oldRange = newRange;
+ });
+ }
+
+ template <typename Row, if_assignable_range<std::initializer_list<Row>> = true>
+ QRangeModelAdapter &operator=(std::initializer_list<Row> newRange)
+ {
+ setRange(newRange);
+ return *this;
+ }
+
+ template <typename Row, if_assignable_range<std::initializer_list<Row>> = true>
+ void assign(std::initializer_list<Row> newRange)
+ {
+ setRange(newRange);
+ }
+
+ template <typename InputIterator, typename Sentinel, typename I = Impl, if_writable<I> = true>
+ void setRange(InputIterator first, Sentinel last)
+ {
+ setRangeImpl(qsizetype(std::distance(first, last) - 1), [first, last](auto &oldRange) {
+ oldRange.assign(first, last);
+ });
+ }
+
+ template <typename InputIterator, typename Sentinel, typename I = Impl, if_writable<I> = true>
+ void assign(InputIterator first, Sentinel last)
+ {
+ setRange(first, last);
+ }
+
// iterator API
ConstRowIterator cbegin() const
{
@@ -1245,12 +1266,12 @@ public:
decltype(auto) operator[](int row) const { return at(row); }
template <typename I = Impl, if_table<I> = true, if_writable<I> = true>
- decltype(auto) at(int row)
+ auto at(int row)
{
return RowReference{index(row, 0), this};
}
template <typename I = Impl, if_table<I> = true, if_writable<I> = true>
- decltype(auto) operator[](int row) { return at(row); }
+ auto operator[](int row) { return at(row); }
// at/operator[int, int] for table: returns value at row/column
template <typename I = Impl, unless_list<I> = true>
@@ -1428,15 +1449,15 @@ public:
return storage.m_model->insertColumn(before);
}
- template <typename D = row_type, typename I = Impl,
- if_canInsertColumns<I> = true, if_compatible_data<D> = true>
+ template <typename D, typename I = Impl,
+ if_canInsertColumns<I> = true, if_compatible_column_data<D> = true>
bool insertColumn(int before, D &&data)
{
return insertColumnImpl(before, storage.root(), std::forward<D>(data));
}
template <typename C, typename I = Impl,
- if_canInsertColumns<I> = true, if_compatible_data_range<C> = true>
+ if_canInsertColumns<I> = true, if_compatible_column_range<C> = true>
bool insertColumns(int before, C &&data)
{
return insertColumnsImpl(before, storage.root(), std::forward<C>(data));
@@ -1503,6 +1524,65 @@ private:
Q_EMIT storage.implementation()->dataChanged(topLeft, bottomRight, {});
}
+ void beginSetRangeImpl(Impl *impl, range_type *oldRange, qsizetype newLastRow)
+ {
+ const QModelIndex root = storage.root();
+ const qsizetype oldLastRow = qsizetype(Impl::size(oldRange)) - 1;
+
+ if (!root.isValid()) {
+ impl->beginResetModel();
+ impl->deleteOwnedRows();
+ } else if constexpr (is_tree<Impl>) {
+ if (oldLastRow > 0) {
+ impl->beginRemoveRows(root, 0, model()->rowCount(root) - 1);
+ impl->deleteRemovedRows(QRangeModelDetails::refTo(oldRange));
+ impl->endRemoveRows();
+ }
+ if (newLastRow > 0)
+ impl->beginInsertRows(root, 0, newLastRow);
+ } else {
+ Q_ASSERT_X(false, "QRangeModelAdapter::setRange",
+ "Internal error: The root index in a table or list must be invalid.");
+ }
+ }
+
+ void endSetRangeImpl(Impl *impl, qsizetype newLastRow)
+ {
+ const QModelIndex root = storage.root();
+ if (!root.isValid()) {
+ impl->endResetModel();
+ } else if constexpr (is_tree<Impl>) {
+ if (newLastRow > 0) {
+ Q_ASSERT(model()->hasChildren(root));
+ // if it was moved, then newRange is now likely to be empty. Get
+ // the inserted row.
+ impl->setParentRow(QRangeModelDetails::refTo(impl->childRange(root)),
+ QRangeModelDetails::pointerTo(impl->rowData(root)));
+ impl->endInsertRows();
+ }
+ }
+ }
+
+ template <typename Assigner>
+ void setRangeImpl(qsizetype newLastRow, Assigner &&assigner)
+ {
+ auto *impl = storage.implementation();
+ auto *oldRange = impl->childRange(storage.root());
+ beginSetRangeImpl(impl, oldRange, newLastRow);
+ assigner(QRangeModelDetails::refTo(oldRange));
+ endSetRangeImpl(impl, newLastRow);
+
+ if constexpr (Impl::itemsAreQObjects) {
+ if (model()->autoConnectPolicy() == QRangeModel::AutoConnectPolicy::Full) {
+ const auto begin = QRangeModelDetails::begin(QRangeModelDetails::refTo(oldRange));
+ const auto end = QRangeModelDetails::end(QRangeModelDetails::refTo(oldRange));
+ int rowIndex = 0;
+ for (auto it = begin; it != end; ++it, ++rowIndex)
+ impl->autoConnectPropertiesInRow(*it, rowIndex, storage.root());
+ }
+ }
+ }
+
template <typename P>
static auto setParentRow(P protocol, row_type &newRow, row_ptr parentRow)
-> decltype(protocol.setParentRow(std::declval<row_type&>(), std::declval<row_ptr>()))
diff --git a/src/corelib/itemmodels/qrangemodeladapter.qdoc b/src/corelib/itemmodels/qrangemodeladapter.qdoc
index 263bff0dd0c..88872589299 100644
--- a/src/corelib/itemmodels/qrangemodeladapter.qdoc
+++ b/src/corelib/itemmodels/qrangemodeladapter.qdoc
@@ -277,14 +277,6 @@
*/
/*!
- \typedef QRangeModelAdapter::const_row_reference
-*/
-
-/*!
- \typedef QRangeModelAdapter::row_reference
-*/
-
-/*!
\typedef QRangeModelAdapter::range_type
*/
@@ -329,16 +321,39 @@
/*!
\fn template <typename Range, typename Protocol, typename Model> template <typename NewRange, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<NewRange>> void QRangeModelAdapter<Range, Protocol, Model>::setRange(NewRange &&newRange)
- \fn template <typename Range, typename Protocol, typename Model> template <typename NewRange, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<NewRange>> QRangeModelAdapter &QRangeModelAdapter<Range, Protocol, Model>::operator=(NewRange &&newRange)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename NewRange, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<NewRange>, QRangeModelAdapter<Range, Protocol, Model>::unless_adapter<NewRange>> QRangeModelAdapter &QRangeModelAdapter<Range, Protocol, Model>::operator=(NewRange &&newRange)
+
+ Replaces the contents of the model with the rows in \a newRange, possibly
+ using move semantics.
- Assigns \a newRange to the stored range, possibly using move semantics.
This function makes the model() emit the \l{QAbstractItemModel::}{modelAboutToBeReset()}
and \l{QAbstractItemModel::}{modelReset()} signals.
\constraints \c Range is mutable, and \a newRange is of a type that can be
- assigned to \c Range.
+ assigned to \c Range, but not a QRangeModelAdapter.
+
+ \sa range(), at(), model(), assign()
+*/
+
+/*!
+ \fn template <typename Range, typename Protocol, typename Model> template <typename Row, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<std::initializer_list<Row>>> void QRangeModelAdapter<Range, Protocol, Model>::setRange(std::initializer_list<Row> newRange)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename Row, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<std::initializer_list<Row>>> QRangeModelAdapter &QRangeModelAdapter<Range, Protocol, Model>::assign(std::initializer_list<Row> newRange)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename Row, QRangeModelAdapter<Range, Protocol, Model>::if_assignable_range<std::initializer_list<Row>>> QRangeModelAdapter &QRangeModelAdapter<Range, Protocol, Model>::operator=(std::initializer_list<Row> newRange)
+
+ Replaces the contents of the model with the rows in \a newRange.
- \sa range(), at(), model()
+ \constraints \c Range is mutable, and \a newRange can be assigned to \c Range.
+
+ \sa range(), at, model()
+*/
+
+/*!
+ \fn template <typename Range, typename Protocol, typename Model> template <typename InputIterator, typename Sentinel, typename I = Impl, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> void QRangeModelAdapter<Range, Protocol, Model>::setRange(InputIterator first, Sentinel last)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename InputIterator, typename Sentinel, typename I = Impl, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> void QRangeModelAdapter<Range, Protocol, Model>::assign(InputIterator first, Sentinel last)
+
+ Replaces the contents of the models with the rows in the range [\a first, \a last).
+
+ \sa range(), at, model()
*/
/*!
@@ -508,8 +523,8 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> QRangeModelAdapter<Range, Protocol, Model>::const_row_reference QRangeModelAdapter<Range, Protocol, Model>::at(int row) const
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> QRangeModelAdapter<Range, Protocol, Model>::const_row_reference QRangeModelAdapter<Range, Protocol, Model>::operator[](int row) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::at(int row) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::operator[](int row) const
\return a constant reference to the row at \a row, as stored in \c Range.
@@ -517,8 +532,8 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> QRangeModelAdapter<Range, Protocol, Model>::row_reference QRangeModelAdapter<Range, Protocol, Model>::at(int row)
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> QRangeModelAdapter<Range, Protocol, Model>::row_reference QRangeModelAdapter<Range, Protocol, Model>::operator[](int row)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::at(int row)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::operator[](int row)
\return a mutable reference to the row at \a row, as stored in \c Range.
@@ -574,6 +589,16 @@
*/
/*!
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::at(QSpan<const int> path) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::operator[](QSpan<const int> path) const
+
+ \return a constant reference to the row specified by \a path, as stored in
+ \c Range.
+
+ \constraints \c Range is a tree.
+*/
+
+/*!
\fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::at(QSpan<const int> path)
\fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::operator[](QSpan<const int> path)
@@ -810,7 +835,7 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename D, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_data<D>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumn(int before, D &&data)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename D, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_column_data<D>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumn(int before, D &&data)
\overload
Inserts a single column constructed from \a data before the column specified
@@ -838,7 +863,7 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename C, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_data_range<C>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumns(int before, C &&data)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename C, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_column_range<C>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumns(int before, C &&data)
Inserts columns constructed from the elements in \a data before the column
specified by \a before into all rows, and returns whether the insertion was
diff --git a/src/corelib/kernel/qassociativeiterable.h b/src/corelib/kernel/qassociativeiterable.h
index 39f66d45fa0..4f9bbf67bfb 100644
--- a/src/corelib/kernel/qassociativeiterable.h
+++ b/src/corelib/kernel/qassociativeiterable.h
@@ -156,10 +156,12 @@ inline QVariantRef<QAssociativeIterator>::operator QVariant() const
if (!metaType.isValid())
return m_pointer->key();
+ return [&] {
QVariant v(metaType);
metaAssociation.mappedAtIterator(m_pointer->constIterator(),
metaType == QMetaType::fromType<QVariant>() ? &v : v.data());
return v;
+ }();
}
template<>
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
index 687fc7e85fa..f5f1f4a8cb8 100644
--- a/src/corelib/kernel/qcore_mac.mm
+++ b/src/corelib/kernel/qcore_mac.mm
@@ -22,6 +22,10 @@
#include <spawn.h>
#include <qdebug.h>
+#include <qpoint.h>
+#include <qsize.h>
+#include <qrect.h>
+#include <qmargins.h>
#include "qendian.h"
#include "qhash.h"
@@ -222,6 +226,34 @@ QDebug operator<<(QDebug dbg, CFStringRef stringRef)
return dbg;
}
+QDebug operator<<(QDebug dbg, CGPoint point)
+{
+ dbg << QPointF::fromCGPoint(point);
+ return dbg;
+}
+
+QDebug operator<<(QDebug dbg, CGSize size)
+{
+ dbg << QSizeF::fromCGSize(size);
+ return dbg;
+}
+
+QDebug operator<<(QDebug dbg, CGRect rect)
+{
+ dbg << QRectF::fromCGRect(rect);
+ return dbg;
+}
+
+#if defined(Q_OS_MACOS)
+QDebug operator<<(QDebug dbg, NSEdgeInsets insets)
+#else
+QDebug operator<<(QDebug dbg, UIEdgeInsets insets)
+#endif
+{
+ dbg << QMargins(insets.left, insets.top, insets.right, insets.bottom);
+ return dbg;
+}
+
// Prevents breaking the ODR in case we introduce support for more types
// later on, and lets the user override our default QDebug operators.
#define QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType) \
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 2c4b4c02c55..1e57ee01e1d 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -78,6 +78,15 @@ kern_return_t IOObjectRelease(io_object_t object);
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
+struct CGPoint;
+struct CGSize;
+struct CGRect;
+#if defined(Q_OS_MACOS)
+struct NSEdgeInsets;
+#else
+struct UIEdgeInsets;
+#endif
+
// @compatibility_alias doesn't work with categories or their methods
#define QtExtras QT_MANGLE_NAMESPACE(QtExtras)
@@ -225,6 +234,14 @@ Q_AUTOTEST_EXPORT void qt_mac_ensureResponsible();
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool);
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QCFString &string);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGPoint);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGSize);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGRect);
+#if defined(Q_OS_MACOS)
+Q_CORE_EXPORT QDebug operator<<(QDebug, NSEdgeInsets);
+#else
+Q_CORE_EXPORT QDebug operator<<(QDebug, UIEdgeInsets);
+#endif
#endif
Q_CORE_EXPORT bool qt_apple_isApplicationExtension();
diff --git a/src/corelib/kernel/qiterable.h b/src/corelib/kernel/qiterable.h
index baab2897967..494cec73a3f 100644
--- a/src/corelib/kernel/qiterable.h
+++ b/src/corelib/kernel/qiterable.h
@@ -502,7 +502,10 @@ public:
if (m_metaContainer.hasSize())
return m_metaContainer.size(container);
- // ### Qt7: Return -1 here. We shouldn't second-guess the underlying container
+#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
+ // We shouldn't second-guess the underlying container, so we're not synthesizing a size.
+ return -1;
+#else
QtPrivate::warnSynthesizedAccess(
"size() called on an iterable without native size accessor. This is slow");
@@ -515,6 +518,7 @@ public:
m_metaContainer.destroyConstIterator(begin);
m_metaContainer.destroyConstIterator(end);
return size;
+#endif
}
void clear()
diff --git a/src/corelib/kernel/qmetaassociation.h b/src/corelib/kernel/qmetaassociation.h
index 6d8de13e90a..d481ae91079 100644
--- a/src/corelib/kernel/qmetaassociation.h
+++ b/src/corelib/kernel/qmetaassociation.h
@@ -25,8 +25,8 @@ public:
using reference = QVariant::Reference<AssociativeIterator>;
using pointer = QVariant::Pointer<AssociativeIterator>;
- static constexpr bool canNoexceptAssignQVariant = false;
- static constexpr bool canNoexceptConvertToQVariant = false;
+ static constexpr bool CanNoexceptAssignQVariant = false;
+ static constexpr bool CanNoexceptConvertToQVariant = false;
AssociativeIterator(QIterator &&it) : QIterator(std::move(it)) {}
@@ -51,7 +51,7 @@ public:
using reference = QVariant::ConstReference<AssociativeConstIterator>;
using pointer = QVariant::ConstPointer<AssociativeConstIterator>;
- static constexpr bool canNoexceptConvertToQVariant = false;
+ static constexpr bool CanNoexceptConvertToQVariant = false;
AssociativeConstIterator(QConstIterator &&it) : QConstIterator(std::move(it)) {}
diff --git a/src/corelib/kernel/qmetasequence.h b/src/corelib/kernel/qmetasequence.h
index e9505054159..26156e7924f 100644
--- a/src/corelib/kernel/qmetasequence.h
+++ b/src/corelib/kernel/qmetasequence.h
@@ -24,8 +24,8 @@ public:
using reference = QVariant::Reference<SequentialIterator>;
using pointer = QVariant::Pointer<SequentialIterator>;
- static constexpr bool canNoexceptAssignQVariant = false;
- static constexpr bool canNoexceptConvertToQVariant = false;
+ static constexpr bool CanNoexceptAssignQVariant = false;
+ static constexpr bool CanNoexceptConvertToQVariant = false;
SequentialIterator(QIterator &&it) : QIterator(std::move(it)) {}
@@ -41,7 +41,7 @@ public:
using reference = QVariant::ConstReference<SequentialConstIterator>;
using pointer = QVariant::ConstPointer<SequentialConstIterator>;
- static constexpr bool canNoexceptConvertToQVariant = false;
+ static constexpr bool CanNoexceptConvertToQVariant = false;
SequentialConstIterator(QConstIterator &&it) : QConstIterator(std::move(it)) {}
@@ -184,13 +184,15 @@ public:
return;
}
- // ### Qt7: Drop this code. We shouldn't second-guess the underlying container
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ // We shouldn't second-guess the underlying container.
QtPrivate::warnSynthesizedAccess(
"at() called on an iterable without native indexed accessors. This is slow");
void *it = meta.constBegin(m_iterable.constPointer());
meta.advanceConstIterator(it, idx);
meta.valueAtConstIterator(it, dataPtr);
meta.destroyConstIterator(it);
+#endif
});
}
@@ -204,13 +206,15 @@ public:
return;
}
- // ### Qt7: Drop this code. We shouldn't second-guess the underlying container
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ // We shouldn't second-guess the underlying container
QtPrivate::warnSynthesizedAccess(
"set() called on an iterable without native indexed accessors. This is slow");
void *it = meta.begin(m_iterable.mutablePointer());
meta.advanceIterator(it, idx);
meta.setValueAtIterator(it, dataPtr);
meta.destroyIterator(it);
+#endif
}
void append(const QVariant &value)
@@ -248,55 +252,14 @@ public:
Unspecified, AtBegin, AtEnd
};
- QT_DEPRECATED_VERSION_X_6_11("Use append() or prepend() instead.")
void addValue(const QVariant &value, Position position = Unspecified)
- {
- const QMetaSequence meta = metaContainer();
- QtPrivate::QVariantTypeCoercer coercer;
- const void *valuePtr = coercer.coerce(value, meta.valueMetaType());
-
- switch (position) {
- case AtBegin:
- if (meta.canAddValueAtBegin())
- meta.addValueAtBegin(mutableIterable(), valuePtr);
- break;
- case AtEnd:
- if (meta.canAddValueAtEnd())
- meta.addValueAtEnd(mutableIterable(), valuePtr);
- break;
- case Unspecified:
- if (meta.canAddValue())
- meta.addValue(mutableIterable(), valuePtr);
- break;
- }
- }
+ Q_DECL_EQ_DELETE_X("Use append() or prepend() instead.");
- QT_DEPRECATED_VERSION_X_6_11("Use removeLast() or removeFirst() instead.")
void removeValue(Position position = Unspecified)
- {
- const QMetaSequence meta = metaContainer();
+ Q_DECL_EQ_DELETE_X("Use removeLast() or removeFirst() instead.");
- switch (position) {
- case AtBegin:
- if (meta.canRemoveValueAtBegin())
- meta.removeValueAtBegin(mutableIterable());
- break;
- case AtEnd:
- if (meta.canRemoveValueAtEnd())
- meta.removeValueAtEnd(mutableIterable());
- break;
- case Unspecified:
- if (meta.canRemoveValue())
- meta.removeValue(mutableIterable());
- break;
- }
- }
-
- QT_DEPRECATED_VERSION_X_6_11("Use QMetaSequence::valueMetaType() instead.")
QMetaType valueMetaType() const
- {
- return metaContainer().valueMetaType();
- }
+ Q_DECL_EQ_DELETE_X("Use QMetaSequence::valueMetaType() instead.");
QT_WARNING_POP
#endif // QT_DEPRECATED_SINCE(6, 11)
diff --git a/src/corelib/kernel/qsequentialiterable.h b/src/corelib/kernel/qsequentialiterable.h
index 92252cb19dd..76908bdae4b 100644
--- a/src/corelib/kernel/qsequentialiterable.h
+++ b/src/corelib/kernel/qsequentialiterable.h
@@ -142,10 +142,13 @@ inline QVariantRef<QSequentialIterator>::operator QVariant() const
if (m_pointer == nullptr)
return QVariant();
const QMetaType metaType(m_pointer->metaContainer().valueMetaType());
+
+ return [&] {
QVariant v(metaType);
void *dataPtr = metaType == QMetaType::fromType<QVariant>() ? &v : v.data();
m_pointer->metaContainer().valueAtIterator(m_pointer->constIterator(), dataPtr);
return v;
+ }();
}
template<>
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 82eec0693d6..19cd1fea7fb 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -263,7 +263,7 @@ public:
ConstReference &operator=(ConstReference &&value) = delete;
// To be specialized for each Referred
- operator QVariant() const noexcept(Referred::canNoexceptConvertToQVariant);
+ operator QVariant() const noexcept(Referred::CanNoexceptConvertToQVariant);
};
template<typename Referred>
@@ -288,18 +288,18 @@ public:
~Reference() = default;
Reference &operator=(const Reference &value)
- noexcept(Referred::canNoexceptAssignQVariant)
+ noexcept(Referred::CanNoexceptAssignQVariant)
{
return operator=(QVariant(value));
}
Reference &operator=(Reference &&value)
- noexcept(Referred::canNoexceptAssignQVariant)
+ noexcept(Referred::CanNoexceptAssignQVariant)
{
return operator=(QVariant(value));
}
- operator QVariant() const noexcept(Referred::canNoexceptConvertToQVariant)
+ operator QVariant() const noexcept(Referred::CanNoexceptConvertToQVariant)
{
return ConstReference(m_referred);
}
@@ -313,7 +313,7 @@ public:
}
// To be specialized for each Referred
- Reference &operator=(const QVariant &value) noexcept(Referred::canNoexceptAssignQVariant);
+ Reference &operator=(const QVariant &value) noexcept(Referred::CanNoexceptAssignQVariant);
};
template<typename Pointed>
diff --git a/src/corelib/platform/windows/qbstr_p.h b/src/corelib/platform/windows/qbstr_p.h
index 21eecfe2df7..32b1aace76f 100644
--- a/src/corelib/platform/windows/qbstr_p.h
+++ b/src/corelib/platform/windows/qbstr_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QBSTR_P_H
#define QBSTR_P_H
@@ -141,4 +142,4 @@ QT_END_NAMESPACE
#endif // Q_OS_WIN
-#endif // QCOMPTR_P_H
+#endif // QBSTR_P_H
diff --git a/src/corelib/platform/windows/qcomobject_p.h b/src/corelib/platform/windows/qcomobject_p.h
index bd6f81d1c28..b7a9c56555d 100644
--- a/src/corelib/platform/windows/qcomobject_p.h
+++ b/src/corelib/platform/windows/qcomobject_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMOBJECT_P_H
#define QCOMOBJECT_P_H
diff --git a/src/corelib/platform/windows/qcomptr_p.h b/src/corelib/platform/windows/qcomptr_p.h
index 2a69e7b6038..e640528d3c2 100644
--- a/src/corelib/platform/windows/qcomptr_p.h
+++ b/src/corelib/platform/windows/qcomptr_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMPTR_P_H
#define QCOMPTR_P_H
diff --git a/src/corelib/platform/windows/qcomvariant_p.h b/src/corelib/platform/windows/qcomvariant_p.h
index 34ce5f179ce..cc4ad104106 100644
--- a/src/corelib/platform/windows/qcomvariant_p.h
+++ b/src/corelib/platform/windows/qcomvariant_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMVARIANT_P_H
#define QCOMVARIANT_P_H
diff --git a/src/corelib/platform/windows/qfactorycacheregistration.cpp b/src/corelib/platform/windows/qfactorycacheregistration.cpp
index 6bd69c66d14..04c81b7b665 100644
--- a/src/corelib/platform/windows/qfactorycacheregistration.cpp
+++ b/src/corelib/platform/windows/qfactorycacheregistration.cpp
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#include "qfactorycacheregistration_p.h"
diff --git a/src/corelib/platform/windows/qfactorycacheregistration_p.h b/src/corelib/platform/windows/qfactorycacheregistration_p.h
index d0b19b995b4..f6e7d9eb064 100644
--- a/src/corelib/platform/windows/qfactorycacheregistration_p.h
+++ b/src/corelib/platform/windows/qfactorycacheregistration_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QFACTORYCACHEREGISTRATION_P_H
#define QFACTORYCACHEREGISTRATION_P_H
diff --git a/src/corelib/platform/windows/qt_winrtbase_p.h b/src/corelib/platform/windows/qt_winrtbase_p.h
index 79c2bdf6b1c..69a602a59e0 100644
--- a/src/corelib/platform/windows/qt_winrtbase_p.h
+++ b/src/corelib/platform/windows/qt_winrtbase_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QT_WINRTBASE_P_H
#define QT_WINRTBASE_P_H
diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h
index 371ee524d72..d6c185cd704 100644
--- a/src/corelib/thread/qfuture_impl.h
+++ b/src/corelib/thread/qfuture_impl.h
@@ -845,7 +845,7 @@ struct UnwrapHandler
using NestedType = typename QtPrivate::Future<ResultType>::type;
QFutureInterface<NestedType> promise(QFutureInterfaceBase::State::Pending);
- outer->then([promise](const QFuture<ResultType> &outerFuture) mutable {
+ auto chain = outer->then([promise](const QFuture<ResultType> &outerFuture) mutable {
// We use the .then([](QFuture<ResultType> outerFuture) {...}) version
// (where outerFuture == *outer), to propagate the exception if the
// outer future has failed.
@@ -883,6 +883,13 @@ struct UnwrapHandler
promise.reportCanceled();
promise.reportFinished();
});
+
+ // Inject the promise into the chain.
+ // We use a fake function as a continuation, since the promise is
+ // managed by the outer future
+ chain.d.setContinuation(ContinuationWrapper(std::move([](const QFutureInterfaceBase &) {})),
+ promise.d, QFutureInterfaceBase::ContinuationType::Then);
+
return promise.future();
}
};
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 0b88013800e..ff17560d3a1 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -42,6 +42,8 @@ template<class Function, class ResultType>
class FailureHandler;
#endif
+struct UnwrapHandler;
+
#if QT_CORE_REMOVED_SINCE(6, 10)
void Q_CORE_EXPORT watchContinuationImpl(const QObject *context,
QtPrivate::QSlotObjectBase *slotObj,
@@ -187,6 +189,8 @@ private:
friend class QtPrivate::FailureHandler;
#endif
+ friend struct QtPrivate::UnwrapHandler;
+
#if QT_CORE_REMOVED_SINCE(6, 10)
friend Q_CORE_EXPORT void QtPrivate::watchContinuationImpl(
const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index 96e35dcb965..2a1af2315ca 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -234,14 +234,14 @@ QBasicReadWriteLock::contendedTryLockForRead(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForRead(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// d_ptr has changed: this QReadWriteLock was unlocked before we had
// time to lock d->mutex.
// We are holding a lock to a mutex within a QReadWriteLockPrivate
// that is already released (or even is already re-used). That's ok
// because the QFreeList never frees them.
// Just unlock d->mutex (at the end of the scope) and retry.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForRead(lock, timeout);
@@ -340,11 +340,11 @@ QBasicReadWriteLock::contendedTryLockForWrite(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForWrite(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// The mutex was unlocked before we had time to lock the mutex.
// We are holding to a mutex within a QReadWriteLockPrivate that is already released
// (or even is already re-used) but that's ok because the QFreeList never frees them.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForWrite(lock, timeout);
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp
index 1c0371e463e..d173d824e88 100644
--- a/src/corelib/tools/qarraydata.cpp
+++ b/src/corelib/tools/qarraydata.cpp
@@ -162,7 +162,7 @@ allocateHelper(QArrayData **dptr, qsizetype objectSize, qsizetype alignment, qsi
QArrayData::AllocationOption option) noexcept
{
*dptr = nullptr;
- if (capacity == 0)
+ if (capacity <= 0)
return {};
const qsizetype headerSize = calculateHeaderSize(alignment);
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index de68a0042ac..ce35e8ccffe 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -332,8 +332,6 @@ struct TCBPoint
qreal _c;
qreal _b;
- TCBPoint() {}
- TCBPoint(QPointF point, qreal t, qreal c, qreal b) : _point(point), _t(t), _c(c), _b(b) {}
bool operator==(const TCBPoint &other) const
{
@@ -1381,7 +1379,7 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
if (!d_ptr->config)
d_ptr->config = curveToFunctionObject(d_ptr->type);
- d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c, b));
+ d_ptr->config->_tcbPoints.append(TCBPoint{nextPoint, t, c, b});
if (nextPoint == QPointF(1.0, 1.0)) {
d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);