diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Gui Widgets) +find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Kirigami2) + find_package(PkgConfig) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5QQC2DeskopStyle") diff --git a/org.kde.desktop/Button.qml b/org.kde.desktop/Button.qml --- a/org.kde.desktop/Button.qml +++ b/org.kde.desktop/Button.qml @@ -22,9 +22,12 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Button { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.Button + Kirigami.Theme.inherit: false implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight diff --git a/org.kde.desktop/CheckBox.qml b/org.kde.desktop/CheckBox.qml --- a/org.kde.desktop/CheckBox.qml +++ b/org.kde.desktop/CheckBox.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T import QtQuick.Controls 2.0 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.CheckBox { id: controlRoot @@ -36,7 +36,7 @@ baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 - spacing: Math.round(StylePrivate.TextSingleton.height / 8) + spacing: Kirigami.Units.smallSpacing hoverEnabled: true @@ -56,7 +56,6 @@ opacity: controlRoot.enabled ? 1 : 0.6 text: controlRoot.text font: controlRoot.font - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/CheckDelegate.qml b/org.kde.desktop/CheckDelegate.qml --- a/org.kde.desktop/CheckDelegate.qml +++ b/org.kde.desktop/CheckDelegate.qml @@ -22,7 +22,7 @@ import QtQuick 2.5 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami import "private" T.CheckDelegate { @@ -43,7 +43,7 @@ text: controlRoot.text font: controlRoot.font - color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/ComboBox.qml b/org.kde.desktop/ComboBox.qml --- a/org.kde.desktop/ComboBox.qml +++ b/org.kde.desktop/ComboBox.qml @@ -26,9 +26,12 @@ import QtQuick.Controls 2.0 as Controls import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtGraphicalEffects 1.0 +import org.kde.kirigami 2.2 as Kirigami T.ComboBox { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.Button + Kirigami.Theme.inherit: false implicitWidth: background.implicitWidth + leftPadding + rightPadding implicitHeight: background.implicitHeight @@ -44,6 +47,8 @@ text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData highlighted: controlRoot.highlightedIndex == index property bool separatorVisible: false + Kirigami.Theme.colorSet: controlRoot.Kirigami.Theme.inherit ? controlRoot.Kirigami.Theme.colorSet : Kirigami.Theme.View + Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit } indicator: Item {} @@ -76,6 +81,8 @@ implicitHeight: contentItem.implicitHeight topMargin: 6 bottomMargin: 6 + Kirigami.Theme.colorSet: Kirigami.Theme.View + Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit contentItem: ListView { id: listview @@ -93,8 +100,8 @@ margins: -1 } radius: 2 - color: StylePrivate.SystemPaletteSingleton.base(controlRoot.enabled) - property color borderColor: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: Kirigami.Theme.backgroundColor + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) layer.enabled: true diff --git a/org.kde.desktop/Dial.qml b/org.kde.desktop/Dial.qml --- a/org.kde.desktop/Dial.qml +++ b/org.kde.desktop/Dial.qml @@ -24,7 +24,7 @@ import QtQuick.Controls 2.0 import QtQuick.Controls.impl 2.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Dial { id: control @@ -35,7 +35,7 @@ background: DialRing { width: control.availableWidth height: control.availableHeight - color: control.visualFocus ? StylePrivate.SystemPaletteSingleton.highlight(control.enabled) : StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: control.visualFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor progress: control.position opacity: control.enabled ? 0.5 : 0.3 } @@ -46,6 +46,6 @@ width: 18 height: width radius: 8 - color: control.visualFocus ? StylePrivate.SystemPaletteSingleton.highlight(control.enabled) : StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: control.visualFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor } } diff --git a/org.kde.desktop/Dialog.qml b/org.kde.desktop/Dialog.qml --- a/org.kde.desktop/Dialog.qml +++ b/org.kde.desktop/Dialog.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtGraphicalEffects 1.0 import QtQuick.Templates 2.1 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Dialog { id: control @@ -62,8 +62,8 @@ background: Rectangle { radius: 2 - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.backgroundColor + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) layer.enabled: true diff --git a/org.kde.desktop/Drawer.qml b/org.kde.desktop/Drawer.qml --- a/org.kde.desktop/Drawer.qml +++ b/org.kde.desktop/Drawer.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Drawer { id: control @@ -42,16 +42,16 @@ bottomPadding: control.edge === Qt.TopEdge ? 1 : 0 background: Rectangle { - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) + color: Kirigami.Theme.backgroundColor Rectangle { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge anchors { left: control.edge !== Qt.LeftEdge ? parent.left : undefined right: control.edge !== Qt.RightEdge ? parent.right : undefined top: control.edge !== Qt.TopEdge ? parent.top : undefined bottom: control.edge !== Qt.BottomEdge ? parent.bottom : undefined } - color: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.textColor opacity: 0.3 width: 1 height: 1 diff --git a/org.kde.desktop/Frame.qml b/org.kde.desktop/Frame.qml --- a/org.kde.desktop/Frame.qml +++ b/org.kde.desktop/Frame.qml @@ -23,6 +23,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami T.Frame { id: control @@ -37,7 +38,7 @@ background: Rectangle { color: "transparent" - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) } } diff --git a/org.kde.desktop/GroupBox.qml b/org.kde.desktop/GroupBox.qml --- a/org.kde.desktop/GroupBox.qml +++ b/org.kde.desktop/GroupBox.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.GroupBox { id: control @@ -43,15 +43,15 @@ text: control.title font: control.font - color: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.textColor elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: Rectangle { color: "transparent" - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) } } diff --git a/org.kde.desktop/ItemDelegate.qml b/org.kde.desktop/ItemDelegate.qml --- a/org.kde.desktop/ItemDelegate.qml +++ b/org.kde.desktop/ItemDelegate.qml @@ -21,8 +21,8 @@ import QtQuick 2.5 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import "private" T.ItemDelegate { @@ -43,7 +43,7 @@ text: controlRoot.text font: controlRoot.font - color: controlRoot.highlighted || controlRoot.checked || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: controlRoot.highlighted || controlRoot.checked || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : (controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor) elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/Label.qml b/org.kde.desktop/Label.qml --- a/org.kde.desktop/Label.qml +++ b/org.kde.desktop/Label.qml @@ -24,22 +24,30 @@ import QtQuick.Window 2.2 import QtQuick.Templates 2.0 as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Label { id: control - height: Math.round(Math.max(paintedHeight, StylePrivate.TextSingleton.height * 1.6)) + height: Math.round(Math.max(paintedHeight, Kirigami.Units * 1.6)) verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter activeFocusOnTab: false //Text.NativeRendering is broken on non integer pixel ratios renderType: Window.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering - //font data is the system one by default - color: StylePrivate.SystemPaletteSingleton.text(control.enabled) - //StylePrivate.SystemPaletteSingleton doesn't have a link color - linkColor: "#2196F3" + font.capitalization: Kirigami.Theme.defaultFont.capitalization + font.family: Kirigami.Theme.defaultFont.family + font.italic: Kirigami.Theme.defaultFont.italic + font.letterSpacing: Kirigami.Theme.defaultFont.letterSpacing + font.pointSize: Kirigami.Theme.defaultFont.pointSize + font.strikeout: Kirigami.Theme.defaultFont.strikeout + font.underline: Kirigami.Theme.defaultFont.underline + font.weight: Kirigami.Theme.defaultFont.weight + font.wordSpacing: Kirigami.Theme.defaultFont.wordSpacing + color: Kirigami.Theme.textColor + linkColor: Kirigami.Theme.linkColor opacity: enabled? 1 : 0.6 diff --git a/org.kde.desktop/Menu.qml b/org.kde.desktop/Menu.qml --- a/org.kde.desktop/Menu.qml +++ b/org.kde.desktop/Menu.qml @@ -24,7 +24,7 @@ import QtGraphicalEffects 1.0 import QtQuick.Controls 2.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Menu { id: control @@ -70,8 +70,8 @@ radius: 2 implicitWidth: 150 implicitHeight: 40 - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.backgroundColor + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) layer.enabled: true diff --git a/org.kde.desktop/MenuItem.qml b/org.kde.desktop/MenuItem.qml --- a/org.kde.desktop/MenuItem.qml +++ b/org.kde.desktop/MenuItem.qml @@ -22,7 +22,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.MenuItem { id: controlRoot @@ -43,7 +43,7 @@ text: controlRoot.text font: controlRoot.font - color: controlRoot.hovered && !controlRoot.pressed ? StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: controlRoot.hovered && !controlRoot.pressed ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft @@ -64,7 +64,7 @@ Rectangle { anchors.fill: parent - color: StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) + color: Kirigami.Theme.highlightColor opacity: controlRoot.hovered && !controlRoot.pressed ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 150 } } } diff --git a/org.kde.desktop/Popup.qml b/org.kde.desktop/Popup.qml --- a/org.kde.desktop/Popup.qml +++ b/org.kde.desktop/Popup.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtGraphicalEffects 1.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.Popup { id: control @@ -62,8 +62,8 @@ background: Rectangle { radius: 2 - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.backgroundColor + property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) layer.enabled: true diff --git a/org.kde.desktop/RadioButton.qml b/org.kde.desktop/RadioButton.qml --- a/org.kde.desktop/RadioButton.qml +++ b/org.kde.desktop/RadioButton.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T import QtQuick.Controls 2.0 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.CheckBox { id: control @@ -36,7 +36,7 @@ baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 - spacing: Math.round(StylePrivate.TextSingleton.height / 8) + spacing: Kirigami.Units.smallSpacing hoverEnabled: true @@ -56,7 +56,7 @@ opacity: control.enabled ? 1 : 0.6 text: control.text font: control.font - color: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/RadioDelegate.qml b/org.kde.desktop/RadioDelegate.qml --- a/org.kde.desktop/RadioDelegate.qml +++ b/org.kde.desktop/RadioDelegate.qml @@ -21,8 +21,8 @@ import QtQuick 2.5 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import "private" T.RadioDelegate { @@ -43,7 +43,7 @@ text: controlRoot.text font: controlRoot.font - color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/RangeSlider.qml b/org.kde.desktop/RangeSlider.qml --- a/org.kde.desktop/RangeSlider.qml +++ b/org.kde.desktop/RangeSlider.qml @@ -23,7 +23,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.RangeSlider { id: control @@ -44,9 +44,9 @@ implicitWidth: 18 implicitHeight: 18 radius: width / 2 - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) - border.color: control.activeFocus ? StylePrivate.SystemPaletteSingleton.highlight(control.enabled) : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) + property color borderColor: Kirigami.Theme.textColor + border.color: control.activeFocus ? Kirigami.Theme.highlightColor : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) + color: Kirigami.Theme.backgroundColor Rectangle { z: -1 x: 1 @@ -65,9 +65,9 @@ implicitWidth: 18 implicitHeight: 18 radius: width / 2 - property color borderColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) - border.color: control.activeFocus ? StylePrivate.SystemPaletteSingleton.highlight(control.enabled) : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) - color: StylePrivate.SystemPaletteSingleton.window(control.enabled) + property color borderColor: Kirigami.Theme.textColor + border.color: control.activeFocus ? Kirigami.Theme.highlightColor : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) + color: Kirigami.Theme.backgroundColor Rectangle { z: -1 x: 1 @@ -86,16 +86,16 @@ width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight radius: Math.round(Math.min(width/2, height/2)) - property color bgColor: StylePrivate.SystemPaletteSingleton.text(control.enabled) + property color bgColor: Kirigami.Theme.textColor color: Qt.rgba(bgColor.r, bgColor.g, bgColor.b, 0.3) anchors.centerIn: parent Rectangle { x: parent.horizontal ? control.first.position * parent.width : 0 y: parent.horizontal ? 0 : control.second.visualPosition * parent.height + 6 width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 6 : 6 height: parent.horizontal ? 6 : control.second.position * parent.height - control.first.position * parent.height - 6 - color: StylePrivate.SystemPaletteSingleton.highlight(control.enabled) + color: Kirigami.Theme.highlightColor } } } diff --git a/org.kde.desktop/Slider.qml b/org.kde.desktop/Slider.qml --- a/org.kde.desktop/Slider.qml +++ b/org.kde.desktop/Slider.qml @@ -23,9 +23,11 @@ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami T.Slider { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.Button implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight diff --git a/org.kde.desktop/SpinBox.qml b/org.kde.desktop/SpinBox.qml --- a/org.kde.desktop/SpinBox.qml +++ b/org.kde.desktop/SpinBox.qml @@ -22,10 +22,13 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.SpinBox { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.View + Kirigami.Theme.inherit: false implicitWidth: Math.max(48, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth) implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding @@ -49,9 +52,9 @@ opacity: controlRoot.enabled ? 1 : 0.3 font: controlRoot.font - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) - selectionColor: StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) - selectedTextColor: StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) + color: Kirigami.Theme.textColor + selectionColor: Kirigami.Theme.highlightColor + selectedTextColor: Kirigami.Theme.highlightedTextColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter diff --git a/org.kde.desktop/Switch.qml b/org.kde.desktop/Switch.qml --- a/org.kde.desktop/Switch.qml +++ b/org.kde.desktop/Switch.qml @@ -22,7 +22,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.CheckBox { id: control @@ -33,7 +33,7 @@ baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 - spacing: Math.round(StylePrivate.TextSingleton.height / 8) + spacing: Kirigami.Units.smallSpacing hoverEnabled: true @@ -54,7 +54,7 @@ opacity: control.enabled ? 1 : 0.6 text: control.text font: control.font - color: StylePrivate.SystemPaletteSingleton.text(control.enabled) + color: Kirigami.Theme.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/SwitchDelegate.qml b/org.kde.desktop/SwitchDelegate.qml --- a/org.kde.desktop/SwitchDelegate.qml +++ b/org.kde.desktop/SwitchDelegate.qml @@ -21,7 +21,7 @@ import QtQuick 2.5 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami import QtQuick.Templates 2.0 as T import "private" @@ -43,7 +43,7 @@ text: controlRoot.text font: controlRoot.font - color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft diff --git a/org.kde.desktop/TabBar.qml b/org.kde.desktop/TabBar.qml --- a/org.kde.desktop/TabBar.qml +++ b/org.kde.desktop/TabBar.qml @@ -22,11 +22,15 @@ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami import QtQuick.Templates 2.0 as T T.TabBar { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.Button + Kirigami.Theme.inherit: false + implicitWidth: contentItem.implicitWidth implicitHeight: contentItem.implicitHeight @@ -70,7 +74,7 @@ top : controlRoot.position == T.TabBar.Header ? undefined : parent.top } height: 1 - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: Kirigami.Theme.textColor opacity: 0.4 } } diff --git a/org.kde.desktop/TextArea.qml b/org.kde.desktop/TextArea.qml --- a/org.kde.desktop/TextArea.qml +++ b/org.kde.desktop/TextArea.qml @@ -23,10 +23,13 @@ import QtQuick 2.6 import QtQuick.Window 2.1 import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.TextArea { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.View + Kirigami.Theme.inherit: false implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, background ? background.implicitWidth : 0, @@ -37,9 +40,9 @@ padding: 6 - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) - selectionColor: StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) - selectedTextColor: StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) + color: Kirigami.Theme.textColor + selectionColor: Kirigami.Theme.highlightColor + selectedTextColor: Kirigami.Theme.highlightedTextColor wrapMode: Text.WordWrap verticalAlignment: TextEdit.AlignTop //Text.NativeRendering is broken on non integer pixel ratios @@ -55,7 +58,7 @@ text: controlRoot.placeholderText font: controlRoot.font - color: StylePrivate.SystemPaletteSingleton.text(false) + color: Kirigami.Theme.disabledTextColor horizontalAlignment: controlRoot.horizontalAlignment verticalAlignment: controlRoot.verticalAlignment visible: !controlRoot.length && !controlRoot.preeditText && (!controlRoot.activeFocus || controlRoot.horizontalAlignment !== Qt.AlignHCenter) diff --git a/org.kde.desktop/TextField.qml b/org.kde.desktop/TextField.qml --- a/org.kde.desktop/TextField.qml +++ b/org.kde.desktop/TextField.qml @@ -24,10 +24,13 @@ import QtQuick.Window 2.1 import QtQuick.Controls 2.0 as Controls import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.TextField { id: controlRoot + Kirigami.Theme.colorSet: Kirigami.Theme.View + Kirigami.Theme.inherit: false implicitWidth: Math.max(200, placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) @@ -38,9 +41,9 @@ padding: 6 - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) - selectionColor: StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) - selectedTextColor: StylePrivate.SystemPaletteSingleton.highlightedText(controlRoot.enabled) + color: controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor + selectionColor: Kirigami.Theme.highlightColor + selectedTextColor: Kirigami.Theme.highlightedTextColor verticalAlignment: TextInput.AlignVCenter //Text.NativeRendering is broken on non integer pixel ratios renderType: Window.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering @@ -55,7 +58,7 @@ text: controlRoot.placeholderText font: controlRoot.font - color: StylePrivate.SystemPaletteSingleton.text(false) + color: Kirigami.Theme.disabledTextColor horizontalAlignment: controlRoot.horizontalAlignment verticalAlignment: controlRoot.verticalAlignment visible: !controlRoot.length && !controlRoot.preeditText && (!controlRoot.activeFocus || controlRoot.horizontalAlignment !== Qt.AlignHCenter) diff --git a/org.kde.desktop/ToolBar.qml b/org.kde.desktop/ToolBar.qml --- a/org.kde.desktop/ToolBar.qml +++ b/org.kde.desktop/ToolBar.qml @@ -22,7 +22,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.ToolBar { id: controlRoot @@ -37,17 +37,14 @@ background: Rectangle { implicitHeight: 40 - color: StylePrivate.SystemPaletteSingleton.window(controlRoot.enabled) - Rectangle { + color: Kirigami.Theme.backgroundColor + Kirigami.Separator { anchors { left: parent.left right: parent.right top: controlRoot.parent.footer && controlRoot.parent.footer == controlRoot ? parent.top : undefined - bottom: controlRoot.parent.footer && controlRoot.parent.footer == controlRoot ? undefined : parent.top + bottom: controlRoot.parent.footer && controlRoot.parent.footer == controlRoot ? undefined : parent.bottom } - height: 1 - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) - opacity: 0.3 } } } diff --git a/org.kde.desktop/ToolButton.qml b/org.kde.desktop/ToolButton.qml --- a/org.kde.desktop/ToolButton.qml +++ b/org.kde.desktop/ToolButton.qml @@ -22,10 +22,13 @@ import QtQuick 2.6 import QtQuick.Templates 2.0 as T +import org.kde.kirigami 2.2 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.ToolButton { id: controlRoot + Kirigami.Theme.colorSet: flat ? Kirigami.Theme.Window : Kirigami.Theme.Button + Kirigami.Theme.inherit: flat implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight diff --git a/org.kde.desktop/ToolTip.qml b/org.kde.desktop/ToolTip.qml --- a/org.kde.desktop/ToolTip.qml +++ b/org.kde.desktop/ToolTip.qml @@ -24,11 +24,15 @@ import QtGraphicalEffects 1.0 import QtQuick.Controls 2.0 as Controls import QtQuick.Templates 2.0 as T -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami T.ToolTip { id: controlRoot + //TODO: add tooltip to Kirigami Theme + Kirigami.Theme.colorSet: Kirigami.Theme.Button + Kirigami.Theme.inherit: false + x: parent ? (parent.width - implicitWidth) / 2 : 0 y: -implicitHeight - 3 @@ -43,14 +47,14 @@ contentItem: Controls.Label { text: controlRoot.text font: controlRoot.font - color: StylePrivate.SystemPaletteSingleton.base(controlRoot.enabled) + color: Kirigami.Theme.textColor } background: Rectangle { radius: 3 opacity: 0.95 - color: StylePrivate.SystemPaletteSingleton.text(controlRoot.enabled) + color: Kirigami.Theme.backgroundColor layer.enabled: true layer.effect: DropShadow { transparentBorder: true diff --git a/org.kde.desktop/private/DefaultListItemBackground.qml b/org.kde.desktop/private/DefaultListItemBackground.qml --- a/org.kde.desktop/private/DefaultListItemBackground.qml +++ b/org.kde.desktop/private/DefaultListItemBackground.qml @@ -21,16 +21,16 @@ import QtQuick 2.1 -import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import org.kde.kirigami 2.2 as Kirigami Rectangle { id: background - color: highlighted || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) : StylePrivate.SystemPaletteSingleton.base(controlRoot.enabled) + color: highlighted || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor visible: controlRoot.ListView.view ? controlRoot.ListView.view.highlight === null : true Rectangle { anchors.fill: parent - color: StylePrivate.SystemPaletteSingleton.highlight(controlRoot.enabled) + color: Kirigami.Theme.highlightColor opacity: controlRoot.hovered && !controlRoot.pressed ? 0.2 : 0 Behavior on opacity { NumberAnimation { duration: 150 } } } diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -15,9 +15,7 @@ endif() add_library(qqc2desktopstyleplugin SHARED ${qqc2desktopstyle_SRCS}) -target_link_libraries(qqc2desktopstyleplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets) +target_link_libraries(qqc2desktopstyleplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets KF5::Kirigami2) install(TARGETS qqc2desktopstyleplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/qqc2desktopstyle/private) -install(FILES SystemPaletteSingleton.qml DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/qqc2desktopstyle/private) -install(FILES TextSingleton.qml DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/qqc2desktopstyle/private) install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/qqc2desktopstyle/private) diff --git a/plugin/SystemPaletteSingleton.qml b/plugin/SystemPaletteSingleton.qml deleted file mode 100644 --- a/plugin/SystemPaletteSingleton.qml +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ - -pragma Singleton -import QtQuick 2.2 - -QtObject { - property SystemPalette active: SystemPalette { colorGroup: SystemPalette.Active } - property SystemPalette disabled: SystemPalette { colorGroup: SystemPalette.Disabled } - - function alternateBase(enabled) { return enabled ? active.alternateBase : disabled.alternateBase } - function base(enabled) { return enabled ? active.base : disabled.base } - function button(enabled) { return enabled ? active.button : disabled.button } - function buttonText(enabled) { return enabled ? active.buttonText : disabled.buttonText } - function dark(enabled) { return enabled ? active.dark : disabled.dark } - function highlight(enabled) { return enabled ? active.highlight : disabled.highlight } - function highlightedText(enabled) { return enabled ? active.highlightedText : disabled.highlightedText } - function light(enabled) { return enabled ? active.light : disabled.light } - function mid(enabled) { return enabled ? active.mid : disabled.mid } - function midlight(enabled) { return enabled ? active.midlight : disabled.midlight } - function shadow(enabled) { return enabled ? active.shadow : disabled.shadow } - function text(enabled) { return enabled ? active.text : disabled.text } - function window(enabled) { return enabled ? active.window : disabled.window } - function windowText(enabled) { return enabled ? active.windowText : disabled.windowText } -} diff --git a/plugin/TextSingleton.qml b/plugin/TextSingleton.qml deleted file mode 100644 --- a/plugin/TextSingleton.qml +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ - -pragma Singleton -import QtQuick 2.2 -Text { -} diff --git a/plugin/kquickstyleitem.cpp b/plugin/kquickstyleitem.cpp --- a/plugin/kquickstyleitem.cpp +++ b/plugin/kquickstyleitem.cpp @@ -54,6 +54,7 @@ #include "qsgdefaultninepatchnode_p.h" #endif +#include KQuickStyleItem::KQuickStyleItem(QQuickItem *parent) : QQuickItem(parent), @@ -160,6 +161,18 @@ void KQuickStyleItem::initStyleOption() { + if (!m_theme) { + m_theme = static_cast(qmlAttachedPropertiesObject(this, true)); + Q_ASSERT(m_theme); + + connect(m_theme, &Kirigami::PlatformTheme::colorsChanged, this, [this]() { + //we need to reset the palette event if Qt::AA_SetPalette attribute has been set + m_styleoption->palette = m_theme->palette(); + updateItem(); + }); + } + Q_ASSERT(m_theme); + if (m_styleoption) m_styleoption->state = 0; @@ -694,7 +707,7 @@ if (QCoreApplication::testAttribute(Qt::AA_SetPalette)) return; - m_styleoption->palette = QApplication::palette(classNameForItem()); + m_styleoption->palette = m_theme->palette(); } /* diff --git a/plugin/kquickstyleitem_p.h b/plugin/kquickstyleitem_p.h --- a/plugin/kquickstyleitem_p.h +++ b/plugin/kquickstyleitem_p.h @@ -51,6 +51,10 @@ class QWidget; class QStyleOption; +namespace Kirigami { + class PlatformTheme; +} + class QQuickTableRowImageProvider1 : public QQuickImageProvider { public: @@ -270,6 +274,7 @@ qreal baselineOffset(); protected: + Kirigami::PlatformTheme *m_theme = nullptr; QStyleOption *m_styleoption; QPointer m_control; Type m_itemType; diff --git a/plugin/qmldir b/plugin/qmldir --- a/plugin/qmldir +++ b/plugin/qmldir @@ -1,5 +1,3 @@ module org.kde.qqc2desktopstyle.private plugin qqc2desktopstyleplugin -singleton SystemPaletteSingleton 1.0 SystemPaletteSingleton.qml -singleton TextSingleton 1.0 TextSingleton.qml