diff --git a/src/core/text/qmsimplevarexp.cpp b/src/core/text/qmsimplevarexp.cpp index bae7875..9d9b213 100644 --- a/src/core/text/qmsimplevarexp.cpp +++ b/src/core/text/qmsimplevarexp.cpp @@ -110,7 +110,11 @@ static QString parseExpression(QString s, const QHash &vars, int lastIndex = 0; while ((index = s.indexOf(reg, index, &match)) != -1) { hasMatch = true; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(s).sliced(lastIndex, index - lastIndex); +#else result += s.midRef(lastIndex, index - lastIndex); +#endif const auto &name = match.captured(1); QString val; @@ -125,7 +129,11 @@ static QString parseExpression(QString s, const QHash &vars, index += match.captured(0).size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(s).sliced(lastIndex); +#else result += s.midRef(lastIndex); +#endif s = result; } while (hasMatch); s.replace(QStringLiteral("$$"), QStringLiteral("$")); diff --git a/src/widgets/kernel/qmdecoratorv2.cpp b/src/widgets/kernel/qmdecoratorv2.cpp index d99a8a6..95cce4a 100644 --- a/src/widgets/kernel/qmdecoratorv2.cpp +++ b/src/widgets/kernel/qmdecoratorv2.cpp @@ -557,10 +557,14 @@ QString QMDecoratorV2Private::replaceFontSizes(const QString &stylesheet, double QString result; result.reserve(stylesheet.size()); while ((index = stylesheet.indexOf(re, index, &match)) != -1) { - result += stylesheet.midRef(lastIndex, index - lastIndex); - QString matchString = match.captured(1); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex, index - lastIndex); + double size = QStringView(matchString).sliced(0, matchString.size() - 2).toDouble(); +#else + result += stylesheet.midRef(lastIndex, index - lastIndex); double size = matchString.midRef(0, matchString.size() - 2).toDouble(); +#endif size *= ratio; QString valueString = QStringLiteral("font-size: ") + (rounding ? QString::number(int(size)) : QString::number(size)) + @@ -569,7 +573,11 @@ QString QMDecoratorV2Private::replaceFontSizes(const QString &stylesheet, double index += match.captured().size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex); +#else result += stylesheet.midRef(lastIndex); +#endif return result; } @@ -582,10 +590,15 @@ QString QMDecoratorV2Private::replaceSizes(const QString &stylesheet, double rat QString result; result.reserve(stylesheet.size()); while ((index = stylesheet.indexOf(re, index, &match)) != -1) { - result += stylesheet.midRef(lastIndex, index - lastIndex); - QString matchString = match.captured(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex, index - lastIndex); + double size = QStringView(matchString).sliced(0, matchString.size() - 2).toDouble(); +#else + result += stylesheet.midRef(lastIndex, index - lastIndex); double size = matchString.midRef(0, matchString.size() - 2).toDouble(); +#endif + size *= ratio; QString valueString = (rounding ? QString::number(int(size)) : QString::number(size)) + QStringLiteral("px"); @@ -594,7 +607,11 @@ QString QMDecoratorV2Private::replaceSizes(const QString &stylesheet, double rat index += matchString.size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex); +#else result += stylesheet.midRef(lastIndex); +#endif return result; } @@ -610,7 +627,11 @@ QString QMDecoratorV2Private::replaceCustomKeyWithQProperty(const QString &style QString result; result.reserve(stylesheet.size()); while ((index = stylesheet.indexOf(re, index, &match)) != -1) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex, index - lastIndex); +#else result += stylesheet.midRef(lastIndex, index - lastIndex); +#endif QString matchString = match.captured(); int capturedIndex = match.capturedStart(2) - index; @@ -623,7 +644,11 @@ QString QMDecoratorV2Private::replaceCustomKeyWithQProperty(const QString &style index += matchString.size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex); +#else result += stylesheet.midRef(lastIndex); +#endif return result; } @@ -640,7 +665,11 @@ QString QMDecoratorV2Private::replaceCssGrammars(const QString &stylesheet) { int index = 0; int lastIndex = 0; while ((index = stylesheet.indexOf(re, index, &match)) != -1) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex, index - lastIndex); +#else result += stylesheet.midRef(lastIndex, index - lastIndex); +#endif QString matchString = match.captured(); QString valueString = QStringLiteral(":!") + match.captured(1).trimmed(); @@ -648,7 +677,11 @@ QString QMDecoratorV2Private::replaceCssGrammars(const QString &stylesheet) { index += matchString.size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex); +#else result += stylesheet.midRef(lastIndex); +#endif } // Replace "svg(...);" to "url(\"[[...]].svgx\");" @@ -671,12 +704,20 @@ QString QMDecoratorV2Private::removeAllComments(const QString &stylesheet) { QString result; result.reserve(stylesheet.size()); while ((index = stylesheet.indexOf(re, index, &match)) != -1) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex, index - lastIndex); +#else result += stylesheet.midRef(lastIndex, index - lastIndex); +#endif index += match.captured(0).size(); lastIndex = index; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + result += QStringView(stylesheet).sliced(lastIndex); +#else result += stylesheet.midRef(lastIndex); +#endif return result; } diff --git a/src/widgets/widgets/cmenu.cpp b/src/widgets/widgets/cmenu.cpp index 25aa03d..e7b3660 100644 --- a/src/widgets/widgets/cmenu.cpp +++ b/src/widgets/widgets/cmenu.cpp @@ -553,7 +553,7 @@ class CMenuPrivate : public QObject { DwmSetWindowAttribute(reinterpret_cast(this->q->winId()), DWMWA_WINDOW_CORNER_PREFERENCE_, &dwcp, sizeof(dwcp)); // Disconnect this connection, don't run again - disconnect(q, &CMenu::aboutToShow, this, &CMenuPrivate::_q_menuFirstAboutToShow); + // disconnect(q, &CMenu::aboutToShow, this, &CMenuPrivate::_q_menuFirstAboutToShow); } #endif }; diff --git a/src/widgets/widgettools/cnavframe.cpp b/src/widgets/widgettools/cnavframe.cpp index d92ffe7..15dd397 100644 --- a/src/widgets/widgettools/cnavframe.cpp +++ b/src/widgets/widgettools/cnavframe.cpp @@ -51,11 +51,9 @@ CNavFrame::CNavFrame(QWidget *parent) : QFrame(parent), d_ptr(new CNavFramePriva // Left d->buttonLayout = new QVBoxLayout(); - d->buttonLayout->setMargin(0); d->buttonLayout->setSpacing(0); d->leftLayout = new QVBoxLayout(); - d->leftLayout->setMargin(0); d->leftLayout->setSpacing(0); d->leftLayout->addLayout(d->buttonLayout); @@ -67,7 +65,6 @@ CNavFrame::CNavFrame(QWidget *parent) : QFrame(parent), d_ptr(new CNavFramePriva // Right d->stack = new QStackedLayout(); - d->stack->setMargin(0); d->rightFrame = new QFrame(); d->rightFrame->setObjectName("right-frame"); @@ -84,9 +81,20 @@ CNavFrame::CNavFrame(QWidget *parent) : QFrame(parent), d_ptr(new CNavFramePriva d->splitter->setStretchFactor(1, 1); d->layout = new QHBoxLayout(); - d->layout->setMargin(0); d->layout->setSpacing(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d->buttonLayout->setContentsMargins({}); + d->leftLayout->setContentsMargins({}); + d->stack->setContentsMargins({}); + d->layout->setContentsMargins({}); +#else + d->buttonLayout->setMargin(0); + d->leftLayout->setMargin(0); + d->stack->setMargin(0); + d->layout->setMargin(0); +#endif + d->layout->addWidget(d->splitter); setLayout(d->layout);