feat(qml):qml组件更新对应的quickitems主题颜色

This commit is contained in:
qiqi49 2024-01-04 11:13:41 +08:00 committed by hewenfei
parent 2d08482c4c
commit ade3df6014
18 changed files with 81 additions and 67 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
MouseArea {
@ -12,16 +13,16 @@ MouseArea {
when: control.activeFocus
PropertyChanges {
target: controlBase
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
border.width: 2
}
}
UkuiItems.StyleBackground {
id: controlBase
anchors.fill: parent
radius: UkuiItems.Theme.minRadius
radius: Platform.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
alpha: isSelect ? 1.00 : control.containsPress ? 0.16 : control.containsMouse ? 0.08 : 0.00
ToolTip.visible: content.textTruncated && control.containsMouse
ToolTip.text: name
@ -60,7 +61,7 @@ MouseArea {
height: 28
icon.width: 16
icon.height: 16
background.paletteRole: UkuiItems.Theme.Light
background.paletteRole: Platform.Theme.Light
background.alpha: 1
activeFocusOnTab: false

View File

@ -2,6 +2,7 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
MouseArea {
@ -39,11 +40,11 @@ MouseArea {
}
}
StyleBackground {
UkuiItems.StyleBackground {
id: controlBase
anchors.fill: parent
radius: UkuiItems.Theme.minRadius
useStyleTransparent: false
radius: Platform.Theme.minRadius
useStyleTransparency: false
alpha: isSelect ? 0.55 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
RowLayout {
@ -55,7 +56,7 @@ MouseArea {
rows: 2; columns: 2
spacing: 2; padding: 2
icons: icon
alpha: 0.12; radius: UkuiItems.Theme.minRadius
alpha: 0.12; radius: Platform.Theme.minRadius
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 32
Layout.preferredHeight: 32
@ -68,7 +69,7 @@ MouseArea {
Component {
id: unEditText
StyleText {
UkuiItems.StyleText {
id: textShow
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
@ -83,13 +84,13 @@ MouseArea {
Component {
id: editText
UkuiItems.StyleBackground {
radius: UkuiItems.Theme.normalRadius
radius: Platform.Theme.normalRadius
useStyleTransparency: false
alpha: textChange.activeFocus ? 0.04 : 0
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
border.width: 2
borderAlpha: textChange.activeFocus ? 1 : 0
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
TextInput {
id: textChange

View File

@ -2,8 +2,8 @@ import QtQuick 2.0
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
MouseArea {
id: control
hoverEnabled: true
@ -33,16 +33,16 @@ MouseArea {
border.width: 2
}
}
StyleBackground {
UkuiItems.StyleBackground {
id: controlBase
anchors.fill: parent
radius: UkuiItems.Theme.minRadius
useStyleTransparent: false
radius: Platform.Theme.minRadius
useStyleTransparency: false
alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
RowLayout {
anchors.fill: parent
StyleText {
UkuiItems.StyleText {
Layout.preferredHeight: parent.height
Layout.preferredWidth: contentWidth
Layout.leftMargin: 12

View File

@ -20,6 +20,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import AppControls2 1.0 as AppControls2
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
@ -40,7 +41,7 @@ MouseArea {
height: 1
useStyleTransparency: false
alpha: 0.15
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
visible: listView.contentY > 0
}

View File

@ -1,6 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.utils 1.0
@ -15,7 +16,7 @@ Item {
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
radius: UkuiItems.Theme.normalRadius
radius: Platform.Theme.normalRadius
changeFocusTarget: focusToPageContent
visible: true
onTextChanged: {
@ -36,4 +37,3 @@ Item {
}
}
}

View File

@ -20,6 +20,7 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
Item {
@ -38,7 +39,7 @@ Item {
horizontalAlignment: contain.textCenterIn ? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
text: contain.textEdited
paletteRole: isFullScreenFolder ? UkuiItems.Theme.HighlightedText : UkuiItems.Theme.Text
paletteRole: isFullScreenFolder ? Platform.Theme.HighlightedText : Platform.Theme.Text
font.bold: !isFullScreenFolder
font.pointSize: isFullScreenFolder ? textUltra : systemFontSize
@ -56,13 +57,13 @@ Item {
Component {
id: editText
UkuiItems.StyleBackground {
radius: UkuiItems.Theme.normalRadius
radius: Platform.Theme.normalRadius
useStyleTransparency: false
alpha: textEdit.activeFocus ? 0.04 : 0
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
border.width: 2
borderAlpha: textEdit.activeFocus ? 1 : 0
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
TextInput {
id: textEdit

View File

@ -22,6 +22,7 @@ import QtQml.Models 2.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import AppControls2 1.0 as AppControls2
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
RowLayout {
@ -89,12 +90,12 @@ RowLayout {
highlightMoveDuration: animationDuration
highlight: UkuiItems.StyleBackground {
width: labelListView.maxLabelWidth; height: 30
radius: UkuiItems.Theme.minRadius
radius: Platform.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
paletteRole: Platform.Theme.Light
border.width: 1
alpha: 0.18; borderAlpha: 0.7
borderColor: UkuiItems.Theme.HighlightedText
borderColor: Platform.Theme.HighlightedText
}
onCountChanged: currentIndex = 0
@ -122,7 +123,7 @@ RowLayout {
hoverEnabled: true
UkuiItems.StyleText {
anchors.fill: parent
paletteRole: UkuiItems.Theme.HighlightedText
paletteRole: Platform.Theme.HighlightedText
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -484,14 +485,14 @@ RowLayout {
verticalAlignment: Text.AlignVCenter
width: contentWidth
text: name
paletteRole: UkuiItems.Theme.HighlightedText
paletteRole: Platform.Theme.HighlightedText
}
UkuiItems.StyleBackground {
anchors.verticalCenter: parent.verticalCenter
useStyleTransparency: false
alpha: 0.14
paletteRole: UkuiItems.Theme.Light
paletteRole: Platform.Theme.Light
height: 1
width: parent.width - labelName.width - parent.spacing
}
@ -513,8 +514,8 @@ RowLayout {
UkuiItems.StyleBackground {
anchors.fill: parent
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
radius: UkuiItems.Theme.maxRadius
paletteRole: Platform.Theme.Light
radius: Platform.Theme.maxRadius
alpha: parent.containsPress ? 0.25 : parent.containsMouse ? 0.15 : 0.00
AppControls2.IconLabel {
anchors.fill: parent
@ -620,7 +621,7 @@ RowLayout {
background: UkuiItems.StyleBackground {
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Dark
paletteRole: Platform.Theme.Dark
alpha: 0.25
radius: width / 2
}
@ -628,7 +629,7 @@ RowLayout {
contentItem: UkuiItems.StyleBackground {
radius: width / 2
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
paletteRole: Platform.Theme.Light
alpha: fullScreenScrollBar.pressed ? 0.90 : fullScreenScrollBar.hovered ? 0.78 : 0.60
}
}

View File

@ -21,6 +21,7 @@ import QtQml.Models 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
@ -56,7 +57,7 @@ Loader {
Item {
UkuiItems.StyleBackground {
id: folderIconBase
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
useStyleTransparency: false
property int folderIconSize: 0
property int iconSpacing: 0
@ -73,7 +74,7 @@ Loader {
target: folderIconBase
width: 720
height: viewMaxRow * 170 + margins * 2
radius: UkuiItems.Theme.maxRadius
radius: Platform.Theme.maxRadius
gridViewMargin: margins
x: (parent.width - width) / 2
y: (parent.height - height) / 2
@ -91,7 +92,7 @@ Loader {
target: folderIconBase
width: 86
height: 86
radius: UkuiItems.Theme.maxRadius
radius: Platform.Theme.maxRadius
gridViewMargin: 8
x: root.mapFromGlobal(folderX, 0).x
y: root.mapFromGlobal(0, folderY).y
@ -250,8 +251,8 @@ Loader {
UkuiItems.StyleBackground {
anchors.fill: parent
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
radius: UkuiItems.Theme.maxRadius
paletteRole: Platform.Theme.Light
radius: Platform.Theme.maxRadius
alpha: parent.containsPress ? 0.25 : parent.containsMouse ? 0.15 : 0.00
Image {
@ -269,7 +270,7 @@ Loader {
anchors.horizontalCenter: parent.horizontalCenter
text: name
elide: Text.ElideRight
paletteRole: UkuiItems.Theme.HighlightedText
paletteRole: Platform.Theme.HighlightedText
}
}
onClicked: {

View File

@ -20,6 +20,7 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
@ -32,10 +33,10 @@ Row {
UkuiItems.StyleBackground {
width: 48; height: width
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
paletteRole: Platform.Theme.Light
alpha: powerButtonArea.containsPress ? 0.25 : powerButtonArea.containsMouse ? 0.12 : 0
radius: height / 2
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
border.width: powerButtonArea.activeFocus ? 2 : 0
PowerButton {

View File

@ -1,6 +1,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
@ -22,7 +23,7 @@ Item {
id: searchInputBar
width: 372; height: 36
anchors.centerIn: parent
radius: UkuiItems.Theme.minRadius
radius: Platform.Theme.minRadius
visible: opacity
onTextChanged: {
@ -40,13 +41,13 @@ Item {
UkuiItems.StyleBackground {
width: 48; height: width
radius: UkuiItems.Theme.minRadius
radius: Platform.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
paletteRole: Platform.Theme.Light
alpha: buttonMouseArea.containsPress ? 0.30 : buttonMouseArea.containsMouse ? 0.20 : 0.00
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
border.width: buttonMouseArea.activeFocus ? 2 : 0
ThemeIcon {
@ -73,4 +74,3 @@ Item {
}
}
}

View File

@ -1,10 +1,11 @@
import QtQuick 2.0
import QtQuick.Layouts 1.12
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
UkuiItems.StyleBackground {
paletteRole: UkuiItems.Theme.Dark
paletteRole: Platform.Theme.Dark
MouseArea {
anchors.fill: parent
onClicked: {

View File

@ -1,5 +1,6 @@
import QtQuick 2.12
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
FocusScope {
@ -35,7 +36,7 @@ FocusScope {
width: 1
height: parent.height
paletteRole: UkuiItems.Theme.ButtonText
paletteRole: Platform.Theme.ButtonText
useStyleTransparency: false
alpha: 0.05
}
@ -49,7 +50,7 @@ FocusScope {
width: 1
height: parent.height
paletteRole: UkuiItems.Theme.ButtonText
paletteRole: Platform.Theme.ButtonText
useStyleTransparency: false
alpha: 0.05
}

View File

@ -22,11 +22,12 @@ import QtQuick.Controls 2.12
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
UkuiItems.StyleBackground {
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
radius: childrenRect.width / 2
alpha: 0.06
@ -62,7 +63,7 @@ UkuiItems.StyleBackground {
background.radius: width / 2
icon.mode: parent.currentId === 0 ? mainWindow.isFullScreen ? UkuiItems.Icon.AutoHighlight : UkuiItems.Icon.Normal : UkuiItems.Icon.Disabled
icon.source: pluginSortButtonRoot.model.getProviderIcon(0);
background.paletteRole: UkuiItems.Theme.Light
background.paletteRole: Platform.Theme.Light
background.alpha: parent.currentId === 0 ? 0.7 : 0
onClicked: {
@ -90,7 +91,7 @@ UkuiItems.StyleBackground {
background.radius: width / 2
icon.mode: parent.currentId === 1 ? mainWindow.isFullScreen ? UkuiItems.Icon.AutoHighlight : UkuiItems.Icon.Normal : UkuiItems.Icon.Disabled
icon.source: pluginSortButtonRoot.model.getProviderIcon(1);
background.paletteRole: UkuiItems.Theme.Light
background.paletteRole: Platform.Theme.Light
background.alpha: parent.currentId === 1 ? 0.7 : 0
onClicked: {

View File

@ -21,6 +21,7 @@ import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import org.ukui.menu.core 1.0
import AppControls2 1.0 as AppControls2
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
UkuiItems.StyleBackground {
@ -29,10 +30,10 @@ UkuiItems.StyleBackground {
alpha: 0.04
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
border.width: 1
borderAlpha: textInput.activeFocus ? 1 : 0.1
borderColor: textInput.activeFocus ? UkuiItems.Theme.Highlight : UkuiItems.Theme.Base
borderColor: textInput.activeFocus ? Platform.Theme.Highlight : Platform.Theme.Base
Component.onCompleted: mainWindow.visibleChanged.connect(clear)
Component.onDestruction: mainWindow.visibleChanged.disconnect(clear)
@ -71,7 +72,7 @@ UkuiItems.StyleBackground {
anchors.left: searchIcon.right
text: qsTr("Search App")
visible: textInput.contentWidth === 0
paletteRole: mainWindow.isFullScreen ? UkuiItems.Theme.HighlightedText : UkuiItems.Theme.Text
paletteRole: mainWindow.isFullScreen ? Platform.Theme.HighlightedText : Platform.Theme.Text
verticalAlignment: TextInput.AlignVCenter
alpha: 0.25
}

View File

@ -19,6 +19,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.2
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
Item {
@ -194,7 +195,7 @@ Item {
when: labelItem.activeFocus
PropertyChanges {
target: labelItem
borderColor: UkuiItems.Theme.Highlight
borderColor: Platform.Theme.Highlight
border.width: 2
}
}
@ -224,4 +225,3 @@ Item {
}
}
}

View File

@ -24,6 +24,7 @@ import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
import org.ukui.menu.extension 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
Item {
@ -54,7 +55,7 @@ Item {
}
}
background.radius: UkuiItems.Theme.minRadius
background.radius: Platform.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "view-fullscreen-symbolic"
}
@ -88,7 +89,7 @@ Item {
}
}
background.radius: UkuiItems.Theme.minRadius
background.radius: Platform.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: totalUtils.iconFile
}
@ -113,7 +114,7 @@ Item {
}
}
background.radius: UkuiItems.Theme.minRadius
background.radius: Platform.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "computer-symbolic"
}
@ -138,7 +139,7 @@ Item {
}
}
background.radius: UkuiItems.Theme.minRadius
background.radius: Platform.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "applications-system-symbolic"
}
@ -172,7 +173,7 @@ Item {
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
}
background.radius: UkuiItems.Theme.minRadius
background.radius: Platform.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: powerButtonBase.icon
}

View File

@ -22,6 +22,7 @@ import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import AppControls2 1.0 as AppControls2
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
@ -71,7 +72,7 @@ Item {
useStyleTransparency: false
paletteRole: Palette.Highlight
alpha: 0
radius: UkuiItems.Theme.minRadius
radius: Platform.Theme.minRadius
borderColor: Palette.Highlight
border.width: activeFocus ? 2 : 0
@ -108,7 +109,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
font.bold: parent.ListView.isCurrentItem
paletteRole: parent.ListView.isCurrentItem ? UkuiItems.Theme.Highlight: UkuiItems.Theme.Text
paletteRole: parent.ListView.isCurrentItem ? Platform.Theme.Highlight: Platform.Theme.Text
text: model.name
}

View File

@ -22,6 +22,7 @@ import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.menu.extension 1.0
import AppControls2 1.0 as AppControls2
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
UkuiMenuExtension {
@ -39,7 +40,7 @@ UkuiMenuExtension {
width: parent.width; height: 1
useStyleTransparency: false
alpha: 0.15
paletteRole: UkuiItems.Theme.Text
paletteRole: Platform.Theme.Text
visible: favoriteView.contentY > 0
z: 1
}
@ -126,7 +127,7 @@ UkuiMenuExtension {
property bool hold: false
property int visualIndex: 0
x: 0; y: 0
radius: UkuiItems.Theme.maxRadius
radius: Platform.Theme.maxRadius
useStyleTransparency: false
scale: icon.hold ? 1.1 :1.0
alpha: control.containsPress ? 0.75 : control.containsMouse ? 0.6 : 0.40