summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/configure.cmake2
-rw-r--r--src/corelib/text/qregularexpression.cpp2
-rw-r--r--src/corelib/text/qstringconverter_p.h1
-rw-r--r--src/gui/painting/qcolor.cpp30
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp13
-rw-r--r--src/network/kernel/qauthenticator.cpp2
-rw-r--r--src/network/kernel/qauthenticator.h2
-rw-r--r--src/tools/macdeployqt/shared/shared.cpp27
-rw-r--r--src/widgets/dialogs/qwizard.cpp34
-rw-r--r--src/widgets/dialogs/qwizard.h10
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp14
11 files changed, 85 insertions, 52 deletions
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 5f0e7afef50..b778f605621 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -812,7 +812,7 @@ qt_feature("winsdkicu" PRIVATE
)
qt_feature("windows-ioring" PRIVATE
LABEL "Windows I/O Ring"
- AUTODETECT WIN32 AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 10.0.22000
+ AUTODETECT WIN32
CONDITION TEST_windows_ioring
)
qt_feature("inotify" PUBLIC PRIVATE
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 5cc8e8681bb..0c65e18ec10 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -952,7 +952,7 @@ void QRegularExpressionPrivate::getPatternInfo()
namespace {
struct PcreJitStackFree
{
- void operator()(pcre2_jit_stack_16 *stack)
+ void operator()(pcre2_jit_stack_16 *stack) const
{
if (stack)
pcre2_jit_stack_free_16(stack);
diff --git a/src/corelib/text/qstringconverter_p.h b/src/corelib/text/qstringconverter_p.h
index 3ac60ce8c70..3923c2f302f 100644
--- a/src/corelib/text/qstringconverter_p.h
+++ b/src/corelib/text/qstringconverter_p.h
@@ -334,6 +334,7 @@ struct QUtf8
static char16_t *convertToUnicode(char16_t *dst, QByteArrayView in, QStringConverter::State *state);
+ Q_CORE_EXPORT
static char *convertFromUnicode(char *dst, QStringView in) noexcept;
Q_CORE_EXPORT static QByteArray convertFromUnicode(QStringView in);
Q_CORE_EXPORT static QByteArray convertFromUnicode(QStringView in, QStringConverter::State *state);
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index fe79490f54b..d63da38b747 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2196,29 +2196,27 @@ QColor QColor::toHsv() const noexcept
color.ct.ahsv.alpha = ct.argb.alpha;
color.ct.ahsv.pad = 0;
- const float r = ct.argb.red / float(USHRT_MAX);
- const float g = ct.argb.green / float(USHRT_MAX);
- const float b = ct.argb.blue / float(USHRT_MAX);
- const float max = Q_MAX_3(r, g, b);
- const float min = Q_MIN_3(r, g, b);
- const float delta = max - min;
- color.ct.ahsv.value = qRound(max * USHRT_MAX);
- if (qFuzzyIsNull(delta)) {
+ const ushort r = ct.argb.red;
+ const ushort g = ct.argb.green;
+ const ushort b = ct.argb.blue;
+ const auto [min, max] = std::minmax({r, g, b});
+ color.ct.ahsv.value = max;
+ if (max == min) {
// achromatic case, hue is undefined
color.ct.ahsv.hue = USHRT_MAX;
color.ct.ahsv.saturation = 0;
} else {
// chromatic case
- float hue = 0;
+ const float delta = max - min; // cannot overflow
+ float hue;
color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX);
- if (qFuzzyCompare(r, max)) {
- hue = ((g - b) /delta);
- } else if (qFuzzyCompare(g, max)) {
- hue = (2.0f + (b - r) / delta);
- } else if (qFuzzyCompare(b, max)) {
- hue = (4.0f + (r - g) / delta);
+ if (max == r) {
+ hue = 0 + (g - b) / delta;
+ } else if (max == g) {
+ hue = 2 + (b - r) / delta;
} else {
- Q_ASSERT_X(false, "QColor::toHsv", "internal error");
+ Q_ASSERT(max == b); // max({r,g,b}) must be one of r, g, and b!
+ hue = 4 + (r - g) / delta;
}
hue *= 60.0f;
if (hue < 0.0f)
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 6428653de26..66bb65685fa 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -216,6 +216,19 @@ static void ensureInitialized()
can be:
\snippet code/src_network_access_qnetworkaccessmanager.cpp 1
+ Since Qt 6.11 the defaults of the TCP Keepalive parameters used by
+ QNetworkAccessManager have been changed. With the current settings
+ the connection will be terminated after 2 minutes of inactivity.
+
+ These settings can be changed the individual requests, to make
+ them more lenient, or even more aggressive via the QNetworkRequest API.
+ \snippet http/httpwindow.cpp qnam-tcpkeepalive
+
+ In the above snippet we are picking a more aggressive strategy, to
+ terminate the connection after thirty seconds of inactivity. This can
+ be useful, for example, in early detection of network hangs caused
+ by network changes on Linux.
+
\sa QNetworkRequest, QNetworkReply, QNetworkProxy
*/
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 2ef1c31ce1c..7be1d7fe3aa 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -365,7 +365,7 @@ bool QAuthenticator::isNull() const
state.
*/
-void QAuthenticator::clear() noexcept
+void QAuthenticator::clear()
{
*d = QAuthenticatorPrivate();
d->phase = QAuthenticatorPrivate::Done;
diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h
index db309fb87ad..c4993ff0fc7 100644
--- a/src/network/kernel/qauthenticator.h
+++ b/src/network/kernel/qauthenticator.h
@@ -44,7 +44,7 @@ public:
bool isNull() const;
void detach();
- void clear() noexcept;
+ void clear();
private:
friend class QAuthenticatorPrivate;
QAuthenticatorPrivate *d;
diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp
index 0731fb616ed..7f8590ae894 100644
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1008,6 +1008,31 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,
rpathsUsed.append(framework.rpathUsed);
}
+ // To properly find all dependencies of the current framework / library further down in
+ // getQtFrameworks, we need to get its rpaths, resolve them in the context of its original
+ // location before it is copied, and add them as candidate rpaths.
+ //
+ // This is necessary to handle cases like
+ // (1) QtNetwork.framework -> (2) libbrotlidec.dylib -> (3) libbrotlicommon.1.dylib
+ // to correctly resolve the path to (3) when it is referenced as
+ // '@rpath/libbrotlicommon.1.dylib' and (2) has an LC_RPATH of '@loader_path/../lib', and
+ // no other absolute rpaths. So the '@loader_path/../lib' will be resolved relative
+ // to (2)'s original location and its LC_RPATH.
+ //
+ // Otherwise we'd only have the Qt prefix and the current bundle app dir as rpath
+ // candidates, and once (2) is copied into the app bundle, there's no way
+ // '@rpath/libbrotlicommon.1.dylib' could resolve to the real path on disk from the two
+ // candidates above.
+ if (!framework.sourceFilePath.isEmpty()) {
+ const QList<QString> sourceRPaths = getBinaryRPaths(framework.sourceFilePath, true);
+ for (const QString &sourceRPath : sourceRPaths) {
+ const QDir sourceRPathDir(sourceRPath);
+ if (sourceRPathDir.exists() && !rpathsUsed.contains(sourceRPath)) {
+ rpathsUsed.append(sourceRPath);
+ }
+ }
+ }
+
// Copy the framework/dylib to the app bundle.
const QString deployedBinaryPath = framework.isDylib ? copyDylib(framework, bundlePath)
: copyFramework(framework, bundlePath);
@@ -1032,7 +1057,7 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,
for (const FrameworkInfo &dependency : dependencies) {
if (dependency.rpathUsed.isEmpty()) {
changeInstallName(bundlePath, dependency, QStringList() << deployedBinaryPath, useLoaderPath);
- } else {
+ } else if (!rpathsUsed.contains(dependency.rpathUsed)) {
rpathsUsed.append(dependency.rpathUsed);
}
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index e23ed9f23ee..58a4115374e 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -259,7 +259,7 @@ public:
void setup(const QWizardLayoutInfo &info, const QString &title,
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
- QWizard::BannerSizePolicy bannerSizePolicy);
+ QWizard::BannerStretchPolicy bannerStretchPolicy);
protected:
void paintEvent(QPaintEvent *event) override;
@@ -273,7 +273,7 @@ private:
QLabel *logoLabel;
QGridLayout *layout;
QPixmap bannerPixmap;
- QWizard::BannerSizePolicy wizardBannerSizePolicy = QWizard::BannerSizePolicy::NoStretch;
+ QWizard::BannerStretchPolicy wizardBannerStretchPolicy = QWizard::BannerStretchPolicy::NoStretch;
};
QWizardHeader::QWizardHeader(QWidget *parent)
@@ -329,7 +329,7 @@ bool QWizardHeader::vistaDisabled() const
void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
- QWizard::BannerSizePolicy bannerSizePolicy)
+ QWizard::BannerStretchPolicy bannerStretchPolicy)
{
bool modern = ((info.wizStyle == QWizard::ModernStyle)
#if QT_CONFIG(style_windowsvista)
@@ -337,7 +337,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
#endif
);
- wizardBannerSizePolicy = bannerSizePolicy;
+ wizardBannerStretchPolicy = bannerStretchPolicy;
layout->setRowMinimumHeight(0, modern ? ModernHeaderTopMargin : 0);
layout->setRowMinimumHeight(1, modern ? info.topLevelMarginTop - ModernHeaderTopMargin - 1 : 0);
@@ -364,7 +364,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
bannerPixmap = QPixmap();
}
- if (bannerPixmap.isNull() || wizardBannerSizePolicy != QWizard::BannerSizePolicy::NoStretch) {
+ if (bannerPixmap.isNull() || wizardBannerStretchPolicy != QWizard::BannerStretchPolicy::NoStretch) {
/*
There is no widthForHeight() function, so we simulate it with a loop.
*/
@@ -392,12 +392,12 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
void QWizardHeader::paintEvent(QPaintEvent * /* event */)
{
QStylePainter painter(this);
- switch (wizardBannerSizePolicy) {
- case QWizard::BannerSizePolicy::Stretch:
+ switch (wizardBannerStretchPolicy) {
+ case QWizard::BannerStretchPolicy::Stretch:
painter.setRenderHint(QPainter::SmoothPixmapTransform);
painter.drawPixmap(0, 0, width(), height(), bannerPixmap);
break;
- case QWizard::BannerSizePolicy::NoStretch:
+ case QWizard::BannerStretchPolicy::NoStretch:
painter.drawPixmap(0, 0, bannerPixmap);
break;
}
@@ -582,7 +582,7 @@ public:
QList<QWizard::WizardButton> buttonsCustomLayout;
Qt::TextFormat titleFmt = Qt::AutoText;
Qt::TextFormat subTitleFmt = Qt::AutoText;
- QWizard::BannerSizePolicy bannerSizePolicy = QWizard::BannerSizePolicy::NoStretch;
+ QWizard::BannerStretchPolicy bannerStretchPolicy = QWizard::BannerStretchPolicy::NoStretch;
mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
union {
@@ -1238,7 +1238,7 @@ void QWizardPrivate::updateLayout()
Q_ASSERT(page);
headerWidget->setup(info, page->title(), page->subTitle(),
page->pixmap(QWizard::LogoPixmap), page->pixmap(QWizard::BannerPixmap),
- titleFmt, subTitleFmt, bannerSizePolicy);
+ titleFmt, subTitleFmt, bannerStretchPolicy);
}
if (info.watermark || info.sideWidget) {
@@ -2097,7 +2097,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
*/
/*!
- \enum QWizard::BannerSizePolicy
+ \enum QWizard::BannerStretchPolicy
This enum specifies the banner size policy when there is a banner.
@@ -2800,25 +2800,25 @@ Qt::TextFormat QWizard::subTitleFormat() const
}
/*!
- \property QWizard::bannerSizePolicy
+ \property QWizard::bannerStretchPolicy
\brief the banner size policy
The default policy is \l{QWizard::}{NoStretch}
*/
-void QWizard::setBannerSizePolicy(QWizard::BannerSizePolicy bannerSizePolicy)
+void QWizard::setBannerStretchPolicy(QWizard::BannerStretchPolicy bannerStretchPolicy)
{
Q_D(QWizard);
- if (d->bannerSizePolicy == bannerSizePolicy)
+ if (d->bannerStretchPolicy == bannerStretchPolicy)
return;
- d->bannerSizePolicy = bannerSizePolicy;
+ d->bannerStretchPolicy = bannerStretchPolicy;
d->updateLayout();
}
-QWizard::BannerSizePolicy QWizard::bannerSizePolicy() const
+QWizard::BannerStretchPolicy QWizard::bannerStretchPolicy() const
{
Q_D(const QWizard);
- return d->bannerSizePolicy;
+ return d->bannerStretchPolicy;
}
/*!
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 801fd7f4ef4..a421b3ecb40 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -25,7 +25,7 @@ class Q_WIDGETS_EXPORT QWizard : public QDialog
Q_PROPERTY(Qt::TextFormat subTitleFormat READ subTitleFormat WRITE setSubTitleFormat)
Q_PROPERTY(int startId READ startId WRITE setStartId)
Q_PROPERTY(int currentId READ currentId WRITE setCurrentId NOTIFY currentIdChanged)
- Q_PROPERTY(BannerSizePolicy bannerSizePolicy READ bannerSizePolicy WRITE setBannerSizePolicy REVISION(6, 11))
+ Q_PROPERTY(BannerStretchPolicy bannerStretchPolicy READ bannerStretchPolicy WRITE setBannerStretchPolicy REVISION(6, 11))
public:
enum WizardButton {
@@ -62,11 +62,11 @@ public:
};
Q_ENUM(WizardStyle)
- enum class BannerSizePolicy {
+ enum class BannerStretchPolicy {
NoStretch,
Stretch,
};
- Q_ENUM(BannerSizePolicy)
+ Q_ENUM(BannerStretchPolicy)
enum WizardOption {
IndependentPages = 0x00000001,
@@ -131,8 +131,8 @@ public:
Qt::TextFormat titleFormat() const;
void setSubTitleFormat(Qt::TextFormat format);
Qt::TextFormat subTitleFormat() const;
- void setBannerSizePolicy(BannerSizePolicy bannerSizePolicy);
- QWizard::BannerSizePolicy bannerSizePolicy() const;
+ void setBannerStretchPolicy(BannerStretchPolicy bannerStretchPolicy);
+ QWizard::BannerStretchPolicy bannerStretchPolicy() const;
void setPixmap(WizardPixmap which, const QPixmap &pixmap);
QPixmap pixmap(WizardPixmap which) const;
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 2c4b4e334d5..ac8e00af95e 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -5,6 +5,7 @@
#include "qlcdnumber.h"
#include "qbitarray.h"
+#include "qnumeric.h"
#include "qpainter.h"
#include "private/qframe_p.h"
@@ -110,22 +111,17 @@ public:
*/
-static QString int2string(int num, int base, int ndigits, bool *oflow)
+static QString int2string(int number, int base, int ndigits, bool *oflow)
{
QString s;
- bool negative;
- if (num < 0) {
- negative = true;
- num = -num;
- } else {
- negative = false;
- }
+ const bool negative = number < 0;
+ const uint num = QtPrivate::qUnsignedAbs(number);
switch(base) {
case QLCDNumber::Hex:
s = QString::asprintf("%*x", ndigits, num);
break;
case QLCDNumber::Dec:
- s = QString::asprintf("%*i", ndigits, num);
+ s = QString::asprintf("%*u", ndigits, num);
break;
case QLCDNumber::Oct:
s = QString::asprintf("%*o", ndigits, num);