feat(qml): 开始菜单ui适配主题圆角

This commit is contained in:
youdiansaodongxi 2023-12-11 16:13:53 +08:00 committed by hewenfei
parent dd31bd9822
commit 3cfba996d4
17 changed files with 107 additions and 92 deletions

View File

@ -19,7 +19,7 @@ MouseArea {
UkuiItems.StyleBackground {
id: controlBase
anchors.fill: parent
radius: 4
radius: UkuiItems.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Text
alpha: isSelect ? 1.00 : control.containsPress ? 0.16 : control.containsMouse ? 0.08 : 0.00

View File

@ -1,8 +1,8 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import AppControls2 1.0 as AppControls2
import org.ukui.menu.core 1.0
import org.ukui.quick.items 1.0 as UkuiItems
MouseArea {
id: control
@ -42,7 +42,7 @@ MouseArea {
StyleBackground {
id: controlBase
anchors.fill: parent
radius: 4
radius: UkuiItems.Theme.minRadius
useStyleTransparent: false
alpha: isSelect ? 0.55 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
@ -55,7 +55,7 @@ MouseArea {
rows: 2; columns: 2
spacing: 2; padding: 2
icons: icon
alpha: 0.12; radius: 4
alpha: 0.12; radius: UkuiItems.Theme.minRadius
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 32
Layout.preferredHeight: 32
@ -82,14 +82,14 @@ MouseArea {
Component {
id: editText
AppControls2.StyleBackground {
radius: 6
useStyleTransparent: false
UkuiItems.StyleBackground {
radius: UkuiItems.Theme.normalRadius
useStyleTransparency: false
alpha: textChange.activeFocus ? 0.04 : 0
paletteRole: Palette.Text
paletteRole: UkuiItems.Theme.Text
border.width: 2
borderAlpha: textChange.activeFocus ? 1 : 0
borderColor: Palette.Highlight
borderColor: UkuiItems.Theme.Highlight
TextInput {
id: textChange

View File

@ -2,6 +2,7 @@ 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.items 1.0 as UkuiItems
MouseArea {
id: control
@ -35,7 +36,7 @@ MouseArea {
StyleBackground {
id: controlBase
anchors.fill: parent
radius: 4
radius: UkuiItems.Theme.minRadius
useStyleTransparent: false
alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00

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.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
MouseArea {
@ -33,6 +34,16 @@ MouseArea {
hoverEnabled: true
clip: true
UkuiItems.StyleBackground {
anchors.top: parent.top
width: parent.width
height: 1
useStyleTransparency: false
alpha: 0.15
paletteRole: UkuiItems.Theme.Text
visible: listView.contentY > 0
}
RowLayout {
anchors.fill: parent
spacing: 0

View File

@ -1,7 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import AppControls2 1.0 as AppControls2
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.utils 1.0
Item {
@ -15,7 +15,7 @@ Item {
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
radius: 6 //change theme
radius: UkuiItems.Theme.normalRadius
changeFocusTarget: focusToPageContent
visible: true
onTextChanged: {

View File

@ -19,8 +19,8 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import AppControls2 1.0 as AppControls2
import org.ukui.menu.core 1.0
import org.ukui.quick.items 1.0 as UkuiItems
Item {
id: contain
@ -32,13 +32,13 @@ Item {
Component {
id: unEditText
AppControls2.StyleText {
UkuiItems.StyleText {
id: textShow
verticalAlignment: Text.AlignVCenter
horizontalAlignment: contain.textCenterIn ? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
text: contain.textEdited
paletteRole: isFullScreenFolder ? Palette.HighlightedText : Palette.Text
paletteRole: isFullScreenFolder ? UkuiItems.Theme.HighlightedText : UkuiItems.Theme.Text
font.bold: !isFullScreenFolder
font.pointSize: isFullScreenFolder ? textUltra : systemFontSize
@ -55,14 +55,14 @@ Item {
Component {
id: editText
AppControls2.StyleBackground {
radius: 6
useStyleTransparent: false
UkuiItems.StyleBackground {
radius: UkuiItems.Theme.normalRadius
useStyleTransparency: false
alpha: textEdit.activeFocus ? 0.04 : 0
paletteRole: Palette.Text
paletteRole: UkuiItems.Theme.Text
border.width: 2
borderAlpha: textEdit.activeFocus ? 1 : 0
borderColor: Palette.Highlight
borderColor: UkuiItems.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.items 1.0 as UkuiItems
RowLayout {
id: root
@ -86,14 +87,14 @@ RowLayout {
interactive: contentHeight > parent.height
highlightMoveDuration: animationDuration
highlight: AppControls2.StyleBackground {
highlight: UkuiItems.StyleBackground {
width: labelListView.maxLabelWidth; height: 30
radius: 4
useStyleTransparent: false
paletteRole: Palette.Light
radius: UkuiItems.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
border.width: 1
alpha: 0.18; borderAlpha: 0.7
borderColor: Palette.HighlightedText
borderColor: UkuiItems.Theme.HighlightedText
}
onCountChanged: currentIndex = 0
@ -119,9 +120,9 @@ RowLayout {
width: labelListView.maxLabelWidth
height: 30
hoverEnabled: true
AppControls2.StyleText {
UkuiItems.StyleText {
anchors.fill: parent
paletteRole: Palette.HighlightedText
paletteRole: UkuiItems.Theme.HighlightedText
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -477,20 +478,20 @@ RowLayout {
anchors.fill: parent
anchors.leftMargin: 67
spacing: 15
AppControls2.StyleText {
UkuiItems.StyleText {
id: labelName
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
width: contentWidth
text: name
paletteRole: Palette.HighlightedText
paletteRole: UkuiItems.Theme.HighlightedText
}
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
anchors.verticalCenter: parent.verticalCenter
useStyleTransparent: false
useStyleTransparency: false
alpha: 0.14
paletteRole: Palette.Light
paletteRole: UkuiItems.Theme.Light
height: 1
width: parent.width - labelName.width - parent.spacing
}
@ -509,11 +510,11 @@ RowLayout {
width: 170; height: width
acceptedButtons: Qt.LeftButton | Qt.RightButton
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
anchors.fill: parent
useStyleTransparent: false
paletteRole: Palette.Light
radius: 16
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
radius: UkuiItems.Theme.maxRadius
alpha: parent.containsPress ? 0.25 : parent.containsMouse ? 0.15 : 0.00
AppControls2.IconLabel {
anchors.fill: parent
@ -552,7 +553,9 @@ RowLayout {
labelListView.currentIndex = labelRepeater.count - 1
return
}
labelListView.currentIndex = labelColumn.childAt(contentX, contentY + 200).labelIndex
if (labelColumn.childAt(contentX,contentY) !== null) {
labelListView.currentIndex = labelColumn.childAt(contentX,contentY).labelIndex
}
}
NumberAnimation {
@ -615,17 +618,17 @@ RowLayout {
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
}
background: AppControls2.StyleBackground {
useStyleTransparent: false
paletteRole: Palette.Dark
background: UkuiItems.StyleBackground {
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Dark
alpha: 0.25
radius: width / 2
}
contentItem: AppControls2.StyleBackground {
contentItem: UkuiItems.StyleBackground {
radius: width / 2
useStyleTransparent: false
paletteRole: Palette.Light
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
alpha: fullScreenScrollBar.pressed ? 0.90 : fullScreenScrollBar.hovered ? 0.78 : 0.60
}
}

View File

@ -21,7 +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 AppControls2 1.0 as AppControls2
import org.ukui.quick.items 1.0 as UkuiItems
Loader {
@ -54,10 +54,10 @@ Loader {
Component {
id: folderComponent
Item {
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
id: folderIconBase
paletteRole: Palette.Text
useStyleTransparent: false
paletteRole: UkuiItems.Theme.Text
useStyleTransparency: false
property int folderIconSize: 0
property int iconSpacing: 0
property int imageX: 0
@ -73,7 +73,7 @@ Loader {
target: folderIconBase
width: 720
height: viewMaxRow * 170 + margins * 2
radius: 36
radius: UkuiItems.Theme.maxRadius
gridViewMargin: margins
x: (parent.width - width) / 2
y: (parent.height - height) / 2
@ -91,7 +91,7 @@ Loader {
target: folderIconBase
width: 86
height: 86
radius: 16
radius: UkuiItems.Theme.maxRadius
gridViewMargin: 8
x: root.mapFromGlobal(folderX, 0).x
y: root.mapFromGlobal(0, folderY).y
@ -247,11 +247,11 @@ Loader {
width: GridView.view.cellWidth; height: GridView.view.cellHeight
acceptedButtons: Qt.LeftButton | Qt.RightButton
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
anchors.fill: parent
useStyleTransparent: false
paletteRole: Palette.Light
radius: 16
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
radius: UkuiItems.Theme.maxRadius
alpha: parent.containsPress ? 0.25 : parent.containsMouse ? 0.15 : 0.00
Image {
@ -261,7 +261,7 @@ Loader {
x: folderIconBase.imageX; y: folderIconBase.imageY
}
AppControls2.StyleText {
UkuiItems.StyleText {
width: parent.width
horizontalAlignment: Text.AlignHCenter
anchors.top: iconImage.bottom
@ -269,7 +269,7 @@ Loader {
anchors.horizontalCenter: parent.horizontalCenter
text: name
elide: Text.ElideRight
paletteRole: Palette.HighlightedText
paletteRole: UkuiItems.Theme.HighlightedText
}
}
onClicked: {

View File

@ -20,7 +20,7 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import AppControls2 1.0 as AppControls2
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
@ -29,13 +29,13 @@ Row {
Layout.preferredHeight: 48
layoutDirection: Qt.RightToLeft
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
width: 48; height: width
useStyleTransparent: false
paletteRole: Palette.Light
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
alpha: powerButtonArea.containsPress ? 0.25 : powerButtonArea.containsMouse ? 0.12 : 0
radius: height / 2
borderColor: Palette.Highlight
borderColor: UkuiItems.Theme.Highlight
border.width: powerButtonArea.activeFocus ? 2 : 0
PowerButton {

View File

@ -1,7 +1,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import AppControls2 1.0 as AppControls2
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
@ -22,12 +22,12 @@ Item {
id: searchInputBar
width: 372; height: 36
anchors.centerIn: parent
radius: 4 //change theme
radius: UkuiItems.Theme.minRadius
visible: opacity
onTextChanged: {
if (text === "") {
pluginSelectButton.model.reactivateProvider();
appPageHeaderUtils.model(PluginGroup.SortMenuItem).reactivateProvider();
} else {
appPageHeaderUtils.model(PluginGroup.Button).reactivateProvider();
appPageHeaderUtils.startSearch(text);
@ -38,15 +38,15 @@ Item {
}
}
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
width: 48; height: width
radius: 4
useStyleTransparent: false
paletteRole: Palette.Light
radius: UkuiItems.Theme.minRadius
useStyleTransparency: false
paletteRole: UkuiItems.Theme.Light
alpha: buttonMouseArea.containsPress ? 0.30 : buttonMouseArea.containsMouse ? 0.20 : 0.00
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
borderColor: Palette.Highlight
borderColor: UkuiItems.Theme.Highlight
border.width: buttonMouseArea.activeFocus ? 2 : 0
ThemeIcon {

View File

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

View File

@ -1,6 +1,5 @@
import QtQuick 2.12
import org.ukui.menu.core 1.0
import org.ukui.quick.items 1.0 as UkuiItems
FocusScope {

View File

@ -20,7 +20,6 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import AppControls2 1.0 as AppControls2
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
import org.ukui.quick.items 1.0 as UkuiItems

View File

@ -19,7 +19,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.2
import org.ukui.menu.core 1.0
import AppControls2 1.0 as AppControls2
import org.ukui.quick.items 1.0 as UkuiItems
Item {
id: root
@ -173,7 +173,7 @@ Item {
]
model: modelManager.getLabelModel()
delegate: AppControls2.StyleBackground {
delegate: UkuiItems.StyleBackground {
id: labelItem
height: selectionArea.itemHeight; width: selectionArea.itemWidth
property int index: model.index
@ -181,7 +181,7 @@ Item {
property string displayName: model.displayName
property string id: model.id
alpha: (itemMouseArea.containsPress && !model.isDisable) ? 0.82 : (itemMouseArea.containsMouse && !model.isDisable) ? 0.55 : 0.00
useStyleTransparent: false
useStyleTransparency: false
radius: 8
focus: true
Keys.onPressed: {
@ -194,11 +194,11 @@ Item {
when: labelItem.activeFocus
PropertyChanges {
target: labelItem
borderColor: Palette.Highlight
borderColor: UkuiItems.Theme.Highlight
border.width: 2
}
}
AppControls2.StyleText {
UkuiItems.StyleText {
anchors.fill: parent
text: model.displayName
alpha: model.isDisable ? 0.2 : 0.9

View File

@ -54,7 +54,7 @@ Item {
}
}
background.radius: 4
background.radius: UkuiItems.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "view-fullscreen-symbolic"
}
@ -88,7 +88,7 @@ Item {
}
}
background.radius: 4
background.radius: UkuiItems.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: totalUtils.iconFile
}
@ -113,7 +113,7 @@ Item {
}
}
background.radius: 4
background.radius: UkuiItems.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "computer-symbolic"
}
@ -138,7 +138,7 @@ Item {
}
}
background.radius: 4
background.radius: UkuiItems.Theme.minRadius
icon.mode: UkuiItems.Icon.AutoHighlight
icon.source: "applications-system-symbolic"
}
@ -172,7 +172,7 @@ Item {
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
}
background.radius: 4
background.radius: UkuiItems.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.items 1.0 as UkuiItems
import org.ukui.menu.core 1.0
import org.ukui.menu.utils 1.0
import org.ukui.menu.extension 1.0
@ -122,7 +123,7 @@ Item {
useStyleTransparent: false
paletteRole: Palette.Highlight
alpha: 0
radius: 4
radius: UkuiItems.Theme.minRadius
borderColor: Palette.Highlight
border.width: activeFocus ? 2 : 0
@ -152,14 +153,14 @@ Item {
}
}
AppControls2.StyleText {
UkuiItems.StyleText {
height: parent.height
id: styleText
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.bold: parent.ListView.isCurrentItem
paletteRole: parent.ListView.isCurrentItem ? Palette.Highlight: Palette.Text
paletteRole: parent.ListView.isCurrentItem ? UkuiItems.Theme.Highlight: UkuiItems.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.items 1.0 as UkuiItems
UkuiMenuExtension {
Component.onCompleted: {
@ -33,12 +34,12 @@ UkuiMenuExtension {
anchors.fill: parent
hoverEnabled: true
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
anchors.top: parent.top
width: parent.width; height: 1
useStyleTransparent: false
useStyleTransparency: false
alpha: 0.15
paletteRole: Palette.Text
paletteRole: UkuiItems.Theme.Text
visible: favoriteView.contentY > 0
z: 1
}
@ -119,14 +120,14 @@ UkuiMenuExtension {
alpha: 0.6
}
}
AppControls2.StyleBackground {
UkuiItems.StyleBackground {
id: icon
height: favoriteView.itemHeight; width: height
property bool hold: false
property int visualIndex: 0
x: 0; y: 0
radius: 8
useStyleTransparent: false
radius: UkuiItems.Theme.maxRadius
useStyleTransparency: false
scale: icon.hold ? 1.1 :1.0
alpha: control.containsPress ? 0.75 : control.containsMouse ? 0.6 : 0.40