summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/src/qtcore.qdoc5
-rw-r--r--src/corelib/global/qfloat16.h9
-rw-r--r--src/corelib/kernel/qtimer.cpp27
-rw-r--r--src/corelib/kernel/qwinregistry.cpp4
-rw-r--r--src/corelib/serialization/.gitignore1
-rwxr-xr-xsrc/corelib/serialization/make-xml-parser.sh1
-rw-r--r--src/corelib/serialization/qjsonparseerror.h4
-rw-r--r--src/corelib/serialization/qjsonparser.cpp4
-rw-r--r--src/corelib/text/qbytearray.h2
-rw-r--r--src/corelib/text/qcollator.cpp1
-rw-r--r--src/corelib/text/qcollator.h1
-rw-r--r--src/corelib/text/qcollator_icu.cpp1
-rw-r--r--src/corelib/text/qcollator_macx.cpp1
-rw-r--r--src/corelib/text/qcollator_p.h1
-rw-r--r--src/corelib/text/qcollator_posix.cpp1
-rw-r--r--src/corelib/text/qcollator_win.cpp1
-rw-r--r--src/corelib/text/qlocale.qdoc1
-rw-r--r--src/corelib/text/qstring.h2
-rw-r--r--src/corelib/text/qtliterals.qdoc5
-rw-r--r--src/corelib/tools/qarraydataops.h145
-rw-r--r--src/corelib/tools/qarraydatapointer.h95
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/gui/doc/src/qtgui.qdoc3
-rw-r--r--src/gui/kernel/qkeysequence.cpp5
-rw-r--r--src/gui/painting/qstroker.cpp6
-rw-r--r--src/gui/text/qtextformat.cpp4
-rw-r--r--src/gui/util/qundostack.cpp12
-rw-r--r--src/gui/util/qundostack_p.h15
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp23
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp39
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.h5
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm5
-rw-r--r--src/plugins/tls/schannel/qtls_schannel.cpp3
-rw-r--r--src/tools/androidtestrunner/main.cpp51
-rw-r--r--src/widgets/doc/src/qtwidgets-examples.qdoc12
-rw-r--r--src/widgets/doc/src/qtwidgets-toc.qdoc1
-rw-r--r--src/widgets/kernel/qapplication.cpp14
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp3
-rw-r--r--src/widgets/widgets/qmenu.cpp2
41 files changed, 332 insertions, 193 deletions
diff --git a/src/corelib/doc/src/qtcore.qdoc b/src/corelib/doc/src/qtcore.qdoc
index ea65d68da58..ec5fa564639 100644
--- a/src/corelib/doc/src/qtcore.qdoc
+++ b/src/corelib/doc/src/qtcore.qdoc
@@ -19,8 +19,7 @@
\module QtCorePrivate
\title Qt Core Private C++ Classes
\qtvariable core-private
- \qtcmakepackage Core
- \qtcmaketargetitem CorePrivate
+ \qtcmakepackage CorePrivate
\preliminary
\brief Provides private core functionality.
@@ -28,7 +27,7 @@
private Qt Core APIs:
\badcode
- find_package(Qt6 REQUIRED COMPONENTS Core)
+ find_package(Qt6 REQUIRED COMPONENTS CorePrivate)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
\endcode
*/
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 01106abf34d..cb8514105a0 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -354,15 +354,15 @@ inline int qIntCast(qfloat16 f) noexcept
{ return int(static_cast<qfloat16::NearestFloat>(f)); }
#if !defined(Q_QDOC) && !QFLOAT16_IS_NATIVE
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
-QT_WARNING_DISABLE_GCC("-Wold-style-cast")
inline qfloat16::qfloat16(float f) noexcept
{
#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
__m128 packsingle = _mm_set_ss(f);
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_GCC("-Wold-style-cast") // _mm_cvtps_ph() may be a macro using C-style casts
__m128i packhalf = _mm_cvtps_ph(packsingle, 0);
- b16 = _mm_extract_epi16(packhalf, 0);
+ QT_WARNING_POP
+ b16 = quint16(_mm_extract_epi16(packhalf, 0));
#elif defined (__ARM_FP16_FORMAT_IEEE)
__fp16 f16 = __fp16(f);
memcpy(&b16, &f16, sizeof(quint16));
@@ -393,7 +393,6 @@ inline qfloat16::qfloat16(float f) noexcept
b16 = quint16(base + (mantissa >> shift));
#endif
}
-QT_WARNING_POP
inline qfloat16::operator float() const noexcept
{
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index afc6bab8559..319ae8bc24e 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -15,6 +15,8 @@
#include "qproperty_p.h"
#include "qthread.h"
+#include <q26numeric.h> // for q26::staturate_cast
+
using namespace std::chrono_literals;
QT_BEGIN_NAMESPACE
@@ -248,19 +250,21 @@ void QTimer::start(int msec)
start(msec * 1ms);
}
-static std::chrono::milliseconds
+static int
checkInterval(const char *caller, std::chrono::milliseconds interval)
{
- constexpr auto maxInterval = INT_MAX * 1ms;
if (interval < 0ms) {
qWarning("%s: negative intervals aren't allowed; the interval will be set to 1ms.", caller);
- interval = 1ms;
- } else if (interval > maxInterval) {
+ return 1;
+ }
+
+ const auto msec = interval.count();
+ int ret = q26::saturate_cast<int>(msec);
+ if (ret != msec) {
qWarning("%s: interval exceeds maximum allowed interval, it will be clamped to "
"INT_MAX ms (about 24 days).", caller);
- interval = maxInterval;
}
- return interval;
+ return ret;
}
/*!
@@ -288,8 +292,7 @@ void QTimer::start(std::chrono::milliseconds interval)
{
Q_D(QTimer);
- interval = checkInterval("QTimer::start", interval);
- const int msec = interval.count();
+ const int msec = checkInterval("QTimer::start", interval);
const bool intervalChanged = msec != d->inter;
d->inter.setValue(msec);
start();
@@ -656,8 +659,7 @@ void QTimer::setInterval(std::chrono::milliseconds interval)
{
Q_D(QTimer);
- interval = checkInterval("QTimer::setInterval", interval);
- const int msec = interval.count();
+ const int msec = checkInterval("QTimer::setInterval", interval);
d->inter.removeBindingUnlessInWrapper();
const bool intervalChanged = msec != d->inter.valueBypassingBindings();
d->inter.setValueBypassingBindings(msec);
@@ -705,7 +707,10 @@ int QTimer::remainingTime() const
if (d->isActive()) {
using namespace std::chrono;
auto remaining = QAbstractEventDispatcher::instance()->remainingTime(d->id);
- return ceil<milliseconds>(remaining).count();
+ const auto msec = ceil<milliseconds>(remaining).count();
+ const int ret = q26::saturate_cast<int>(msec);
+ Q_ASSERT(ret == msec); // cannot overflow because the interval is clamped before it's set
+ return ret;
}
return -1;
diff --git a/src/corelib/kernel/qwinregistry.cpp b/src/corelib/kernel/qwinregistry.cpp
index fb315cacb7e..37bf3f99ae1 100644
--- a/src/corelib/kernel/qwinregistry.cpp
+++ b/src/corelib/kernel/qwinregistry.cpp
@@ -191,7 +191,9 @@ QVariant QWinRegistryKey::value(const QString &subKey) const
// Otherwise, the resulting string (which may be empty) is returned.
QString QWinRegistryKey::stringValue(const wchar_t *subKey) const
{
- return value<QString>(subKey).value_or(QString());
+ if (auto v = value<QString>(subKey))
+ return std::move(*v);
+ return QString();
}
QString QWinRegistryKey::stringValue(const QString &subKey) const
diff --git a/src/corelib/serialization/.gitignore b/src/corelib/serialization/.gitignore
index 89f9ac04aac..8261c031991 100644
--- a/src/corelib/serialization/.gitignore
+++ b/src/corelib/serialization/.gitignore
@@ -1 +1,2 @@
+# Qt-Security score:insignificant reason:gitignore
out/
diff --git a/src/corelib/serialization/make-xml-parser.sh b/src/corelib/serialization/make-xml-parser.sh
index 18898337003..4174949154c 100755
--- a/src/corelib/serialization/make-xml-parser.sh
+++ b/src/corelib/serialization/make-xml-parser.sh
@@ -1,6 +1,7 @@
#!/bin/sh
# Copyright (C) 2016 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+# Qt-Security score:insignificant reason:build-tool-containing-no-compiled-source
me=$(dirname $0)
mkdir -p $me/out
diff --git a/src/corelib/serialization/qjsonparseerror.h b/src/corelib/serialization/qjsonparseerror.h
index 803b04c53b6..d8fc94448e6 100644
--- a/src/corelib/serialization/qjsonparseerror.h
+++ b/src/corelib/serialization/qjsonparseerror.h
@@ -7,6 +7,7 @@
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtcoreexports.h>
+#include <QtCore/qtypes.h>
QT_BEGIN_NAMESPACE
@@ -34,7 +35,8 @@ struct Q_CORE_EXPORT QJsonParseError
QString errorString() const;
- int offset = -1;
+ std::conditional_t<QT_VERSION_MAJOR < 7, int, qint64>
+ offset = -1;
ParseError error = NoError;
};
diff --git a/src/corelib/serialization/qjsonparser.cpp b/src/corelib/serialization/qjsonparser.cpp
index df266a76c79..779287adb1d 100644
--- a/src/corelib/serialization/qjsonparser.cpp
+++ b/src/corelib/serialization/qjsonparser.cpp
@@ -321,7 +321,9 @@ QCborValue Parser::parse(QJsonParseError *error)
error:
container.reset();
if (error) {
- error->offset = json - head;
+ using OffType = decltype(error->offset);
+ error->offset = OffType(json - head);
+ Q_ASSERT(error->offset == json - head);
error->error = lastError;
}
return QCborValue();
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 49d9e24d036..ef30d5e0da1 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -321,7 +321,7 @@ public:
{
if constexpr (std::is_same_v<InputIterator, iterator> || std::is_same_v<InputIterator, const_iterator>)
return assign(QByteArrayView(first, last));
- d.assign(first, last);
+ d->assign(first, last);
if (d.data())
d.data()[d.size] = '\0';
return *this;
diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp
index 9ead847843b..6609d17adf4 100644
--- a/src/corelib/text/qcollator.cpp
+++ b/src/corelib/text/qcollator.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2013 Aleix Pol Gonzalez <[email protected]>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:critical reason:data-parser
#include "qcollator_p.h"
#include "qstringlist.h"
diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h
index 870811fc48e..2b1e3963b0d 100644
--- a/src/corelib/text/qcollator.h
+++ b/src/corelib/text/qcollator.h
@@ -1,6 +1,7 @@
// Copyright (C) 2020 The Qt Company Ltd.
// Copyright (C) 2013 Aleix Pol Gonzalez <[email protected]>
// 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:trivial-impl-only
#ifndef QCOLLATOR_H
#define QCOLLATOR_H
diff --git a/src/corelib/text/qcollator_icu.cpp b/src/corelib/text/qcollator_icu.cpp
index 84f9c515374..e13e96285ef 100644
--- a/src/corelib/text/qcollator_icu.cpp
+++ b/src/corelib/text/qcollator_icu.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2020 The Qt Company Ltd.
// Copyright (C) 2013 Aleix Pol Gonzalez <[email protected]>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:critical reason:data-parser
#include "qcollator_p.h"
#include "qlocale_p.h"
diff --git a/src/corelib/text/qcollator_macx.cpp b/src/corelib/text/qcollator_macx.cpp
index 23c23bd53a2..c0561877dd1 100644
--- a/src/corelib/text/qcollator_macx.cpp
+++ b/src/corelib/text/qcollator_macx.cpp
@@ -1,5 +1,6 @@
// Copyright (C) 2020 Aleix Pol Gonzalez <[email protected]>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:critical reason:data-parser
#include "qcollator_p.h"
#include "qlocale_p.h"
diff --git a/src/corelib/text/qcollator_p.h b/src/corelib/text/qcollator_p.h
index b96cdbaa32a..400cafc0c8a 100644
--- a/src/corelib/text/qcollator_p.h
+++ b/src/corelib/text/qcollator_p.h
@@ -1,6 +1,7 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2013 Aleix Pol Gonzalez <[email protected]>
// 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:trivial-impl-only
#ifndef QCOLLATOR_P_H
#define QCOLLATOR_P_H
diff --git a/src/corelib/text/qcollator_posix.cpp b/src/corelib/text/qcollator_posix.cpp
index 5ed80c1b8ea..2712133521c 100644
--- a/src/corelib/text/qcollator_posix.cpp
+++ b/src/corelib/text/qcollator_posix.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2013 Aleix Pol Gonzalez <[email protected]>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:critical reason:data-parser
#include "qcollator_p.h"
#include "qstringlist.h"
diff --git a/src/corelib/text/qcollator_win.cpp b/src/corelib/text/qcollator_win.cpp
index b588f5ff46a..54228b79b31 100644
--- a/src/corelib/text/qcollator_win.cpp
+++ b/src/corelib/text/qcollator_win.cpp
@@ -1,5 +1,6 @@
// Copyright (C) 2020 Aleix Pol Gonzalez <[email protected]>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:critical reason:data-parser
#include "qcollator_p.h"
#include "qlocale_p.h"
diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc
index 3980e9d9a6d..bc88b27477d 100644
--- a/src/corelib/text/qlocale.qdoc
+++ b/src/corelib/text/qlocale.qdoc
@@ -1,5 +1,6 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+// Qt-Security score:insignificant reason:docs
/*!
\class QLocale
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 868a5d5ef03..b8acf7c923d 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -642,7 +642,7 @@ public:
d.data()[d.size] = u'\0';
return *this;
} else {
- d.assign(first, last, [](QChar ch) -> char16_t { return ch.unicode(); });
+ d->assign(first, last, [](QChar ch) -> char16_t { return ch.unicode(); });
if (d.constAllocatedCapacity())
d.data()[d.size] = u'\0';
return *this;
diff --git a/src/corelib/text/qtliterals.qdoc b/src/corelib/text/qtliterals.qdoc
index c4671415ee4..8be03a02236 100644
--- a/src/corelib/text/qtliterals.qdoc
+++ b/src/corelib/text/qtliterals.qdoc
@@ -1,5 +1,6 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+// Qt-Security score:insignificant reason:docs
/*!
\namespace QtLiterals
@@ -43,4 +44,8 @@
// in the Qt namespace
using namespace Qt;
\endcode
+
+ The latter is discouraged, because it doesn't allow you to pick which literal
+ operators you want in case Qt adds conflicting operators in different
+ namespaces within Qt::Literals.
*/
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index c20abd12c23..80641c4a281 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -9,12 +9,12 @@
#include <QtCore/qcontainertools_impl.h>
#include <QtCore/qnamespace.h>
-#include <memory>
+#include <QtCore/q20functional.h>
+#include <QtCore/q20memory.h>
#include <new>
#include <string.h>
#include <utility>
#include <iterator>
-#include <tuple>
#include <type_traits>
QT_BEGIN_NAMESPACE
@@ -844,7 +844,6 @@ protected:
public:
// using Base::truncate;
// using Base::destroyAll;
- // using Base::assign;
template<typename It>
void appendIteratorRange(It b, It e, QtPrivate::IfIsForwardIterator<It> = true)
@@ -910,6 +909,146 @@ public:
std::uninitialized_default_construct(b, e);
this->size = newSize;
}
+
+ using Base::assign;
+
+ template <typename InputIterator, typename Projection = q20::identity>
+ void assign(InputIterator first, InputIterator last, Projection proj = {})
+ {
+ // This function only provides the basic exception guarantee.
+ using Category = typename std::iterator_traits<InputIterator>::iterator_category;
+ constexpr bool IsFwdIt = std::is_convertible_v<Category, std::forward_iterator_tag>;
+
+ const qsizetype n = IsFwdIt ? std::distance(first, last) : 0;
+ bool undoPrependOptimization = true;
+ bool needCapacity = n > this->constAllocatedCapacity();
+ if (needCapacity || this->needsDetach()) {
+ bool wasLastRef = !this->deref();
+ qsizetype newCapacity = this->detachCapacity(n);
+ if (wasLastRef && needCapacity) {
+ // free memory we can't reuse
+ this->destroyAll();
+ Data::deallocate(this->d);
+ }
+ if (!needCapacity && wasLastRef) {
+ // we were the last reference and can reuse the storage
+ this->d->ref_.storeRelaxed(1);
+ } else {
+ // we must allocate new memory
+ std::tie(this->d, this->ptr) = Data::allocate(newCapacity);
+ this->size = 0;
+ undoPrependOptimization = false;
+ }
+ }
+
+ if constexpr (!std::is_nothrow_constructible_v<T, decltype(std::invoke(proj, *first))>) {
+ // If construction can throw, and we have freeSpaceAtBegin(),
+ // it's easiest to just clear the container and start fresh.
+ // The alternative would be to keep track of two active, disjoint ranges.
+ if (undoPrependOptimization) {
+ this->truncate(0);
+ this->setBegin(Data::dataStart(this->d, alignof(typename Data::AlignmentDummy)));
+ undoPrependOptimization = false;
+ }
+ }
+
+ const auto dend = this->end();
+ T *dst = this->begin();
+ T *capacityBegin = dst;
+ qsizetype offset = 0;
+ if (undoPrependOptimization) {
+ capacityBegin = Data::dataStart(this->d, alignof(typename Data::AlignmentDummy));
+ offset = dst - capacityBegin;
+ }
+ if constexpr (!QTypeInfo<T>::isComplex) {
+ this->setBegin(capacityBegin); // undo prepend optimization
+ dst = capacityBegin;
+
+ // there's nothing to destroy or overwrite
+ } else if (offset) { // avoids dead stores
+ T *prependBufferEnd = dst;
+ this->setBegin(capacityBegin); // undo prepend optimization
+ dst = capacityBegin;
+
+ // By construction, the following loop is nothrow!
+ // (otherwise, we can't reach here)
+ // Assumes InputIterator operations don't throw.
+ // (but we can't statically assert that, as these operations
+ // have preconditons, so typically aren't noexcept)
+ while (true) {
+ if (dst == prependBufferEnd) { // ran out of prepend buffer space
+ this->size += offset;
+ // we now have a contiguous buffer, continue with the main loop:
+ break;
+ }
+ if (first == last) { // ran out of elements to assign
+ std::destroy(prependBufferEnd, dend);
+ this->size = dst - this->begin();
+ return;
+ }
+ // construct element in prepend buffer
+ q20::construct_at(dst, std::invoke(proj, *first));
+ ++dst;
+ ++first;
+ }
+ }
+
+ assign_impl(first, last, dst, dend, proj, Category{});
+ }
+
+ template <typename InputIterator, typename Projection>
+ void assign_impl(InputIterator first, InputIterator last, T *dst, T *dend, Projection proj,
+ std::input_iterator_tag)
+ {
+ while (true) {
+ if (first == last) { // ran out of elements to assign
+ std::destroy(dst, dend);
+ break;
+ }
+ if (dst == dend) { // ran out of existing elements to overwrite
+ do {
+ this->emplace(this->size, std::invoke(proj, *first));
+ } while (++first != last);
+ return; // size() is already correct (and dst invalidated)!
+ }
+ *dst = std::invoke(proj, *first); // overwrite existing element
+ ++dst;
+ ++first;
+ }
+ this->size = dst - this->begin();
+ }
+
+ template <typename InputIterator, typename Projection>
+ void assign_impl(InputIterator first, InputIterator last, T *dst, T *, Projection proj,
+ std::forward_iterator_tag)
+ {
+ constexpr bool IsIdentity = std::is_same_v<Projection, q20::identity>;
+ const qsizetype n = std::distance(first, last);
+ if constexpr (IsIdentity && !QTypeInfo<T>::isComplex) {
+ // For non-complex types, we prefer a single std::copy() -> memcpy()
+ // call. We can do that because either the default constructor is
+ // trivial (so the lifetime has started) or the copy constructor is
+ // (and won't care what the stored value is).
+ std::copy(first, last, dst);
+ } else {
+ // overwrite existing elements and create new
+ qsizetype i = 0;
+ qsizetype size = this->size;
+ for ( ; i < size; ++i) {
+ *dst = std::invoke(proj, *first); // overwrite existing element
+ ++first;
+ ++dst;
+ }
+ for ( ; i < n; ++i) {
+ q20::construct_at(dst, std::invoke(proj, *first));
+ ++first;
+ ++dst;
+ }
+ if (i < size)
+ std::destroy_n(dst, size - i);
+ }
+ this->size = n;
+ }
};
} // namespace QtPrivate
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 7fa6f2e7dd9..52984e40f31 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -7,9 +7,6 @@
#include <QtCore/qarraydataops.h>
#include <QtCore/qcontainertools_impl.h>
-#include <QtCore/q20functional.h>
-#include <QtCore/q20memory.h>
-
QT_BEGIN_NAMESPACE
template <class T>
@@ -320,98 +317,6 @@ public:
this->ptr = res;
}
- template <typename InputIterator, typename Projection = q20::identity>
- void assign(InputIterator first, InputIterator last, Projection proj = {})
- {
- // This function only provides the basic exception guarantee.
- constexpr bool IsFwdIt = std::is_convertible_v<
- typename std::iterator_traits<InputIterator>::iterator_category,
- std::forward_iterator_tag>;
- constexpr bool IsIdentity = std::is_same_v<Projection, q20::identity>;
-
- if constexpr (IsFwdIt) {
- const qsizetype n = std::distance(first, last);
- if (needsDetach() || n > constAllocatedCapacity()) {
- QArrayDataPointer allocated(detachCapacity(n));
- swap(allocated);
- }
- } else if (needsDetach()) {
- QArrayDataPointer allocated(allocatedCapacity());
- swap(allocated);
- // We don't want to copy data that we know we'll overwrite
- }
-
- auto offset = freeSpaceAtBegin();
- const auto capacityBegin = begin() - offset;
- const auto prependBufferEnd = begin();
-
- if constexpr (!std::is_nothrow_constructible_v<T, decltype(std::invoke(proj, *first))>) {
- // If construction can throw, and we have freeSpaceAtBegin(),
- // it's easiest to just clear the container and start fresh.
- // The alternative would be to keep track of two active, disjoint ranges.
- if (offset) {
- (*this)->truncate(0);
- setBegin(capacityBegin);
- offset = 0;
- }
- }
-
- auto dst = capacityBegin;
- const auto dend = end();
- if (offset) { // avoids dead stores
- setBegin(capacityBegin); // undo prepend optimization
-
- // By construction, the following loop is nothrow!
- // (otherwise, we can't reach here)
- // Assumes InputIterator operations don't throw.
- // (but we can't statically assert that, as these operations
- // have preconditons, so typically aren't noexcept)
- while (true) {
- if (dst == prependBufferEnd) { // ran out of prepend buffer space
- size += offset;
- // we now have a contiguous buffer, continue with the main loop:
- break;
- }
- if (first == last) { // ran out of elements to assign
- std::destroy(prependBufferEnd, dend);
- size = dst - begin();
- return;
- }
- // construct element in prepend buffer
- q20::construct_at(dst, std::invoke(proj, *first));
- ++dst;
- ++first;
- }
- }
-
- while (true) {
- if (first == last) { // ran out of elements to assign
- std::destroy(dst, dend);
- break;
- }
- if (dst == dend) { // ran out of existing elements to overwrite
- if constexpr (IsFwdIt && IsIdentity) {
- dst = std::uninitialized_copy(first, last, dst);
- break;
- } else if constexpr (IsFwdIt && !IsIdentity
- && std::is_nothrow_constructible_v<T, decltype(std::invoke(proj, *first))>) {
- for (; first != last; ++dst, ++first) // uninitialized_copy with projection
- q20::construct_at(dst, std::invoke(proj, *first));
- break;
- } else {
- do {
- (*this)->emplace(size, std::invoke(proj, *first));
- } while (++first != last);
- return; // size() is already correct (and dst invalidated)!
- }
- }
- *dst = std::invoke(proj, *first); // overwrite existing element
- ++dst;
- ++first;
- }
- size = dst - begin();
- }
-
QArrayDataPointer sliced(qsizetype pos, qsizetype n) const &
{
QArrayDataPointer result(n);
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 7a93ec688ef..79b367b199c 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -578,7 +578,7 @@ public:
template <typename InputIterator, if_input_iterator<InputIterator> = true>
QList &assign(InputIterator first, InputIterator last)
- { d.assign(first, last); return *this; }
+ { d->assign(first, last); return *this; }
QList &assign(std::initializer_list<T> l)
{ return assign(l.begin(), l.end()); }
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index a89872e70f6..f5d60699deb 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -17,8 +17,7 @@
/*!
\module QtGuiPrivate
\title Qt GUI Private C++ Classes
- \qtcmakepackage Gui
- \qtcmaketargetitem GuiPrivate
+ \qtcmakepackage GuiPrivate
\qtvariable gui-private
\brief Provides access to private GUI functionality.
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index c7b6e4ebff3..bb71f8fb6fc 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1298,7 +1298,10 @@ QString QKeySequencePrivate::keyName(Qt::Key key, QKeySequence::SequenceFormat f
bool nativeText = (format == QKeySequence::NativeText);
QString p;
- if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
+ if (nativeText && (key > 0x00 && key <= 0x1f)) {
+ // Map C0 control codes to the corresponding Control Pictures
+ p = QChar::fromUcs2(0x2400 + key);
+ } else if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
if (!QChar::requiresSurrogates(key)) {
p = QChar::fromUcs2(key).toUpper();
} else {
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 79799ca2ece..0d435c95048 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1154,7 +1154,8 @@ void QDashStroker::processCurrentSubpath()
elen -= std::floor(elen * invSumLength) * sumLength;
// Update dash offset.
while (!done) {
- qreal dpos = pos + dashes[idash] - doffset - estart;
+ // parentheses to avoid float rounding issues: qreal(4) + 0.1 - 0.1 - 4 < 0
+ qreal dpos = (pos + dashes[idash]) - (doffset + estart);
Q_ASSERT(dpos >= 0);
@@ -1189,7 +1190,8 @@ void QDashStroker::processCurrentSubpath()
bool has_offset = doffset > 0;
bool evenDash = (idash & 1) == 0;
- qreal dpos = pos + dashes[idash] - doffset - estart;
+ // parentheses to avoid float rounding issues: qreal(4) + 0.1 - 0.1 - 4 < 0
+ qreal dpos = (pos + dashes[idash]) - (doffset + estart);
Q_ASSERT(dpos >= 0);
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 53a984306c6..d722bceb289 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -657,8 +657,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat &
\value FontStyleName
\value FontPointSize
\value FontPixelSize
- \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using
- FontPointSize or FontPixelSize.
+ \value FontSizeAdjustment Specifies an integer adjustment added to the base font size set using
+ \c FontPointSize or \c FontPixelSize.
\value FontFixedPitch
\omitvalue FontSizeIncrement
\value FontWeight
diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp
index 3d1d8a2b788..27b131cd733 100644
--- a/src/gui/util/qundostack.cpp
+++ b/src/gui/util/qundostack.cpp
@@ -425,16 +425,16 @@ void QUndoStackPrivate::setIndex(int idx, bool clean)
emit q->indexChanged(index);
}
- const ActionState newUndoState{q->canUndo(), q->undoText()};
- if (indexChanged || newUndoState != undoActionState) {
- undoActionState = newUndoState;
+ if (ActionState newUndoState{q->canUndo(), q->undoText()};
+ indexChanged || newUndoState != undoActionState) {
+ undoActionState = std::move(newUndoState);
emit q->canUndoChanged(undoActionState.enabled);
emit q->undoTextChanged(undoActionState.text);
}
- const ActionState newRedoState{q->canRedo(), q->redoText()};
- if (indexChanged || newRedoState != redoActionState) {
- redoActionState = newRedoState;
+ if (ActionState newRedoState{q->canRedo(), q->redoText()};
+ indexChanged || newRedoState != redoActionState) {
+ redoActionState = std::move(newRedoState);
emit q->canRedoChanged(redoActionState.enabled);
emit q->redoTextChanged(redoActionState.text);
}
diff --git a/src/gui/util/qundostack_p.h b/src/gui/util/qundostack_p.h
index fea201ce62d..6bdcf5fb20b 100644
--- a/src/gui/util/qundostack_p.h
+++ b/src/gui/util/qundostack_p.h
@@ -59,10 +59,17 @@ public:
bool enabled = false;
QString text;
- bool operator!=(const ActionState &other) const noexcept
- {
- return enabled != other.enabled || text != other.text;
- }
+ friend bool operator==(const ActionState &lhs, const ActionState &rhs) noexcept
+#ifdef __cpp_impl_three_way_comparison
+ = default;
+#else
+ { return lhs.enabled == rhs.enabled && lhs.text == rhs.text; }
+ friend bool operator!=(const ActionState &lhs, const ActionState &rhs) noexcept
+ { return !(lhs == rhs); }
+#endif
+ // some compiler's reject seed = 0) = delete, overload instead:
+ friend void qHash(const ActionState &key, size_t seed) = delete;
+ friend void qHash(const ActionState &key) = delete;
};
QList<QUndoCommand*> command_list;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index bcd9aecdea9..120d2ecbc78 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -326,6 +326,11 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
*/
bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt, int v)
{
+#ifdef QNATIVESOCKETENGINE_DEBUG
+# define perrorDebug(msg) perror("QNativeSocketEnginePrivate::setOption(): " msg)
+#else
+# define perrorDebug(msg) (void)0
+#endif
Q_Q(QNativeSocketEngine);
if (!q->isValid())
return false;
@@ -337,25 +342,16 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
#if !defined(Q_OS_VXWORKS)
int flags = ::fcntl(socketDescriptor, F_GETFL, 0);
if (flags == -1) {
-#ifdef QNATIVESOCKETENGINE_DEBUG
- perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_GETFL) failed");
-#endif
+ perrorDebug("fcntl(F_GETFL) failed");
return false;
}
if (::fcntl(socketDescriptor, F_SETFL, flags | O_NONBLOCK) == -1) {
-#ifdef QNATIVESOCKETENGINE_DEBUG
- perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_SETFL) failed");
-#endif
+ perrorDebug("fcntl(F_SETFL) failed");
return false;
}
#else // Q_OS_VXWORKS
- int onoff = 1;
-
- if (qt_safe_ioctl(socketDescriptor, FIONBIO, &onoff) < 0) {
-
-#ifdef QNATIVESOCKETENGINE_DEBUG
- perror("QNativeSocketEnginePrivate::setOption(): ioctl(FIONBIO, 1) failed");
-#endif
+ if (qt_safe_ioctl(socketDescriptor, FIONBIO, &v) < 0) {
+ perrorDebug("ioctl(FIONBIO, 1) failed");
return false;
}
#endif // Q_OS_VXWORKS
@@ -417,6 +413,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
if (n == -1)
return false;
return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
+#undef perrorDebug
}
bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port)
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index c8555cdc659..f64742ff133 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -291,7 +291,7 @@ void QAndroidPlatformScreen::topVisibleWindowChanged()
if (w && w->handle()) {
QAndroidPlatformWindow *platformWindow = static_cast<QAndroidPlatformWindow *>(w->handle());
if (platformWindow) {
- platformWindow->updateSystemUiVisibility();
+ platformWindow->updateSystemUiVisibility(w->windowStates(), w->flags());
platformWindow->updateFocusedEditText();
}
}
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index 96c4bfa06f1..c4245998772 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -56,15 +56,12 @@ void QAndroidPlatformWindow::initialize()
isForeignWindow(), m_nativeParentQtWindow, listener);
m_nativeViewId = m_nativeQtWindow.callMethod<jint>("getId");
- m_windowFlags = Qt::Widget;
- m_windowState = Qt::WindowNoState;
// the surfaceType is overwritten in QAndroidPlatformOpenGLWindow ctor so let's save
// the fact that it's a raster window for now
m_isRaster = window->surfaceType() == QSurface::RasterSurface;
- setWindowState(window->windowStates());
// the following is in relation to the virtual geometry
- const bool forceMaximize = m_windowState & (Qt::WindowMaximized | Qt::WindowFullScreen);
+ const bool forceMaximize = window->windowStates() & (Qt::WindowMaximized | Qt::WindowFullScreen);
const QRect nativeScreenGeometry = platformScreen()->availableGeometry();
if (forceMaximize) {
setGeometry(nativeScreenGeometry);
@@ -123,7 +120,7 @@ void QAndroidPlatformWindow::raise()
QWindowSystemInterface::handleFocusWindowChanged(window(), Qt::ActiveWindowFocusReason);
return;
}
- updateSystemUiVisibility();
+ updateSystemUiVisibility(window()->windowStates(), window()->flags());
platformScreen()->raise(this);
}
@@ -167,13 +164,13 @@ void QAndroidPlatformWindow::setVisible(bool visible)
if (!visible && window() == qGuiApp->focusWindow()) {
platformScreen()->topVisibleWindowChanged();
} else {
- updateSystemUiVisibility();
- if ((m_windowState & Qt::WindowFullScreen)
- || (window()->flags() & Qt::ExpandedClientAreaHint)) {
+ const Qt::WindowStates states = window()->windowStates();
+ const Qt::WindowFlags flags = window()->flags();
+ updateSystemUiVisibility(states, flags);
+ if (states & Qt::WindowFullScreen || flags & Qt::ExpandedClientAreaHint)
setGeometry(platformScreen()->geometry());
- } else if (m_windowState & Qt::WindowMaximized) {
+ else if (states & Qt::WindowMaximized)
setGeometry(platformScreen()->availableGeometry());
- }
requestActivateWindow();
}
}
@@ -188,27 +185,18 @@ void QAndroidPlatformWindow::setVisible(bool visible)
void QAndroidPlatformWindow::setWindowState(Qt::WindowStates state)
{
- if (m_windowState == state)
- return;
-
QPlatformWindow::setWindowState(state);
- m_windowState = state;
if (window()->isVisible())
- updateSystemUiVisibility();
+ updateSystemUiVisibility(state, window()->flags());
}
void QAndroidPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
{
- if (m_windowFlags == flags)
- return;
+ QPlatformWindow::setWindowFlags(flags);
- m_windowFlags = flags;
-}
-
-Qt::WindowFlags QAndroidPlatformWindow::windowFlags() const
-{
- return m_windowFlags;
+ if (window()->isVisible())
+ updateSystemUiVisibility(window()->windowStates(), flags);
}
void QAndroidPlatformWindow::setParent(const QPlatformWindow *window)
@@ -256,16 +244,15 @@ void QAndroidPlatformWindow::requestActivateWindow()
raise();
}
-void QAndroidPlatformWindow::updateSystemUiVisibility()
+void QAndroidPlatformWindow::updateSystemUiVisibility(Qt::WindowStates states, Qt::WindowFlags flags)
{
- const int flags = window()->flags();
const bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
if (!isNonRegularWindow) {
auto iface = qGuiApp->nativeInterface<QNativeInterface::QAndroidApplication>();
iface->runOnAndroidMainThread([=]() {
using namespace QtJniTypes;
auto activity = iface->context().object<Activity>();
- if (m_windowState & Qt::WindowFullScreen)
+ if (states & Qt::WindowFullScreen)
QtWindowInsetsController::callStaticMethod("showFullScreen", activity);
else if (flags & Qt::ExpandedClientAreaHint)
QtWindowInsetsController::callStaticMethod("showExpanded", activity);
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.h b/src/plugins/platforms/android/qandroidplatformwindow.h
index 07f4e12b35c..826a8d30ade 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.h
+++ b/src/plugins/platforms/android/qandroidplatformwindow.h
@@ -43,7 +43,6 @@ public:
void setWindowState(Qt::WindowStates state) override;
void setWindowFlags(Qt::WindowFlags flags) override;
- Qt::WindowFlags windowFlags() const;
void setParent(const QPlatformWindow *window) override;
WId winId() const override;
@@ -58,7 +57,7 @@ public:
void propagateSizeHints() override;
void requestActivateWindow() override;
- void updateSystemUiVisibility();
+ void updateSystemUiVisibility(Qt::WindowStates states, Qt::WindowFlags flags);
void updateFocusedEditText();
inline bool isRaster() const { return m_isRaster; }
bool isExposed() const override;
@@ -82,8 +81,6 @@ protected:
bool isEmbeddingContainer() const;
virtual void clearSurface() {}
- Qt::WindowFlags m_windowFlags;
- Qt::WindowStates m_windowState;
bool m_isRaster;
int m_nativeViewId = -1;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 82a86d6ff3a..01716fba60c 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -4019,9 +4019,11 @@ void QWindowsWindow::requestUpdate()
// request or we are waiting for the event loop to process
// the Posted event on the GUI thread.
if (m_vsyncUpdatePending.testAndSetAcquire(UpdateState::Requested, UpdateState::Posted)) {
- QMetaObject::invokeMethod(w, [w] {
+ QWindowsWindow *oldSelf = this;
+ QMetaObject::invokeMethod(w, [w, oldSelf] {
+ // 'oldSelf' is only used for comparison, don't access it directly!
auto *self = static_cast<QWindowsWindow *>(w->handle());
- if (self) {
+ if (self && self == oldSelf) {
// The platform window is still alive
self->m_vsyncUpdatePending.storeRelease(UpdateState::Ready);
self->deliverUpdateRequest();
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 5ba6f3e1649..0b05a31ca5c 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -5849,6 +5849,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
const auto aquaSize = d->effectiveAquaSizeConstrain(opt, widget);
const auto cw = QMacStylePrivate::CocoaControl(QMacStylePrivate::Stepper, aquaSize);
NSStepperCell *cell = static_cast<NSStepperCell *>(d->cocoaCell(cw));
+ const auto controlSize = cell.controlSize;
+ if (qt_apple_runningWithLiquidGlass())
+ cell.controlSize = NSControlSizeMini;
cell.enabled = (sb->state & State_Enabled);
const CGRect newRect = [cell drawingRectForBounds:updown.toCGRect()];
@@ -5869,6 +5872,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
[cell stopTracking:pressPoint at:pressPoint inView:d->backingStoreNSView mouseIsUp:NO];
d->restoreNSGraphicsContext(cg);
+ if (qt_apple_runningWithLiquidGlass())
+ cell.controlSize = controlSize;
}
}
break;
diff --git a/src/plugins/tls/schannel/qtls_schannel.cpp b/src/plugins/tls/schannel/qtls_schannel.cpp
index 12c2625f39d..667f2d8a6c3 100644
--- a/src/plugins/tls/schannel/qtls_schannel.cpp
+++ b/src/plugins/tls/schannel/qtls_schannel.cpp
@@ -1238,9 +1238,10 @@ bool TlsCryptographSchannel::createContext()
};
#endif
+ const QString encodedTargetName = QUrl::fromUserInput(targetName()).host(QUrl::EncodeUnicode);
auto status = InitializeSecurityContext(&credentialHandle, // phCredential
nullptr, // phContext
- const_reinterpret_cast<SEC_WCHAR *>(targetName().utf16()), // pszTargetName
+ const_reinterpret_cast<SEC_WCHAR *>(encodedTargetName.utf16()), // pszTargetName
contextReq, // fContextReq
0, // Reserved1
0, // TargetDataRep (unused)
diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp
index 0e04d10e692..b517d85c5fb 100644
--- a/src/tools/androidtestrunner/main.cpp
+++ b/src/tools/androidtestrunner/main.cpp
@@ -328,6 +328,53 @@ static bool processAndroidManifest()
return true;
}
+static QStringList queryDangerousPermissions()
+{
+ QByteArray output;
+ const QStringList args({ "shell"_L1, "dumpsys"_L1, "package"_L1, "permissions"_L1 });
+ if (!execAdbCommand(args, &output, false)) {
+ qWarning("Failed to query permissions via dumpsys");
+ return {};
+ }
+
+ /*
+ * Permissions section from this command look like:
+ *
+ * Permission [android.permission.INTERNET] (c8cafdc):
+ * sourcePackage=android
+ * uid=1000 gids=[3003] type=0 prot=normal|instant
+ * perm=PermissionInfo{5f5bfbb android.permission.INTERNET}
+ * flags=0x0
+ */
+ const static QRegularExpression regex("^\\s*Permission\\s+\\[([^\\]]+)\\]\\s+\\(([^)]+)\\):"_L1);
+ QStringList dangerousPermissions;
+ QString currentPerm;
+
+ const QStringList lines = QString::fromUtf8(output).split(u'\n');
+ for (const QString &line : lines) {
+ QRegularExpressionMatch match = regex.match(line);
+ if (match.hasMatch()) {
+ currentPerm = match.captured(1);
+ continue;
+ }
+
+ if (currentPerm.isEmpty())
+ continue;
+
+ int protIndex = line.indexOf("prot="_L1);
+ if (protIndex == -1)
+ continue;
+
+ QString protectionTypes = line.mid(protIndex + 5).trimmed();
+ if (protectionTypes.contains("dangerous"_L1, Qt::CaseInsensitive)) {
+ dangerousPermissions.append(currentPerm);
+ currentPerm.clear();
+ }
+ }
+
+ return dangerousPermissions;
+}
+
static void setOutputFile(QString file, QString format)
{
if (format.isEmpty())
@@ -938,7 +985,11 @@ int main(int argc, char *argv[])
return EXIT_ERROR;
}
+ const QStringList dangerousPermisisons = queryDangerousPermissions();
for (const auto &permission : g_options.permissions) {
+ if (!dangerousPermisisons.contains(permission))
+ continue;
+
if (!execAdbCommand({ "shell"_L1, "pm"_L1, "grant"_L1, g_options.package, permission },
nullptr)) {
qWarning("Unable to grant '%s' to '%s'. Probably the Android version mismatch.",
diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc
index 45677c471ba..364c985b310 100644
--- a/src/widgets/doc/src/qtwidgets-examples.qdoc
+++ b/src/widgets/doc/src/qtwidgets-examples.qdoc
@@ -164,3 +164,15 @@
regular expressions for the Widget-based applications.
*/
+/*!
+ \group examples-user-input
+ \ingroup all-examples
+ \title User Input Examples
+ \brief Using user input in Qt Widgets applications.
+
+ \image imagegestures-example.png {Application handling touch gestures}
+
+ Qt provides the functionality for handling user input and drag-and-drop in
+ widget-based applications.
+
+*/
diff --git a/src/widgets/doc/src/qtwidgets-toc.qdoc b/src/widgets/doc/src/qtwidgets-toc.qdoc
index bc447b8bd58..beddf853a22 100644
--- a/src/widgets/doc/src/qtwidgets-toc.qdoc
+++ b/src/widgets/doc/src/qtwidgets-toc.qdoc
@@ -53,6 +53,7 @@
\li \l{Rich Text Examples}
\li \l{Graphics View Examples}
\li \l{Widget Tools Examples}
+ \li \l{User Input Examples}
\endlist
\endlist
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 53ce4dd8211..fa95a1d2538 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1508,11 +1508,15 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
return;
}
- if (focus && (reason == Qt::BacktabFocusReason || reason == Qt::TabFocusReason)
- && qt_in_tab_key_event)
- focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
- else if (focus && reason == Qt::ShortcutFocusReason) {
- focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
+ if (focus) {
+ if ((reason == Qt::BacktabFocusReason || reason == Qt::TabFocusReason)
+ && qt_in_tab_key_event)
+ focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
+ else if (reason == Qt::ShortcutFocusReason) {
+ focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
+ } else {
+ focus->window()->setAttribute(Qt::WA_KeyboardFocusChange, false);
+ }
}
QWidget *prev = focus_widget;
focus_widget = focus;
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 055d8f3d11e..1708a53f163 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -572,6 +572,8 @@ bool QDockWidgetGroupWindow::hasNativeDecos() const
#endif
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Waggressive-loop-optimizations")
/*
The given widget is hovered over this floating group.
This function will save the state and create a gap in the actual state.
@@ -623,6 +625,7 @@ bool QDockWidgetGroupWindow::hover(QLayoutItem *widgetItem, const QPoint &mouseP
layoutInfo()->apply(opts & QMainWindow::AnimatedDocks);
return true;
}
+QT_WARNING_POP
void QDockWidgetGroupWindow::updateCurrentGapRect()
{
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 7d4228709be..3177ed5c2d4 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -2971,7 +2971,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
#endif
d->activateAction(action, QAction::Trigger);
}
- } else if (!action || action->isEnabled()) {
+ } else if ((!action || action->isEnabled()) && !action->isSeparator()) {
d->hideUpToMenuBar();
}
}