Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qqc2-desktop-style for openSUSE:Factory checked in at 2021-09-16 23:13:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qqc2-desktop-style (Old) and /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qqc2-desktop-style" Thu Sep 16 23:13:38 2021 rev:50 rq:918612 version:5.86.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qqc2-desktop-style/qqc2-desktop-style.changes 2021-08-16 10:12:41.199021019 +0200 +++ /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.1899/qqc2-desktop-style.changes 2021-09-16 23:15:19.627839032 +0200 @@ -1,0 +2,12 @@ +Mon Sep 6 06:22:25 UTC 2021 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 5.86.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.86.0 +- Too many changes since 5.85.0, only listing bugfixes: + * Fix combobox popup in RTL mode (kde#441178) + * Vertically center slider (kde#410672) + * ScrollBar: less scuffed implementation of reading from QStyle (kde#418327) + +------------------------------------------------------------------- Old: ---- qqc2-desktop-style-5.85.0.tar.xz qqc2-desktop-style-5.85.0.tar.xz.sig New: ---- qqc2-desktop-style-5.86.0.tar.xz qqc2-desktop-style-5.86.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qqc2-desktop-style.spec ++++++ --- /var/tmp/diff_new_pack.VXVJGI/_old 2021-09-16 23:15:20.119839541 +0200 +++ /var/tmp/diff_new_pack.VXVJGI/_new 2021-09-16 23:15:20.119839541 +0200 @@ -16,11 +16,11 @@ # -%define _tar_path 5.85 +%define _tar_path 5.86 # Only needed for the package signature condition %bcond_without lang Name: qqc2-desktop-style -Version: 5.85.0 +Version: 5.86.0 Release: 0 Summary: A Qt Quick Controls 2 Style for Desktop UIs License: GPL-2.0-or-later ++++++ qqc2-desktop-style-5.85.0.tar.xz -> qqc2-desktop-style-5.86.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/.git-blame-ignore-revs new/qqc2-desktop-style-5.86.0/.git-blame-ignore-revs --- old/qqc2-desktop-style-5.85.0/.git-blame-ignore-revs 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/.git-blame-ignore-revs 2021-09-04 17:50:59.000000000 +0200 @@ -1,3 +1,5 @@ #clang-format ab87ec5bc9be0aa5ff7e0e502be8ab8cca501c33 a9f1f13758e0b6bdec07cf33e55989a996c8c73b +#clang-tidy +2db0ba3c5e236bc68cadba96306787db6bf0eadb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/CMakeLists.txt new/qqc2-desktop-style-5.86.0/CMakeLists.txt --- old/qqc2-desktop-style-5.85.0/CMakeLists.txt 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/CMakeLists.txt 2021-09-04 17:50:59.000000000 +0200 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.16) -set(KF_VERSION "5.85.0") # handled by release scripts -set(KF_DEP_VERSION "5.85.0") # handled by release scripts +set(KF_VERSION "5.86.0") # handled by release scripts +set(KF_DEP_VERSION "5.86.0") # handled by release scripts project(qqc2-desktop-style VERSION ${KF_VERSION}) -set(REQUIRED_QT_VERSION 5.15.0) +set(REQUIRED_QT_VERSION 5.15.2) ################# Disallow in-source build ################# @@ -21,7 +21,7 @@ ################# set KDE specific information ################# -find_package(ECM 5.85.0 REQUIRED NO_MODULE) +find_package(ECM 5.86.0 REQUIRED NO_MODULE) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) @@ -109,7 +109,7 @@ SOVERSION 5) ######################################################################### -add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00) +add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f02) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055100) add_subdirectory(plugin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/CMakeLists.txt new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/CMakeLists.txt --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/CMakeLists.txt 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/CMakeLists.txt 2021-09-04 17:50:59.000000000 +0200 @@ -3,6 +3,7 @@ set(org.kde.desktop_SRCS plasmadesktoptheme.cpp kirigamiplasmafactory.cpp + plasmadesktopunits.cpp ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp 2021-09-04 17:50:59.000000000 +0200 @@ -6,9 +6,10 @@ #include "kirigamiplasmafactory.h" #include "plasmadesktoptheme.h" +#include "plasmadesktopunits.h" KirigamiPlasmaFactory::KirigamiPlasmaFactory(QObject *parent) - : Kirigami::KirigamiPluginFactory(parent) + : Kirigami::KirigamiPluginFactoryV2(parent) { } @@ -20,4 +21,10 @@ return new PlasmaDesktopTheme(parent); } +Kirigami::Units *KirigamiPlasmaFactory::createUnits(QObject *parent) +{ + Q_ASSERT(parent); + return new PlasmaDesktopUnits(parent); +} + #include "moc_kirigamiplasmafactory.cpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h 2021-09-04 17:50:59.000000000 +0200 @@ -10,7 +10,7 @@ #include <Kirigami2/KirigamiPluginFactory> #include <QObject> -class KirigamiPlasmaFactory : public Kirigami::KirigamiPluginFactory +class KirigamiPlasmaFactory : public Kirigami::KirigamiPluginFactoryV2 { Q_OBJECT @@ -23,6 +23,7 @@ ~KirigamiPlasmaFactory() override; Kirigami::PlatformTheme *createPlatformTheme(QObject *parent) override; + Kirigami::Units *createUnits(QObject *parent) override; }; #endif // KIRIGAMIPLASMAFACTORY_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp 2021-09-04 17:50:59.000000000 +0200 @@ -71,8 +71,9 @@ { const auto key = qMakePair(cs, group); auto it = m_cache.constFind(key); - if (it != m_cache.constEnd()) + if (it != m_cache.constEnd()) { return *it; + } using Kirigami::PlatformTheme; @@ -134,14 +135,14 @@ void notifyWatchersPaletteChange() { - for (auto watcher : qAsConst(watchers)) { + for (auto watcher : std::as_const(watchers)) { watcher->syncColors(); } } Q_SLOT void notifyWatchersConfigurationChange() { - for (auto watcher : qAsConst(watchers)) { + for (auto watcher : std::as_const(watchers)) { watcher->syncFont(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktopunits.cpp new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktopunits.cpp --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktopunits.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktopunits.cpp 2021-09-04 17:50:59.000000000 +0200 @@ -0,0 +1,51 @@ +/* + SPDX-FileCopyrightText: 2013 Marco Martin <m...@kde.org> + SPDX-FileCopyrightText: 2014 Sebastian K??gler <se...@kde.org> + SPDX-FileCopyrightText: 2014 David Edmundson <davidedmuns...@kde.org> + SPDX-FileCopyrightText: 2021 Jonah Br??chert <j...@kaidan.im> + + SPDX-License-Identifier: LGPL-2.0-or-later + +*/ + +#include "plasmadesktopunits.h" + +#include <KConfigGroup> +#include <KSharedConfig> + +constexpr int defaultLongDuration = 200; + +PlasmaDesktopUnits::PlasmaDesktopUnits(QObject *parent) + : Kirigami::Units(parent) + , m_animationSpeedWatcher(KConfigWatcher::create(KSharedConfig::openConfig())) +{ + connect(m_animationSpeedWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { + if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) { + updateAnimationSpeed(); + } + }); + + updateAnimationSpeed(); +} + +// Copy from plasma-framework/src/declarativeimports/core/units.cpp, since we don't want to depend on plasma-framework here +void PlasmaDesktopUnits::updateAnimationSpeed() +{ + KConfigGroup generalCfg = KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("KDE")); + const qreal animationSpeedModifier = qMax(0.0, generalCfg.readEntry("AnimationDurationFactor", 1.0)); + + // Read the old longDuration value for compatibility + KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("plasmarc")), QStringLiteral("Units")); + int longDuration = cfg.readEntry("longDuration", defaultLongDuration); + + longDuration = qRound(longDuration * animationSpeedModifier); + + // Animators with a duration of 0 do not fire reliably + // see Bug 357532 and QTBUG-39766 + longDuration = qMax(1, longDuration); + + setVeryShortDuration(longDuration / 4); + setShortDuration(longDuration / 2); + setLongDuration(longDuration); + setVeryLongDuration(longDuration * 2); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktopunits.h new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktopunits.h --- old/qqc2-desktop-style-5.85.0/kirigami-plasmadesktop-integration/plasmadesktopunits.h 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.86.0/kirigami-plasmadesktop-integration/plasmadesktopunits.h 2021-09-04 17:50:59.000000000 +0200 @@ -0,0 +1,29 @@ +/* + SPDX-FileCopyrightText: 2021 Jonah Br??chert <j...@kaidan.im> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KIRIGAMIPLASMADESKTOPUNITS_H +#define KIRIGAMIPLASMADESKTOPUNITS_H + +#include <QObject> + +#include <Units> + +#include <KConfigWatcher> + +class PlasmaDesktopUnits : public Kirigami::Units +{ + Q_OBJECT + +public: + explicit PlasmaDesktopUnits(QObject *parent = nullptr); + + void updateAnimationSpeed(); + +private: + KConfigWatcher::Ptr m_animationSpeedWatcher; +}; + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/metainfo.yaml new/qqc2-desktop-style-5.86.0/metainfo.yaml --- old/qqc2-desktop-style-5.85.0/metainfo.yaml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/metainfo.yaml 2021-09-04 17:50:59.000000000 +0200 @@ -7,7 +7,7 @@ - name: Linux - name: FreeBSD - name: Windows - - name: MacOSX + - name: macOS public_lib: true deprecated: false release: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/ComboBox.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/ComboBox.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/ComboBox.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/ComboBox.qml 2021-09-04 17:50:59.000000000 +0200 @@ -167,6 +167,9 @@ Controls.Overlay.modal: Item { } contentItem: ScrollView { + LayoutMirroring.enabled: controlRoot.mirrored + LayoutMirroring.childrenInherit: true + background: Rectangle { color: Kirigami.Theme.backgroundColor } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/Label.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/Label.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/Label.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/Label.qml 2021-09-04 17:50:59.000000000 +0200 @@ -15,6 +15,10 @@ T.Label { id: control + // Work around Qt bug where left aligned text is not right aligned + // in RTL mode unless horizontalAlignment is explicitly set. + // https://bugreports.qt.io/browse/QTBUG-95873 + horizontalAlignment: Text.AlignLeft verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter // Work around Qt bug where NativeRendering breaks for non-integer scale factors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/Menu.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/Menu.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/Menu.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/Menu.qml 2021-09-04 17:50:59.000000000 +0200 @@ -45,6 +45,18 @@ keyNavigationWraps: true ScrollBar.vertical: ScrollBar {} + + // mimic qtwidgets behaviour in regards to menu highlighting + Connections { + target: control.contentItem.currentItem + function onHoveredChanged() { + let currentItem = control.contentItem.currentItem + if (currentItem instanceof T.MenuItem && currentItem.highlighted + && !currentItem.subMenu && !currentItem.hovered) { + control.currentIndex = -1 + } + } + } } Connections { @@ -84,7 +96,7 @@ } background: Kirigami.ShadowedRectangle { - radius: 2 + radius: 3 implicitWidth: Kirigami.Units.gridUnit * 8 color: Kirigami.Theme.backgroundColor diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/MenuItem.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/MenuItem.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/MenuItem.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/MenuItem.qml 2021-09-04 17:50:59.000000000 +0200 @@ -26,8 +26,7 @@ Layout.fillWidth: true padding: Kirigami.Units.smallSpacing - leftPadding: Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing + verticalPadding: Math.floor(Kirigami.Units.smallSpacing * 1.5) hoverEnabled: !Kirigami.Settings.isMobile Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible @@ -55,9 +54,7 @@ visible: (controlRoot.ListView.view && controlRoot.ListView.view.hasIcons) || (controlRoot.icon != undefined && (controlRoot.icon.name.length > 0 || controlRoot.icon.source.length > 0)) source: controlRoot.icon ? (controlRoot.icon.name || controlRoot.icon.source) : "" color: controlRoot.icon ? controlRoot.icon.color : "transparent" - //hovered is for retrocompatibility - selected: (controlRoot.highlighted || controlRoot.hovered) - Layout.preferredHeight: Math.max(Kirigami.Units.fontMetrics.roundedIconSize(label.height), Kirigami.Units.iconSizes.small) + Layout.preferredHeight: Math.max(Kirigami.Units.iconSizes.roundedIconSize(label.height), Kirigami.Units.iconSizes.small) Layout.preferredWidth: Layout.preferredHeight } Label { @@ -67,7 +64,7 @@ text: controlRoot.Kirigami.MnemonicData.richTextLabel font: controlRoot.font - color: (controlRoot.highlighted || controlRoot.hovered) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + color: Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft @@ -99,7 +96,7 @@ y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 source: controlRoot.mirrored ? "go-next-symbolic-rtl" : "go-next-symbolic" selected: controlRoot.highlighted - width: Math.max(Kirigami.Units.fontMetrics.roundedIconSize(label.height), Kirigami.Units.iconSizes.small) + width: Math.max(Kirigami.Units.iconSizes.roundedIconSize(label.height), Kirigami.Units.iconSizes.small) height: width visible: controlRoot.subMenu } @@ -121,8 +118,12 @@ Rectangle { anchors.fill: parent - color: Kirigami.Theme.highlightColor + anchors.margins: 2 opacity: (controlRoot.highlighted || controlRoot.hovered) ? 1 : 0 + color: Qt.rgba(Kirigami.Theme.focusColor.r, Kirigami.Theme.focusColor.g, Kirigami.Theme.focusColor.b, 0.3) + border.color: Kirigami.Theme.focusColor + border.width: 1 + radius: 3 } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/ScrollBar.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/ScrollBar.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/ScrollBar.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/ScrollBar.qml 2021-09-04 17:50:59.000000000 +0200 @@ -24,6 +24,11 @@ stepSize: 0.02 interactive: !Kirigami.Settings.hasTransientTouchInput + topPadding: style.topScrollbarPadding + bottomPadding: style.bottomScrollbarPadding + leftPadding: style.leftScrollbarPadding + rightPadding: style.rightScrollbarPadding + onPositionChanged: { disappearTimer.restart(); handleGraphics.handleState = Math.min(1, handleGraphics.handleState + 0.1) @@ -140,6 +145,19 @@ id: style readonly property real length: (controlRoot.orientation == Qt.Vertical ? height : width) + property rect grooveRect: Qt.rect(0, 0, 0, 0) + readonly property real topScrollbarPadding: grooveRect.top + readonly property real bottomScrollbarPadding: style.height - grooveRect.bottom + readonly property real leftScrollbarPadding: grooveRect.left + readonly property real rightScrollbarPadding: style.width - grooveRect.right + + Component.onCompleted: computeRects() + onWidthChanged: computeRects() + onHeightChanged: computeRects() + + function computeRects() { + style.grooveRect = style.subControlRect("groove") + } control: controlRoot anchors.fill: parent diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/Slider.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/Slider.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/Slider.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/Slider.qml 2021-09-04 17:50:59.000000000 +0200 @@ -22,7 +22,9 @@ hoverEnabled: true LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft - handle: Item {} + handle: Item { + anchors.verticalCenter: controlRoot.verticalCenter + } snapMode: T.Slider.SnapOnRelease @@ -33,6 +35,7 @@ implicitWidth: 200 contentWidth: horizontal ? controlRoot.implicitWidth : 22 contentHeight: horizontal ? 22 : controlRoot.implicitHeight + anchors.verticalCenter: controlRoot.verticalCenter maximum: controlRoot.to*100 minimum: controlRoot.from*100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/org.kde.desktop/SpinBox.qml new/qqc2-desktop-style-5.86.0/org.kde.desktop/SpinBox.qml --- old/qqc2-desktop-style-5.85.0/org.kde.desktop/SpinBox.qml 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/org.kde.desktop/SpinBox.qml 2021-09-04 17:50:59.000000000 +0200 @@ -18,12 +18,15 @@ Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false - implicitWidth: Math.max(48, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth) - implicitHeight: Math.max(background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) + implicitWidth: Math.max(styleitem.fullRect.width, 48, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth + down.indicator.implicitWidth) + implicitHeight: Math.max(styleitem.fullRect.height, background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) padding: 6 - leftPadding: padding + (controlRoot.mirrored ? (up.indicator ? up.indicator.width : 0) : 0) - rightPadding: padding + (controlRoot.mirrored ? 0 : (up.indicator ? up.indicator.width : 0)) + leftPadding: controlRoot.mirrored ? ___rPadding : ___lPadding + rightPadding: controlRoot.mirrored ? ___lPadding : ___rPadding + + readonly property int ___lPadding: styleitem.upRect.x === styleitem.downRect.x ? horizontalPadding : styleitem.upRect.width + readonly property int ___rPadding: styleitem.upRect.x === styleitem.downRect.x ? styleitem.upRect.width : styleitem.downRect.width hoverEnabled: true @@ -97,16 +100,18 @@ } up.indicator: Item { - implicitWidth: parent.height/2 - implicitHeight: implicitWidth - x: controlRoot.mirrored ? 0 : parent.width - width + implicitWidth: styleitem.upRect.width + implicitHeight: styleitem.upRect.height + + x: styleitem.upRect.x + y: styleitem.upRect.y } down.indicator: Item { - implicitWidth: parent.height/2 - implicitHeight: implicitWidth + implicitWidth: styleitem.downRect.width + implicitHeight: styleitem.downRect.height - x: controlRoot.mirrored ? 0 : parent.width - width - y: parent.height - height + x: styleitem.downRect.x + y: styleitem.downRect.y } @@ -119,6 +124,23 @@ hasFocus: controlRoot.activeFocus enabled: controlRoot.enabled + property rect upRect: styleitem.subControlRect("up") + property rect downRect: styleitem.subControlRect("down") + property rect editRect: styleitem.subControlRect("edit") + property rect fullRect: styleitem.computeBoundingRect([upRect, downRect, editRect]) + property size theSize: styleitem.sizeFromContents(editRect.width, editRect.height) + + function recompute() { + upRect = styleitem.subControlRect("up") + downRect = styleitem.subControlRect("down") + editRect = styleitem.subControlRect("edit") + fullRect = styleitem.computeBoundingRect([upRect, downRect, editRect]) + theSize = styleitem.sizeFromContents(editRect.width, editRect.height) + } + + onWidthChanged: recompute() + onHeightChanged: recompute() + value: (controlRoot.up.pressed ? 1 : 0) | (controlRoot.down.pressed ? 1<<1 : 0) | ( controlRoot.value != controlRoot.to ? (1<<2) : 0) | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/plugin/kquickstyleitem.cpp new/qqc2-desktop-style-5.86.0/plugin/kquickstyleitem.cpp --- old/qqc2-desktop-style-5.85.0/plugin/kquickstyleitem.cpp 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/plugin/kquickstyleitem.cpp 2021-09-04 17:50:59.000000000 +0200 @@ -115,38 +115,39 @@ KQuickStyleItem::~KQuickStyleItem() { - if (const QStyleOptionButton *aux = qstyleoption_cast<const QStyleOptionButton *>(m_styleoption)) + if (const QStyleOptionButton *aux = qstyleoption_cast<const QStyleOptionButton *>(m_styleoption)) { delete aux; - else if (const QStyleOptionViewItem *aux = qstyleoption_cast<const QStyleOptionViewItem *>(m_styleoption)) + } else if (const QStyleOptionViewItem *aux = qstyleoption_cast<const QStyleOptionViewItem *>(m_styleoption)) { delete aux; - else if (const QStyleOptionHeader *aux = qstyleoption_cast<const QStyleOptionHeader *>(m_styleoption)) + } else if (const QStyleOptionHeader *aux = qstyleoption_cast<const QStyleOptionHeader *>(m_styleoption)) { delete aux; - else if (const QStyleOptionToolButton *aux = qstyleoption_cast<const QStyleOptionToolButton *>(m_styleoption)) + } else if (const QStyleOptionToolButton *aux = qstyleoption_cast<const QStyleOptionToolButton *>(m_styleoption)) { delete aux; - else if (const QStyleOptionToolBar *aux = qstyleoption_cast<const QStyleOptionToolBar *>(m_styleoption)) + } else if (const QStyleOptionToolBar *aux = qstyleoption_cast<const QStyleOptionToolBar *>(m_styleoption)) { delete aux; - else if (const QStyleOptionTab *aux = qstyleoption_cast<const QStyleOptionTab *>(m_styleoption)) + } else if (const QStyleOptionTab *aux = qstyleoption_cast<const QStyleOptionTab *>(m_styleoption)) { delete aux; - else if (const QStyleOptionFrame *aux = qstyleoption_cast<const QStyleOptionFrame *>(m_styleoption)) + } else if (const QStyleOptionFrame *aux = qstyleoption_cast<const QStyleOptionFrame *>(m_styleoption)) { delete aux; - else if (const QStyleOptionFocusRect *aux = qstyleoption_cast<const QStyleOptionFocusRect *>(m_styleoption)) + } else if (const QStyleOptionFocusRect *aux = qstyleoption_cast<const QStyleOptionFocusRect *>(m_styleoption)) { delete aux; - else if (const QStyleOptionTabWidgetFrame *aux = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(m_styleoption)) + } else if (const QStyleOptionTabWidgetFrame *aux = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(m_styleoption)) { delete aux; - else if (const QStyleOptionMenuItem *aux = qstyleoption_cast<const QStyleOptionMenuItem *>(m_styleoption)) + } else if (const QStyleOptionMenuItem *aux = qstyleoption_cast<const QStyleOptionMenuItem *>(m_styleoption)) { delete aux; - else if (const QStyleOptionComboBox *aux = qstyleoption_cast<const QStyleOptionComboBox *>(m_styleoption)) + } else if (const QStyleOptionComboBox *aux = qstyleoption_cast<const QStyleOptionComboBox *>(m_styleoption)) { delete aux; - else if (const QStyleOptionSpinBox *aux = qstyleoption_cast<const QStyleOptionSpinBox *>(m_styleoption)) + } else if (const QStyleOptionSpinBox *aux = qstyleoption_cast<const QStyleOptionSpinBox *>(m_styleoption)) { delete aux; - else if (const QStyleOptionSlider *aux = qstyleoption_cast<const QStyleOptionSlider *>(m_styleoption)) + } else if (const QStyleOptionSlider *aux = qstyleoption_cast<const QStyleOptionSlider *>(m_styleoption)) { delete aux; - else if (const QStyleOptionProgressBar *aux = qstyleoption_cast<const QStyleOptionProgressBar *>(m_styleoption)) + } else if (const QStyleOptionProgressBar *aux = qstyleoption_cast<const QStyleOptionProgressBar *>(m_styleoption)) { delete aux; - else if (const QStyleOptionGroupBox *aux = qstyleoption_cast<const QStyleOptionGroupBox *>(m_styleoption)) + } else if (const QStyleOptionGroupBox *aux = qstyleoption_cast<const QStyleOptionGroupBox *>(m_styleoption)) { delete aux; - else + } else { delete m_styleoption; + } m_styleoption = nullptr; } @@ -165,8 +166,9 @@ } Q_ASSERT(m_theme); - if (m_styleoption) + if (m_styleoption) { m_styleoption->state = {}; + } QString sizeHint = m_hints.value(QStringLiteral("size")).toString(); @@ -174,8 +176,9 @@ switch (m_itemType) { case Button: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionButton(); + } QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton *>(m_styleoption); opt->text = text(); @@ -206,13 +209,15 @@ break; } case ItemRow: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionViewItem(); + } QStyleOptionViewItem *opt = qstyleoption_cast<QStyleOptionViewItem *>(m_styleoption); opt->features = {}; - if (activeControl() == QLatin1String("alternate")) + if (activeControl() == QLatin1String("alternate")) { opt->features |= QStyleOptionViewItem::Alternate; + } break; } @@ -244,22 +249,28 @@ break; } case ItemBranchIndicator: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOption; + } - if (m_properties.value(QStringLiteral("isItem")).toBool()) + if (m_properties.value(QStringLiteral("isItem")).toBool()) { m_styleoption->state = QStyle::State_Item; - if (m_properties.value(QStringLiteral("hasChildren")).toBool()) + } + if (m_properties.value(QStringLiteral("hasChildren")).toBool()) { m_styleoption->state |= QStyle::State_Children; - if (m_properties.value(QStringLiteral("hasSibling")).toBool()) // Even this one could go away + } + if (m_properties.value(QStringLiteral("hasSibling")).toBool()) { // Even this one could go away m_styleoption->state |= QStyle::State_Sibling; - if (m_on) + } + if (m_on) { m_styleoption->state |= QStyle::State_Open; + } break; } case Header: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionHeader(); + } QStyleOptionHeader *opt = qstyleoption_cast<QStyleOptionHeader *>(m_styleoption); opt->text = text(); @@ -268,22 +279,24 @@ : activeControl() == QLatin1String("up") ? QStyleOptionHeader::SortUp : QStyleOptionHeader::None; QString headerpos = m_properties.value(QStringLiteral("headerpos")).toString(); - if (headerpos == QLatin1String("beginning")) + if (headerpos == QLatin1String("beginning")) { opt->position = QStyleOptionHeader::Beginning; - else if (headerpos == QLatin1String("end")) + } else if (headerpos == QLatin1String("end")) { opt->position = QStyleOptionHeader::End; - else if (headerpos == QLatin1String("only")) + } else if (headerpos == QLatin1String("only")) { opt->position = QStyleOptionHeader::OnlyOneSection; - else + } else { opt->position = QStyleOptionHeader::Middle; + } const QFont font = qApp->font("QHeaderView"); opt->fontMetrics = QFontMetrics(font); break; } case ToolButton: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionToolButton(); + } QStyleOptionToolButton *opt = qstyleoption_cast<QStyleOptionToolButton *>(m_styleoption); opt->subControls = QStyle::SC_ToolButton; @@ -334,47 +347,53 @@ break; } case ToolBar: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionToolBar(); + } break; } case Tab: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionTab(); + } QStyleOptionTab *opt = qstyleoption_cast<QStyleOptionTab *>(m_styleoption); opt->text = text(); - if (m_properties.value(QStringLiteral("hasFrame")).toBool()) + if (m_properties.value(QStringLiteral("hasFrame")).toBool()) { opt->features |= QStyleOptionTab::HasFrame; + } QString orientation = m_properties.value(QStringLiteral("orientation")).toString(); QString position = m_properties.value(QStringLiteral("tabpos")).toString(); QString selectedPosition = m_properties.value(QStringLiteral("selectedpos")).toString(); opt->shape = orientation == QLatin1String("Bottom") ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; - if (position == QLatin1String("beginning")) + if (position == QLatin1String("beginning")) { opt->position = QStyleOptionTab::Beginning; - else if (position == QLatin1String("end")) + } else if (position == QLatin1String("end")) { opt->position = QStyleOptionTab::End; - else if (position == QLatin1String("only")) + } else if (position == QLatin1String("only")) { opt->position = QStyleOptionTab::OnlyOneTab; - else + } else { opt->position = QStyleOptionTab::Middle; + } - if (selectedPosition == QLatin1String("next")) + if (selectedPosition == QLatin1String("next")) { opt->selectedPosition = QStyleOptionTab::NextIsSelected; - else if (selectedPosition == QLatin1String("previous")) + } else if (selectedPosition == QLatin1String("previous")) { opt->selectedPosition = QStyleOptionTab::PreviousIsSelected; - else + } else { opt->selectedPosition = QStyleOptionTab::NotAdjacent; + } break; } case Frame: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionFrame(); + } QStyleOptionFrame *opt = qstyleoption_cast<QStyleOptionFrame *>(m_styleoption); opt->frameShape = QFrame::StyledPanel; @@ -383,21 +402,24 @@ break; } case FocusRect: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionFocusRect(); + } // Needed on windows m_styleoption->state |= QStyle::State_KeyboardFocusChange; break; } case TabFrame: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionTabWidgetFrame(); + } QStyleOptionTabWidgetFrame *opt = qstyleoption_cast<QStyleOptionTabWidgetFrame *>(m_styleoption); opt->selectedTabRect = m_properties[QStringLiteral("selectedTabRect")].toRect(); opt->shape = m_properties[QStringLiteral("orientation")] == Qt::BottomEdge ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; - if (minimum()) + if (minimum()) { opt->selectedTabRect = QRect(value(), 0, minimum(), height()); + } opt->tabBarSize = QSize(minimum(), height()); // oxygen style needs this hack opt->leftCornerWidgetSize = QSize(value(), 0); @@ -412,8 +434,9 @@ break; case MenuBarItem: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionMenuItem(); + } QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem *>(m_styleoption); opt->text = text(); @@ -427,14 +450,16 @@ break; } case Menu: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionMenuItem(); + } break; } case MenuItem: case ComboBoxItem: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionMenuItem(); + } QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem *>(m_styleoption); // For GTK style. See below, in setElementType() @@ -479,14 +504,17 @@ } case CheckBox: case RadioButton: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionButton(); + } QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton *>(m_styleoption); - if (!on()) + if (!on()) { opt->state |= QStyle::State_Off; - if (m_properties.value(QStringLiteral("partiallyChecked")).toBool()) + } + if (m_properties.value(QStringLiteral("partiallyChecked")).toBool()) { opt->state |= QStyle::State_NoChange; + } opt->text = text(); opt->icon = iconFromIconProperty(); @@ -505,16 +533,18 @@ break; } case Edit: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionFrame(); + } QStyleOptionFrame *opt = qstyleoption_cast<QStyleOptionFrame *>(m_styleoption); opt->lineWidth = qMax(1, KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr)); // this must be non zero break; } case ComboBox: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionComboBox(); + } QStyleOptionComboBox *opt = qstyleoption_cast<QStyleOptionComboBox *>(m_styleoption); @@ -543,28 +573,33 @@ break; } case SpinBox: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionSpinBox(); + } QStyleOptionSpinBox *opt = qstyleoption_cast<QStyleOptionSpinBox *>(m_styleoption); opt->frame = true; opt->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; - if (value() & 0x1) + if (value() & 0x1) { opt->activeSubControls = QStyle::SC_SpinBoxUp; - else if (value() & (1 << 1)) + } else if (value() & (1 << 1)) { opt->activeSubControls = QStyle::SC_SpinBoxDown; + } opt->subControls = QStyle::SC_All; opt->stepEnabled = {}; - if (value() & (1 << 2)) + if (value() & (1 << 2)) { opt->stepEnabled |= QAbstractSpinBox::StepUpEnabled; - if (value() & (1 << 3)) + } + if (value() & (1 << 3)) { opt->stepEnabled |= QAbstractSpinBox::StepDownEnabled; + } break; } case Slider: case Dial: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionSlider(); + } QStyleOptionSlider *opt = qstyleoption_cast<QStyleOptionSlider *>(m_styleoption); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; @@ -582,26 +617,30 @@ qreal numOfSteps = (opt->maximum - opt->minimum) / opt->singleStep; // at least 5 pixels between tick marks qreal extent = horizontal() ? width() : height(); - if (numOfSteps && (extent / numOfSteps < 5)) + if (numOfSteps && (extent / numOfSteps < 5)) { opt->tickInterval = qRound((5 * numOfSteps / extent) + 0.5) * step(); - else + } else { opt->tickInterval = opt->singleStep; + } - } else // default Qt-components implementation + } else { // default Qt-components implementation opt->tickInterval = opt->maximum != opt->minimum ? 1200 / (opt->maximum - opt->minimum) : 0; + } opt->sliderValue = value(); opt->subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle; opt->tickPosition = activeControl() == QLatin1String("ticks") ? QSlider::TicksBelow : QSlider::NoTicks; - if (opt->tickPosition != QSlider::NoTicks) + if (opt->tickPosition != QSlider::NoTicks) { opt->subControls |= QStyle::SC_SliderTickmarks; + } opt->activeSubControls = QStyle::SC_SliderHandle; break; } case ProgressBar: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionProgressBar(); + } QStyleOptionProgressBar *opt = qstyleoption_cast<QStyleOptionProgressBar *>(m_styleoption); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; @@ -611,8 +650,9 @@ break; } case GroupBox: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionGroupBox(); + } QStyleOptionGroupBox *opt = qstyleoption_cast<QStyleOptionGroupBox *>(m_styleoption); opt->text = text(); @@ -624,14 +664,16 @@ } else { opt->features |= QStyleOptionFrame::Flat; } - if (m_properties[QStringLiteral("checkable")].toBool()) + if (m_properties[QStringLiteral("checkable")].toBool()) { opt->subControls |= QStyle::SC_GroupBoxCheckBox; + } break; } case ScrollBar: { - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOptionSlider(); + } QStyleOptionSlider *opt = qstyleoption_cast<QStyleOptionSlider *>(m_styleoption); opt->minimum = qMax(0, minimum()); @@ -645,8 +687,9 @@ : (activeControl() == QLatin1String("handle")) ? QStyle::SC_ScrollBarSlider : hover() ? QStyle::SC_ScrollBarGroove : QStyle::SC_None; - if (raised()) + if (raised()) { opt->state |= QStyle::State_On; + } opt->sliderValue = value(); opt->subControls = QStyle::SC_All; @@ -658,11 +701,13 @@ break; } - if (!m_styleoption) + if (!m_styleoption) { m_styleoption = new QStyleOption(); + } - if (needsResolvePalette) + if (needsResolvePalette) { resolvePalette(); + } m_styleoption->styleObject = this; m_styleoption->direction = qApp->layoutDirection(); @@ -685,20 +730,27 @@ m_styleoption->palette.setCurrentColorGroup(QPalette::Inactive); } - if (m_sunken) + if (m_sunken) { m_styleoption->state |= QStyle::State_Sunken; - if (!m_sunken || m_raised) + } + if (!m_sunken || m_raised) { m_styleoption->state |= QStyle::State_Raised; - if (m_selected) + } + if (m_selected) { m_styleoption->state |= QStyle::State_Selected; - if (m_focus) + } + if (m_focus) { m_styleoption->state |= QStyle::State_HasFocus; - if (m_on) + } + if (m_on) { m_styleoption->state |= QStyle::State_On; - if (m_hover) + } + if (m_hover) { m_styleoption->state |= QStyle::State_MouseOver; - if (m_horizontal) + } + if (m_horizontal) { m_styleoption->state |= QStyle::State_Horizontal; + } // some styles don't draw a focus rectangle if // QStyle::State_KeyboardFocusChange is not set @@ -788,8 +840,9 @@ void KQuickStyleItem::resolvePalette() { - if (QCoreApplication::testAttribute(Qt::AA_SetPalette)) + if (QCoreApplication::testAttribute(Qt::AA_SetPalette)) { return; + } const QVariant controlPalette = m_control ? m_control->property("palette") : QVariant(); if (controlPalette.isValid()) { @@ -861,10 +914,12 @@ { QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); style = style.toLower(); - if (style.startsWith(QLatin1Char('q'))) + if (style.startsWith(QLatin1Char('q'))) { style = style.right(style.length() - 1); - if (style.endsWith(QLatin1String("style"))) + } + if (style.endsWith(QLatin1String("style"))) { style = style.left(style.length() - 5); + } return style; } @@ -877,10 +932,11 @@ qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), QPoint(px, py), nullptr); - if (subcontrol == QStyle::SC_SpinBoxUp) + if (subcontrol == QStyle::SC_SpinBoxUp) { return QStringLiteral("up"); - else if (subcontrol == QStyle::SC_SpinBoxDown) + } else if (subcontrol == QStyle::SC_SpinBoxDown) { return QStringLiteral("down"); + } break; } @@ -889,8 +945,9 @@ qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), QPoint(px, py), nullptr); - if (subcontrol == QStyle::SC_SliderHandle) + if (subcontrol == QStyle::SC_SliderHandle) { return QStringLiteral("handle"); + } break; } @@ -927,6 +984,17 @@ return QStringLiteral("none"); } +QRect KQuickStyleItem::computeBoundingRect(const QList<QRect> &rects) +{ + QRegion r; + + for (const auto& rect : rects) { + r = r.united(rect); + } + + return r.boundingRect(); +} + QSize KQuickStyleItem::sizeFromContents(int width, int height) { initStyleOption(); @@ -965,12 +1033,14 @@ textSize.setWidth(textSize.width() + btn->fontMetrics.horizontalAdvance(QLatin1Char(' ')) * 2); if (btn->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { h += 4 + textSize.height(); - if (textSize.width() > w) + if (textSize.width() > w) { w = textSize.width(); + } } else if (btn->toolButtonStyle == Qt::ToolButtonTextBesideIcon) { w += 4 + textSize.width(); - if (textSize.height() > h) + if (textSize.height() > h) { h = textSize.height(); + } } else { // TextOnly w = textSize.width(); h = textSize.height(); @@ -1113,8 +1183,9 @@ case ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(m_styleoption)) { r = KQuickStyleItem::style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField); - if (styleName() != QLatin1String("mac")) + if (styleName() != QLatin1String("mac")) { r.adjust(0, 0, 0, 1); + } } break; case SpinBox: @@ -1129,8 +1200,9 @@ if (r.height() > 0) { const QFontMetrics &fm = m_styleoption->fontMetrics; int surplus = r.height() - fm.height(); - if ((surplus & 1) && ceilResult) + if ((surplus & 1) && ceilResult) { surplus++; + } int result = r.top() + surplus / 2 + fm.ascent(); return result; } @@ -1141,8 +1213,9 @@ void KQuickStyleItem::updateBaselineOffset() { const qreal baseline = baselineOffset(); - if (baseline > 0) + if (baseline > 0) { setBaselineOffset(baseline); + } } void KQuickStyleItem::setContentWidth(int arg) @@ -1176,66 +1249,67 @@ int KQuickStyleItem::pixelMetric(const QString &metric) { - if (metric == QLatin1String("scrollbarExtent")) + if (metric == QLatin1String("scrollbarExtent")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); - else if (metric == QLatin1String("defaultframewidth")) + } else if (metric == QLatin1String("defaultframewidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); - else if (metric == QLatin1String("taboverlap")) + } else if (metric == QLatin1String("taboverlap")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); - else if (metric == QLatin1String("tabbaseoverlap")) + } else if (metric == QLatin1String("tabbaseoverlap")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); - else if (metric == QLatin1String("tabhspace")) + } else if (metric == QLatin1String("tabhspace")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); - else if (metric == QLatin1String("indicatorwidth")) + } else if (metric == QLatin1String("indicatorwidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth, nullptr); - else if (metric == QLatin1String("exclusiveindicatorwidth")) + } else if (metric == QLatin1String("exclusiveindicatorwidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); - else if (metric == QLatin1String("checkboxlabelspacing")) + } else if (metric == QLatin1String("checkboxlabelspacing")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, nullptr); - else if (metric == QLatin1String("radiobuttonlabelspacing")) + } else if (metric == QLatin1String("radiobuttonlabelspacing")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_RadioButtonLabelSpacing, nullptr); - else if (metric == QLatin1String("tabvspace")) + } else if (metric == QLatin1String("tabvspace")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); - else if (metric == QLatin1String("tabbaseheight")) + } else if (metric == QLatin1String("tabbaseheight")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); - else if (metric == QLatin1String("tabvshift")) + } else if (metric == QLatin1String("tabvshift")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); - else if (metric == QLatin1String("menubarhmargin")) + } else if (metric == QLatin1String("menubarhmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); - else if (metric == QLatin1String("menubarvmargin")) + } else if (metric == QLatin1String("menubarvmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); - else if (metric == QLatin1String("menubarpanelwidth")) + } else if (metric == QLatin1String("menubarpanelwidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); - else if (metric == QLatin1String("menubaritemspacing")) + } else if (metric == QLatin1String("menubaritemspacing")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); - else if (metric == QLatin1String("spacebelowmenubar")) + } else if (metric == QLatin1String("spacebelowmenubar")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); - else if (metric == QLatin1String("menuhmargin")) + } else if (metric == QLatin1String("menuhmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); - else if (metric == QLatin1String("menuvmargin")) + } else if (metric == QLatin1String("menuvmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); - else if (metric == QLatin1String("menupanelwidth")) + } else if (metric == QLatin1String("menupanelwidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); - else if (metric == QLatin1String("submenuoverlap")) + } else if (metric == QLatin1String("submenuoverlap")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); - else if (metric == QLatin1String("splitterwidth")) + } else if (metric == QLatin1String("splitterwidth")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); - else if (metric == QLatin1String("scrollbarspacing")) + } else if (metric == QLatin1String("scrollbarspacing")) { return abs(KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); - else if (metric == QLatin1String("treeviewindentation")) + } else if (metric == QLatin1String("treeviewindentation")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); - else if (metric == QLatin1String("layouthorizontalspacing")) + } else if (metric == QLatin1String("layouthorizontalspacing")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, nullptr); - else if (metric == QLatin1String("layoutverticalspacing")) + } else if (metric == QLatin1String("layoutverticalspacing")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr); - else if (metric == QLatin1String("layoutleftmargin")) + } else if (metric == QLatin1String("layoutleftmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr); - else if (metric == QLatin1String("layouttopmargin")) + } else if (metric == QLatin1String("layouttopmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr); - else if (metric == QLatin1String("layoutrightmargin")) + } else if (metric == QLatin1String("layoutrightmargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr); - else if (metric == QLatin1String("layoutbottommargin")) + } else if (metric == QLatin1String("layoutbottommargin")) { return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr); + } return 0; } @@ -1254,19 +1328,21 @@ return KQuickStyleItem::style()->styleHint(QStyle::SH_FocusFrame_AboveWidget); } else if (metric == QLatin1String("tabbaralignment")) { int result = KQuickStyleItem::style()->styleHint(QStyle::SH_TabBar_Alignment); - if (result == Qt::AlignCenter) + if (result == Qt::AlignCenter) { return QStringLiteral("center"); + } return QStringLiteral("left"); } else if (metric == QLatin1String("externalScrollBars")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); - } else if (metric == QLatin1String("scrollToClickPosition")) + } else if (metric == QLatin1String("scrollToClickPosition")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition); - else if (metric == QLatin1String("activateItemOnSingleClick")) + } else if (metric == QLatin1String("activateItemOnSingleClick")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); - else if (metric == QLatin1String("submenupopupdelay")) + } else if (metric == QLatin1String("submenupopupdelay")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); - else if (metric == QLatin1String("wheelScrollLines")) + } else if (metric == QLatin1String("wheelScrollLines")) { return qApp->wheelScrollLines(); + } return 0; // Add SH_Menu_SpaceActivatesItem @@ -1297,8 +1373,9 @@ void KQuickStyleItem::setElementType(const QString &str) { - if (m_type == str) + if (m_type == str) { return; + } m_type = str; @@ -1393,11 +1470,11 @@ switch (m_itemType) { case SpinBox: { QStyle::ComplexControl control = QStyle::CC_SpinBox; - if (subcontrolString == QLatin1String("down")) + if (subcontrolString == QLatin1String("down")) { subcontrol = QStyle::SC_SpinBoxDown; - else if (subcontrolString == QLatin1String("up")) + } else if (subcontrolString == QLatin1String("up")) { subcontrol = QStyle::SC_SpinBoxUp; - else if (subcontrolString == QLatin1String("edit")) { + } else if (subcontrolString == QLatin1String("edit")) { subcontrol = QStyle::SC_SpinBoxEditField; } return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), subcontrol); @@ -1406,26 +1483,29 @@ } case Slider: { QStyle::ComplexControl control = QStyle::CC_Slider; - if (subcontrolString == QLatin1String("handle")) + if (subcontrolString == QLatin1String("handle")) { subcontrol = QStyle::SC_SliderHandle; - else if (subcontrolString == QLatin1String("groove")) + } else if (subcontrolString == QLatin1String("groove")) { subcontrol = QStyle::SC_SliderGroove; + } return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), subcontrol); break; } case ScrollBar: { QStyle::ComplexControl control = QStyle::CC_ScrollBar; - if (subcontrolString == QLatin1String("slider")) + if (subcontrolString == QLatin1String("slider")) { subcontrol = QStyle::SC_ScrollBarSlider; - if (subcontrolString == QLatin1String("groove")) + } + if (subcontrolString == QLatin1String("groove")) { subcontrol = QStyle::SC_ScrollBarGroove; - else if (subcontrolString == QLatin1String("handle")) + } else if (subcontrolString == QLatin1String("handle")) { subcontrol = QStyle::SC_ScrollBarSlider; - else if (subcontrolString == QLatin1String("add")) + } else if (subcontrolString == QLatin1String("add")) { subcontrol = QStyle::SC_ScrollBarAddPage; - else if (subcontrolString == QLatin1String("sub")) + } else if (subcontrolString == QLatin1String("sub")) { subcontrol = QStyle::SC_ScrollBarSubPage; + } return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), subcontrol); break; } @@ -1456,8 +1536,9 @@ ~QHighDpiPixmapsEnabler1() { - if (wasEnabled) + if (wasEnabled) { qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, false); + } } private: @@ -1468,9 +1549,9 @@ void KQuickStyleItem::paint(QPainter *painter) { initStyleOption(); - if (QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem *>(m_styleoption)) + if (QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem *>(m_styleoption)) { painter->setFont(opt->font); - else { + } else { QFont font; if (m_styleoption->state & QStyle::State_Mini) { font = qApp->font("QMiniFont"); @@ -1574,10 +1655,11 @@ KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, m_styleoption, painter); break; case Splitter: - if (m_styleoption->rect.width() == 1) + if (m_styleoption->rect.width() == 1) { painter->fillRect(0, 0, width(), height(), m_styleoption->palette.dark().color()); - else + } else { KQuickStyleItem::style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter); + } break; case ComboBox: { KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ComboBox, qstyleoption_cast<QStyleOptionComplex *>(m_styleoption), painter); @@ -1693,8 +1775,9 @@ void KQuickStyleItem::setTextureWidth(int w) { - if (m_textureWidth == w) + if (m_textureWidth == w) { return; + } m_textureWidth = w; Q_EMIT textureWidthChanged(m_textureWidth); update(); @@ -1702,8 +1785,9 @@ void KQuickStyleItem::setTextureHeight(int h) { - if (m_textureHeight == h) + if (m_textureHeight == h) { return; + } m_textureHeight = h; Q_EMIT textureHeightChanged(m_textureHeight); update(); @@ -1756,8 +1840,9 @@ } QSGNinePatchNode *styleNode = static_cast<QSGNinePatchNode *>(node); - if (!styleNode) + if (!styleNode) { styleNode = window()->createNinePatchNode(); + } #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(styleNode, QString::fromLatin1("%1:%2, '%3'").arg(styleName()).arg(elementType()).arg(text())); @@ -1839,8 +1924,9 @@ Q_UNUSED(requestedSize); int width = 16; int height = 16; - if (size) + if (size) { *size = QSize(width, height); + } QPixmap pixmap(width, height); @@ -1850,17 +1936,20 @@ QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); opt.features = {}; - if (id.contains(QLatin1String("selected"))) + if (id.contains(QLatin1String("selected"))) { opt.state |= QStyle::State_Selected; + } if (id.contains(QLatin1String("active"))) { opt.state |= QStyle::State_Active; opt.palette.setCurrentColorGroup(QPalette::Active); - } else + } else { opt.palette.setCurrentColorGroup(QPalette::Inactive); + } - if (id.contains(QLatin1String("alternate"))) + if (id.contains(QLatin1String("alternate"))) { opt.features |= QStyleOptionViewItem::Alternate; + } QPalette pal = QApplication::palette("QAbstractItemView"); if (opt.state & QStyle::State_Selected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.85.0/plugin/kquickstyleitem_p.h new/qqc2-desktop-style-5.86.0/plugin/kquickstyleitem_p.h --- old/qqc2-desktop-style-5.85.0/plugin/kquickstyleitem_p.h 2021-07-16 18:30:35.000000000 +0200 +++ new/qqc2-desktop-style-5.86.0/plugin/kquickstyleitem_p.h 2021-09-04 17:50:59.000000000 +0200 @@ -405,6 +405,8 @@ } QString hitTest(int x, int y); QRectF subControlRect(const QString &subcontrolString); + QSize sizeFromContents(int width, int height); + QRect computeBoundingRect(const QList<QRect>& rects); QString elidedText(const QString &text, int elideMode, int width); bool hasThemeIcon(const QString &) const; @@ -454,7 +456,6 @@ private: QIcon iconFromIconProperty() const; const char *classNameForItem() const; - QSize sizeFromContents(int width, int height); qreal baselineOffset(); void styleChanged();