ui: 使用UkuiItems.Button实现按钮
This commit is contained in:
parent
26b436d98a
commit
5f879bab40
|
@ -35,8 +35,9 @@ Item {
|
|||
anchors.bottomMargin: 12
|
||||
spacing: 0
|
||||
|
||||
MouseArea {
|
||||
UkuiItems.Button {
|
||||
id: fullScreenbutton
|
||||
visible: !isLiteMode
|
||||
|
||||
Layout.preferredWidth: 36
|
||||
Layout.preferredHeight: 36
|
||||
|
@ -46,10 +47,6 @@ Item {
|
|||
ToolTip.text: qsTr("Expand")
|
||||
ToolTip.visible: containsMouse
|
||||
|
||||
visible: !isLiteMode
|
||||
hoverEnabled: true
|
||||
activeFocusOnTab: true
|
||||
|
||||
onClicked: mainWindow.isFullScreen = true
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
||||
|
@ -57,24 +54,12 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
UkuiItems.StyleBackground {
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
useStyleTransparency: false
|
||||
paletteRole: UkuiItems.Theme.Button
|
||||
alpha: parent.containsPress ? 1 : parent.containsMouse ? 0.7 : 0
|
||||
borderColor: UkuiItems.Theme.Highlight
|
||||
border.width: parent.activeFocus ? 2 : 0
|
||||
|
||||
ThemeIcon {
|
||||
anchors.centerIn: parent
|
||||
width: 16; height: 16
|
||||
source: "view-fullscreen-symbolic"
|
||||
}
|
||||
}
|
||||
background.radius: 4
|
||||
icon.mode: UkuiItems.Icon.AutoHighlight
|
||||
icon.source: "view-fullscreen-symbolic"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
UkuiItems.Button {
|
||||
id: powerButton
|
||||
Layout.preferredWidth: 36
|
||||
Layout.preferredHeight: 36
|
||||
|
@ -84,8 +69,10 @@ Item {
|
|||
ToolTip.visible: containsMouse
|
||||
ToolTip.text: powerButtonBase.toolTip
|
||||
|
||||
hoverEnabled: true
|
||||
activeFocusOnTab: true
|
||||
PowerButton {
|
||||
id: powerButtonBase
|
||||
}
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
property int spacingFromMenu: 16
|
||||
|
||||
|
@ -100,26 +87,9 @@ Item {
|
|||
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
|
||||
}
|
||||
|
||||
UkuiItems.StyleBackground {
|
||||
anchors.fill: parent
|
||||
paletteRole: UkuiItems.Theme.Button
|
||||
useStyleTransparency: false
|
||||
alpha: parent.containsPress ? 1 : parent.containsMouse ? 0.7 : 0
|
||||
radius: 4
|
||||
borderColor: UkuiItems.Theme.Highlight
|
||||
border.width: parent.activeFocus ? 2 : 0
|
||||
|
||||
PowerButton {
|
||||
id: powerButtonBase
|
||||
}
|
||||
|
||||
ThemeIcon {
|
||||
anchors.centerIn: parent
|
||||
width: 16
|
||||
height: 16
|
||||
source: powerButtonBase.icon
|
||||
}
|
||||
}
|
||||
background.radius: 4
|
||||
icon.mode: UkuiItems.Icon.AutoHighlight
|
||||
icon.source: powerButtonBase.icon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue