mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-23 04:14:35 +08:00
update
This commit is contained in:
parent
82f606dd65
commit
b442696f92
@ -72,6 +72,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"RadioButton"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_RadioButton.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
|
@ -22,7 +22,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
disabled: check_box_switch.checked
|
disabled: check_box_switch.checked
|
||||||
text:"Text"
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluCheckBox{
|
||||||
|
disabled: check_box_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
@ -16,7 +16,19 @@ FluScrollablePage{
|
|||||||
Action { text: qsTr("Open...") }
|
Action { text: qsTr("Open...") }
|
||||||
Action { text: qsTr("Save") }
|
Action { text: qsTr("Save") }
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Quit") }
|
Action {
|
||||||
|
text: qsTr("Quit")
|
||||||
|
onTriggered: {
|
||||||
|
showError("Quit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
text: qsTr("Disable")
|
||||||
|
enabled:false
|
||||||
|
onTriggered: {
|
||||||
|
showError("Disable")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Check");checkable: true;checked: true}
|
Action { text: qsTr("Check");checkable: true;checked: true}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
@ -104,6 +116,10 @@ menu.popup()
|
|||||||
Action { text: qsTr("Save") }
|
Action { text: qsTr("Save") }
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Quit") }
|
Action { text: qsTr("Quit") }
|
||||||
|
Action {
|
||||||
|
text: qsTr("Disable")
|
||||||
|
enabled:false
|
||||||
|
}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
title: "Save As..."
|
title: "Save As..."
|
||||||
Action { text: qsTr("Doc") }
|
Action { text: qsTr("Doc") }
|
||||||
|
50
example/qml/page/T_RadioButton.qml
Normal file
50
example/qml/page/T_RadioButton.qml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"RadioButton"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Row{
|
||||||
|
spacing: 30
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:radio_button_switch
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRadioButton{
|
||||||
|
text:"Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,11 +13,11 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 136
|
height: 128
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 10
|
spacing: 5
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -43,16 +43,15 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 168
|
height: 160
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 10
|
spacing: 5
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.navigation_view_display_mode
|
text:lang.navigation_view_display_mode
|
||||||
font: FluTextStyle.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
|
@ -26,7 +26,6 @@ FluScrollablePage{
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 200
|
height: 200
|
||||||
|
@ -22,6 +22,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
disabled: toggle_switch.checked
|
disabled: toggle_switch.checked
|
||||||
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
disabled: toggle_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
@ -219,7 +219,7 @@ CustomWindow {
|
|||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
target: canvas
|
target: canvas
|
||||||
property: "radius"
|
property: "radius"
|
||||||
duration: 666
|
duration: 333
|
||||||
easing.type: Easing.OutCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,20 +76,16 @@ Rectangle{
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: root.height
|
height: root.height
|
||||||
spacing: 0
|
spacing: 0
|
||||||
RowLayout{
|
FluToggleSwitch{
|
||||||
|
id:btn_dark
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.rightMargin: 5
|
Layout.rightMargin: 5
|
||||||
visible: showDark
|
visible: showDark
|
||||||
spacing: 5
|
text:darkText
|
||||||
FluText{
|
textColor:root.textColor
|
||||||
text:darkText
|
checked: FluTheme.dark
|
||||||
color:root.textColor
|
textRight: false
|
||||||
}
|
clickListener:()=> darkClickListener(btn_dark)
|
||||||
FluToggleSwitch{
|
|
||||||
id:btn_dark
|
|
||||||
checked: FluTheme.dark
|
|
||||||
clickListener:()=> darkClickListener(btn_dark)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
id:btn_minimize
|
id:btn_minimize
|
||||||
|
@ -11,7 +11,7 @@ Button {
|
|||||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -19,7 +19,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -44,7 +44,7 @@ Button {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
radius: 4
|
radius: 4
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
|
@ -19,6 +19,10 @@ Button {
|
|||||||
property color checkedPreesedColor: FluTheme.dark ? Qt.darker(checkedColor,1.3) : Qt.lighter(checkedColor,1.3)
|
property color checkedPreesedColor: FluTheme.dark ? Qt.darker(checkedColor,1.3) : Qt.lighter(checkedColor,1.3)
|
||||||
property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||||
|
property real size: 18
|
||||||
|
property alias textColor: btn_text.textColor
|
||||||
|
property bool textRight: true
|
||||||
|
property real textSpacing: 6
|
||||||
property var clickListener : function(){
|
property var clickListener : function(){
|
||||||
checked = !checked
|
checked = !checked
|
||||||
}
|
}
|
||||||
@ -39,13 +43,14 @@ Button {
|
|||||||
Accessible.onPressAction: control.clicked()
|
Accessible.onPressAction: control.clicked()
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
contentItem: RowLayout{
|
contentItem: RowLayout{
|
||||||
spacing: 4
|
spacing: control.textSpacing
|
||||||
|
layoutDirection:control.textRight ? Qt.LeftToRight : Qt.RightToLeft
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: 20
|
width: control.size
|
||||||
height: 20
|
height: control.size
|
||||||
radius: 4
|
radius: 4
|
||||||
border.color: {
|
border.color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return borderDisableColor
|
return borderDisableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -62,7 +67,7 @@ Button {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
color: {
|
color: {
|
||||||
if(checked){
|
if(checked){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return checkedDisableColor
|
return checkedDisableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -73,7 +78,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return checkedColor
|
return checkedColor
|
||||||
}
|
}
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(hovered){
|
if(hovered){
|
||||||
@ -100,8 +105,9 @@ Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:btn_text
|
||||||
text: control.text
|
text: control.text
|
||||||
Layout.leftMargin: 5
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ Button {
|
|||||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -20,7 +20,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -51,7 +51,7 @@ Button {
|
|||||||
radius:8
|
radius:8
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
|
@ -12,7 +12,7 @@ Button {
|
|||||||
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
|
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(173/255,173/255,173/255,1)
|
return Qt.rgba(173/255,173/255,173/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,1)
|
return Qt.rgba(0,0,0,1)
|
||||||
@ -38,7 +38,7 @@ Button {
|
|||||||
radius:4
|
radius:4
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
|
@ -14,7 +14,7 @@ Button {
|
|||||||
property color normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
property color normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
property color disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
property color color: {
|
property color color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -24,12 +24,12 @@ Button {
|
|||||||
}
|
}
|
||||||
property color iconColor: {
|
property color iconColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(130/255,130/255,130/255,1)
|
return Qt.rgba(130/255,130/255,130/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(161/255,161/255,161/255,1)
|
return Qt.rgba(161/255,161/255,161/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,1)
|
return Qt.rgba(0,0,0,1)
|
||||||
|
@ -5,6 +5,7 @@ import QtQuick.Templates as T
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.Menu {
|
T.Menu {
|
||||||
|
property bool animEnabled: true
|
||||||
id: control
|
id: control
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
contentWidth + leftPadding + rightPadding)
|
contentWidth + leftPadding + rightPadding)
|
||||||
@ -20,7 +21,7 @@ T.Menu {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: animEnabled ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit:Transition {
|
exit:Transition {
|
||||||
@ -28,7 +29,7 @@ T.Menu {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: animEnabled ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
@ -43,7 +44,7 @@ T.Menu {
|
|||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 34
|
||||||
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
@ -4,7 +4,28 @@ import QtQuick.Controls.impl
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.MenuBarItem {
|
T.MenuBarItem {
|
||||||
|
property bool disabled: false
|
||||||
|
property color textColor: {
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(disabled){
|
||||||
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(162/255,162/255,162/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(1,1,1,1)
|
||||||
|
}else{
|
||||||
|
if(disabled){
|
||||||
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(96/255,96/255,96/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
id: control
|
id: control
|
||||||
|
enabled: !disabled
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
@ -20,6 +41,7 @@ T.MenuBarItem {
|
|||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: control.text
|
text: control.text
|
||||||
|
color:control.textColor
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 30
|
implicitWidth: 30
|
||||||
|
@ -5,14 +5,31 @@ import QtQuick.Templates as T
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.MenuItem {
|
T.MenuItem {
|
||||||
|
property color textColor: {
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(!enabled){
|
||||||
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(162/255,162/255,162/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(1,1,1,1)
|
||||||
|
}else{
|
||||||
|
if(!enabled){
|
||||||
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(96/255,96/255,96/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
padding: 6
|
padding: 6
|
||||||
spacing: 6
|
spacing: 6
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
@ -22,10 +39,12 @@ T.MenuItem {
|
|||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
|
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
|
||||||
readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0
|
readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0
|
||||||
leftPadding: !control.mirrored ? indicatorPadding : arrowPadding
|
leftPadding: (!control.mirrored ? indicatorPadding : arrowPadding)+5
|
||||||
rightPadding: control.mirrored ? indicatorPadding : arrowPadding
|
rightPadding: (control.mirrored ? indicatorPadding : arrowPadding)+5
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: control.text
|
text: control.text
|
||||||
|
color: control.textColor
|
||||||
|
|
||||||
}
|
}
|
||||||
indicator: FluIcon {
|
indicator: FluIcon {
|
||||||
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
|
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
|
||||||
@ -39,24 +58,29 @@ T.MenuItem {
|
|||||||
visible: control.subMenu
|
visible: control.subMenu
|
||||||
iconSource: FluentIcons.ChevronRightMed
|
iconSource: FluentIcons.ChevronRightMed
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Item {
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 34
|
||||||
x: 1
|
x: 1
|
||||||
y: 1
|
y: 1
|
||||||
width: control.width - 2
|
width: control.width - 2
|
||||||
height: control.height - 2
|
height: control.height - 2
|
||||||
color:{
|
Rectangle{
|
||||||
if(FluTheme.dark){
|
anchors.fill: parent
|
||||||
if(control.highlighted){
|
anchors.margins: 2
|
||||||
return Qt.rgba(1,1,1,0.06)
|
radius: 4
|
||||||
|
color:{
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(control.highlighted){
|
||||||
|
return Qt.rgba(1,1,1,0.06)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
|
}else{
|
||||||
|
if(control.highlighted){
|
||||||
|
return Qt.rgba(0,0,0,0.03)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,0)
|
|
||||||
}else{
|
|
||||||
if(control.highlighted){
|
|
||||||
return Qt.rgba(0,0,0,0.03)
|
|
||||||
}
|
|
||||||
return Qt.rgba(0,0,0,0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ TextArea{
|
|||||||
width: 300
|
width: 300
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
@ -24,7 +24,7 @@ TextArea{
|
|||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
}
|
}
|
||||||
if(focus){
|
if(focus){
|
||||||
|
@ -6,13 +6,17 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
property string url
|
property string url : ""
|
||||||
id: control
|
id: control
|
||||||
visible: false
|
|
||||||
opacity: visible
|
opacity: visible
|
||||||
Behavior on opacity {
|
visible: false
|
||||||
|
Behavior on opacity{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
visible = true
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ TextField{
|
|||||||
width: 300
|
width: 300
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
@ -25,7 +25,7 @@ TextField{
|
|||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
}
|
}
|
||||||
if(focus){
|
if(focus){
|
||||||
|
@ -13,6 +13,9 @@ Button {
|
|||||||
property color hoverColor: checked ? FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
property color hoverColor: checked ? FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
||||||
property color disableColor: checked ? FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(159/255,159/255,159/255,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
property color disableColor: checked ? FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(159/255,159/255,159/255,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
||||||
property alias textColor: btn_text.textColor
|
property alias textColor: btn_text.textColor
|
||||||
|
property real size: 18
|
||||||
|
property bool textRight: true
|
||||||
|
property real textSpacing: 6
|
||||||
property var clickListener : function(){
|
property var clickListener : function(){
|
||||||
checked = !checked
|
checked = !checked
|
||||||
}
|
}
|
||||||
@ -33,28 +36,30 @@ Button {
|
|||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
onClicked: clickListener()
|
onClicked: clickListener()
|
||||||
contentItem: RowLayout{
|
contentItem: RowLayout{
|
||||||
|
spacing: control.textSpacing
|
||||||
|
layoutDirection:control.textRight ? Qt.LeftToRight : Qt.RightToLeft
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:rect_check
|
id:rect_check
|
||||||
width: 20
|
width: control.size
|
||||||
height: 20
|
height: control.size
|
||||||
radius: 10
|
radius: size/2
|
||||||
border.width: {
|
border.width: {
|
||||||
if(checked&&disabled){
|
if(checked&&!enabled){
|
||||||
return 4
|
return 3
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
if(checked){
|
|
||||||
return 5
|
|
||||||
}
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
if(hovered){
|
|
||||||
if(checked){
|
if(checked){
|
||||||
return 4
|
return 4
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return checked ? 5 : 1
|
if(hovered){
|
||||||
|
if(checked){
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return checked ? 4 : 1
|
||||||
}
|
}
|
||||||
Behavior on border.width {
|
Behavior on border.width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
@ -64,13 +69,13 @@ Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
border.color: {
|
border.color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return borderDisableColor
|
return borderDisableColor
|
||||||
}
|
}
|
||||||
return borderNormalColor
|
return borderNormalColor
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(hovered){
|
if(hovered){
|
||||||
|
@ -15,7 +15,7 @@ TextField{
|
|||||||
width: 300
|
width: 300
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
@ -24,7 +24,7 @@ TextField{
|
|||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
}
|
}
|
||||||
if(focus){
|
if(focus){
|
||||||
|
@ -9,6 +9,7 @@ FluMenu{
|
|||||||
property string selectAllText : "全选"
|
property string selectAllText : "全选"
|
||||||
property var inputItem
|
property var inputItem
|
||||||
id:menu
|
id:menu
|
||||||
|
animEnabled: false
|
||||||
width: 120
|
width: 120
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
if(visible){
|
||||||
|
@ -12,7 +12,7 @@ Button {
|
|||||||
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||||
property bool textBold: true
|
property bool textBold: true
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
|
@ -51,7 +51,7 @@ Button {
|
|||||||
radius:8
|
radius:8
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -69,7 +69,7 @@ Button {
|
|||||||
color: {
|
color: {
|
||||||
if(checked){
|
if(checked){
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(173/255,173/255,173/255,1)
|
return Qt.rgba(173/255,173/255,173/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,1)
|
return Qt.rgba(0,0,0,1)
|
||||||
@ -78,7 +78,7 @@ Button {
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
}
|
}
|
||||||
if(!checked){
|
if(!checked){
|
||||||
@ -88,7 +88,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
}
|
}
|
||||||
if(!checked){
|
if(!checked){
|
||||||
|
@ -7,7 +7,7 @@ import FluentUI
|
|||||||
Button {
|
Button {
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property string contentDescription: ""
|
property string contentDescription: ""
|
||||||
property color disableColor: checked ? FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(233/255,233/255,233/255,1) :FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(233/255,233/255,233/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(233/255,233/255,233/255,1)
|
||||||
property color checkColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color checkColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||||
@ -17,6 +17,9 @@ Button {
|
|||||||
property color dotNormalColor: FluTheme.dark ? Qt.rgba(208/255,208/255,208/255,1) : Qt.rgba(93/255,93/255,93/255,1)
|
property color dotNormalColor: FluTheme.dark ? Qt.rgba(208/255,208/255,208/255,1) : Qt.rgba(93/255,93/255,93/255,1)
|
||||||
property color dotCheckColor: FluTheme.dark ? Qt.rgba(0/255,0/255,0/255,1) : Qt.rgba(255/255,255/255,255/255,1)
|
property color dotCheckColor: FluTheme.dark ? Qt.rgba(0/255,0/255,0/255,1) : Qt.rgba(255/255,255/255,255/255,1)
|
||||||
property color dotDisableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(150/255,150/255,150/255,1)
|
property color dotDisableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(150/255,150/255,150/255,1)
|
||||||
|
property real textSpacing: 6
|
||||||
|
property bool textRight: true
|
||||||
|
property alias textColor: btn_text.textColor
|
||||||
property var clickListener : function(){
|
property var clickListener : function(){
|
||||||
checked = !checked
|
checked = !checked
|
||||||
}
|
}
|
||||||
@ -32,7 +35,8 @@ Button {
|
|||||||
onClicked: clickListener()
|
onClicked: clickListener()
|
||||||
contentItem: Item{}
|
contentItem: Item{}
|
||||||
background : RowLayout{
|
background : RowLayout{
|
||||||
spacing: 0
|
spacing: control.textSpacing
|
||||||
|
layoutDirection:control.textRight ? Qt.LeftToRight : Qt.RightToLeft
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:control_backgound
|
id:control_backgound
|
||||||
width: 40
|
width: 40
|
||||||
@ -43,7 +47,7 @@ Button {
|
|||||||
radius: 20
|
radius: 20
|
||||||
}
|
}
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -56,7 +60,7 @@ Button {
|
|||||||
}
|
}
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: {
|
border.color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return borderDisableColor
|
return borderDisableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -74,10 +78,10 @@ Button {
|
|||||||
}
|
}
|
||||||
height: 20
|
height: 20
|
||||||
radius: 10
|
radius: 10
|
||||||
scale: hovered&!disabled ? 7/10 : 6/10
|
scale: hovered&enabled ? 7/10 : 6/10
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return dotDisableColor
|
return dotDisableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -96,28 +100,25 @@ Button {
|
|||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:btn_text
|
||||||
text: control.text
|
text: control.text
|
||||||
Layout.leftMargin: 5
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user