This commit is contained in:
zhuzichu
2023-09-11 18:10:50 +08:00
parent 0297445218
commit 05040ec4a9
18 changed files with 2055 additions and 27 deletions

View File

@ -0,0 +1,40 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
FluButton {
property bool loading: false
id: control
disabled: loading
contentItem: Row{
spacing: 6
FluText {
text: control.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font: control.font
color: control.textColor
anchors.verticalCenter: parent.verticalCenter
}
Item{
width: control.loading ? 16 : 0
height: 16
anchors.verticalCenter: parent.verticalCenter
visible: width!==0
clip: true
Behavior on width {
enabled: FluTheme.enableAnimation
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
FluProgressRing{
width: 16
height: 16
strokeWidth:3
anchors.centerIn: parent
}
}
}
}

View File

@ -27,28 +27,31 @@ Button {
Accessible.name: control.text
Accessible.description: contentDescription
Accessible.onPressAction: control.clicked()
height: 20
enabled: !disabled
implicitHeight: height
focusPolicy:Qt.TabFocus
onClicked: clickListener()
padding: 0
horizontalPadding: 0
onCheckableChanged: {
if(checkable){
checkable = false
}
}
contentItem: Item{}
background : RowLayout{
background : Item{
implicitHeight: 20
implicitWidth: 40
}
contentItem: RowLayout{
spacing: control.textSpacing
layoutDirection:control.textRight ? Qt.LeftToRight : Qt.RightToLeft
Rectangle {
id:control_backgound
width: 40
height: control.height
width: background.width
height: background.height
radius: height / 2
FluFocusRectangle{
visible: control.activeFocus
radius: 20
radius: parent.radius
}
color: {
if(!enabled){
@ -73,10 +76,10 @@ Button {
return borderNormalColor
}
Rectangle {
width: 20
width: parent.height
x:checked ? control_backgound.width-width : 0
height: 20
radius: 10
height: width
radius: width/2
scale: hovered&enabled ? 7/10 : 6/10
color: {
if(!enabled){

File diff suppressed because it is too large Load Diff

View File

@ -95,4 +95,5 @@ FluWindow 1.0 Controls/FluWindow.qml
FluRangeSlider 1.0 Controls/FluRangeSlider.qml
FluStaggeredView 1.0 Controls/FluStaggeredView.qml
FluProgressButton 1.0 Controls/FluProgressButton.qml
FluLoadingButton 1.0 Controls/FluLoadingButton.qml
plugin fluentuiplugin

View File

@ -95,5 +95,6 @@
<file>FluentUI/Controls/ColorPicker/Content/NumberBox.qml</file>
<file>FluentUI/Controls/ColorPicker/Content/PanelBorder.qml</file>
<file>FluentUI/Controls/ColorPicker/Content/SBPicker.qml</file>
<file>FluentUI/Controls/FluLoadingButton.qml</file>
</qresource>
</RCC>