Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
82be3b12e3 | |||
1c0f5acaf8 | |||
243f8aa248 | |||
cbb8c3122b | |||
9f2c58306c | |||
adc3558e02 | |||
98d73eb6cb | |||
b442696f92 | |||
82f606dd65 | |||
4efb91084a | |||
103dbe9d56 |
0
doc/preview/demo_content_dialog.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
doc/preview/demo_filledbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
doc/preview/demo_icon.png
Executable file → Normal file
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
0
doc/preview/demo_infobar.png
Executable file → Normal file
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
0
doc/preview/demo_large.png
Executable file → Normal file
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 192 KiB |
0
doc/preview/demo_multiline_textbox.png
Executable file → Normal file
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
0
doc/preview/demo_progress_bar_ring.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
doc/preview/demo_radiobtn.png
Executable file → Normal file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
doc/preview/demo_rectangle.png
Executable file → Normal file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
0
doc/preview/demo_slider.png
Executable file → Normal file
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 997 B |
0
doc/preview/demo_standardbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
doc/preview/demo_textbox.png
Executable file → Normal file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
doc/preview/demo_textbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
doc/preview/demo_toggle_switch.png
Executable file → Normal file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
doc/preview/demo_tooltip.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
doc/preview/demo_tree_view.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
doc/preview/qt_creator_project.png
Executable file → Normal file
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
@ -20,7 +20,7 @@ endif()
|
|||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,5,0)
|
add_definitions(-DVERSION=1,3,6,0)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
@ -131,7 +131,9 @@ FluExpander{
|
|||||||
"FluCopyableText",
|
"FluCopyableText",
|
||||||
"FluAcrylic",
|
"FluAcrylic",
|
||||||
"FluRemoteLoader",
|
"FluRemoteLoader",
|
||||||
"FluMenuBar"
|
"FluMenuBar",
|
||||||
|
"FluPagination",
|
||||||
|
"FluRadioButtons"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
|
@ -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:{
|
||||||
@ -253,9 +259,9 @@ FluObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TableView2"
|
title:"Pagination"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/example/qml/page/T_TableView2.qml")
|
navigationView.push("qrc:/example/qml/page/T_Pagination.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
|
@ -58,6 +58,7 @@ FluScrollablePage{
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +221,9 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluMenuItem{
|
FluMenuItem{
|
||||||
text:"Menu_4"
|
text:"Menu_4"
|
||||||
|
onClicked: {
|
||||||
|
console.debug(parent.height)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
@ -259,24 +262,23 @@ FluScrollablePage{
|
|||||||
height: 100
|
height: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
ColumnLayout{
|
FluRadioButtons{
|
||||||
spacing: 8
|
spacing: 8
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
Repeater{
|
FluRadioButton{
|
||||||
id:repeater
|
disabled:radio_button_switch.checked
|
||||||
property int selecIndex : 0
|
text:"Radio Button_1"
|
||||||
model: 3
|
}
|
||||||
delegate: FluRadioButton{
|
FluRadioButton{
|
||||||
checked : repeater.selecIndex===index
|
disabled:radio_button_switch.checked
|
||||||
disabled:radio_button_switch.checked
|
text:"Radio Button_2"
|
||||||
text:"Radio Button_"+index
|
}
|
||||||
clickListener:function(){
|
FluRadioButton{
|
||||||
repeater.selecIndex = index
|
disabled:radio_button_switch.checked
|
||||||
}
|
text:"Radio Button_3"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
@ -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{
|
||||||
|
@ -27,7 +27,7 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Item{
|
Item{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
ColumnLayout{
|
FluRadioButtons{
|
||||||
spacing: 8
|
spacing: 8
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
@ -35,17 +35,14 @@ FluScrollablePage{
|
|||||||
topMargin: 15
|
topMargin: 15
|
||||||
leftMargin: 15
|
leftMargin: 15
|
||||||
}
|
}
|
||||||
Repeater{
|
FluRadioButton{
|
||||||
id:repeater
|
text:"Radio Button_1"
|
||||||
property int selecIndex : 0
|
}
|
||||||
model: 3
|
FluRadioButton{
|
||||||
delegate: FluRadioButton{
|
text:"Radio Button_2"
|
||||||
checked : repeater.selecIndex===index
|
}
|
||||||
text:"Radio Button_"+index
|
FluRadioButton{
|
||||||
clickListener:function() {
|
text:"Radio Button_3"
|
||||||
repeater.selecIndex = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ FluScrollablePage{
|
|||||||
desc:"The latest FluentUI controls and styles for your applications."
|
desc:"The latest FluentUI controls and styles for your applications."
|
||||||
url:"https://github.com/zhuzichu520/FluentUI"
|
url:"https://github.com/zhuzichu520/FluentUI"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
|
@ -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") }
|
||||||
|
49
example/qml/page/T_Pagination.qml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Pagination"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 200
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 20
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 1
|
||||||
|
pageButtonCount: 5
|
||||||
|
itemCount: 5000
|
||||||
|
}
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 2
|
||||||
|
itemCount: 5000
|
||||||
|
pageButtonCount: 7
|
||||||
|
}
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 3
|
||||||
|
itemCount: 5000
|
||||||
|
pageButtonCount: 9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluPagination{
|
||||||
|
pageCurrent: 1
|
||||||
|
itemCount: 1000
|
||||||
|
pageButtonCount: 9
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -33,12 +33,14 @@ FluScrollablePage{
|
|||||||
indeterminate: false
|
indeterminate: false
|
||||||
}
|
}
|
||||||
FluSlider{
|
FluSlider{
|
||||||
value:50
|
|
||||||
onValueChanged:{
|
onValueChanged:{
|
||||||
var progress = value/100
|
var progress = value/100
|
||||||
progress_bar.progress = progress
|
progress_bar.progress = progress
|
||||||
progress_ring.progress = progress
|
progress_ring.progress = progress
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
value = 50
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
101
example/qml/page/T_RadioButton.qml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
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"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluRadioButtons{
|
||||||
|
spacing: 8
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_1"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_2"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:radio_button_switch2
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRadioButtons{
|
||||||
|
spacing: 8
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_1"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_2"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_3"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
||||||
|
@ -5,162 +5,12 @@ import QtQuick.Window
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluContentPage{
|
||||||
|
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const columns = [
|
loadData(1,2000)
|
||||||
{
|
|
||||||
title: '姓名',
|
|
||||||
dataIndex: 'name',
|
|
||||||
width:100,
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '年龄',
|
|
||||||
dataIndex: 'item_age',
|
|
||||||
width:100,
|
|
||||||
minimumWidth:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '住址',
|
|
||||||
dataIndex: 'address',
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '别名',
|
|
||||||
dataIndex: 'nickname',
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'action',
|
|
||||||
width:120
|
|
||||||
},
|
|
||||||
];
|
|
||||||
table_view.columns = columns
|
|
||||||
loadData(1,10)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_age
|
|
||||||
Item{
|
|
||||||
id:item_age
|
|
||||||
property var ageArr: [100,300,500,1000]
|
|
||||||
height: 60
|
|
||||||
FluComboBox{
|
|
||||||
width: 80
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 10
|
|
||||||
}
|
|
||||||
model: ListModel {
|
|
||||||
ListElement { text: 100 }
|
|
||||||
ListElement { text: 300 }
|
|
||||||
ListElement { text: 500 }
|
|
||||||
ListElement { text: 1000 }
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
currentIndex=ageArr.findIndex((element) => element === dataModel.age)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_action
|
|
||||||
Item{
|
|
||||||
height: 60
|
|
||||||
Row{
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: 10
|
|
||||||
FluFilledButton{
|
|
||||||
text:"编辑"
|
|
||||||
horizontalPadding: 6
|
|
||||||
onClicked:{
|
|
||||||
showError(JSON.stringify(dataObject))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluFilledButton{
|
|
||||||
text:"删除"
|
|
||||||
horizontalPadding: 6
|
|
||||||
onClicked:{
|
|
||||||
table_view.remove(dataModel.index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
|
||||||
Layout.topMargin: 20
|
|
||||||
text:"此TableView适用于小数据量,带分页的表格,大数据量请使用TableView2。"
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTableView{
|
|
||||||
id:table_view
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 20
|
|
||||||
pageCurrent:1
|
|
||||||
pageCount:10
|
|
||||||
itemCount: 1000
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
loadData(page,count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeExpander{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 10
|
|
||||||
code:'FluTableView{
|
|
||||||
id:table_view
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 20
|
|
||||||
pageCurrent:1
|
|
||||||
pageCount:10
|
|
||||||
itemCount: 1000
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
loadData(page,count)
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: "姓名",
|
|
||||||
dataIndex: "name",
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "年龄",
|
|
||||||
dataIndex: "age",
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "住址",
|
|
||||||
dataIndex: "address",
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "别名",
|
|
||||||
dataIndex: "nickname",
|
|
||||||
width:100
|
|
||||||
}
|
|
||||||
];
|
|
||||||
table_view.columns = columns
|
|
||||||
const dataSource = [
|
|
||||||
{
|
|
||||||
name: "孙悟空”,
|
|
||||||
age: 500,
|
|
||||||
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
|
||||||
nickname:"齐天大圣"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
table_view.dataSource = columns
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
@ -188,13 +38,68 @@ FluScrollablePage{
|
|||||||
for(var i=0;i<count;i++){
|
for(var i=0;i<count;i++){
|
||||||
dataSource.push({
|
dataSource.push({
|
||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
item_age: com_age,
|
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname(),
|
nickname: getRandomNickname()
|
||||||
action:com_action
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
table_view.dataSource = dataSource
|
table_view.dataSource = dataSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_combobox
|
||||||
|
|
||||||
|
FluComboBox {
|
||||||
|
anchors.fill: parent
|
||||||
|
currentIndex: display
|
||||||
|
editable: true
|
||||||
|
model: ListModel {
|
||||||
|
ListElement { text: 100 }
|
||||||
|
ListElement { text: 300 }
|
||||||
|
ListElement { text: 500 }
|
||||||
|
ListElement { text: 1000 }
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||||
|
selectAll()
|
||||||
|
}
|
||||||
|
TableView.onCommit: {
|
||||||
|
display = editText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluTableView{
|
||||||
|
id:table_view
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 20
|
||||||
|
columnSource:[
|
||||||
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width:100,
|
||||||
|
minimumWidth:50
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '年龄',
|
||||||
|
dataIndex: 'age',
|
||||||
|
editDelegate:com_combobox,
|
||||||
|
width:100,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '住址',
|
||||||
|
dataIndex: 'address',
|
||||||
|
width:200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '别名',
|
||||||
|
dataIndex: 'nickname',
|
||||||
|
width:100,
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Window
|
|
||||||
import FluentUI
|
|
||||||
import "qrc:///example/qml/component"
|
|
||||||
|
|
||||||
FluContentPage{
|
|
||||||
|
|
||||||
title:"TableView2"
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loadData(1,2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadData(page,count){
|
|
||||||
var numbers = [100, 300, 500, 1000];
|
|
||||||
function getRandomAge() {
|
|
||||||
var randomIndex = Math.floor(Math.random() * numbers.length);
|
|
||||||
return numbers[randomIndex];
|
|
||||||
}
|
|
||||||
var names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"];
|
|
||||||
function getRandomName(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * names.length);
|
|
||||||
return names[randomIndex];
|
|
||||||
}
|
|
||||||
var nicknames = ["复海大圣","混天大圣","移山大圣","通风大圣","驱神大圣","齐天大圣","平天大圣"]
|
|
||||||
function getRandomNickname(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * nicknames.length);
|
|
||||||
return nicknames[randomIndex];
|
|
||||||
}
|
|
||||||
var addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
|
|
||||||
function getRandomAddresses(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * addresses.length);
|
|
||||||
return addresses[randomIndex];
|
|
||||||
}
|
|
||||||
const dataSource = []
|
|
||||||
for(var i=0;i<count;i++){
|
|
||||||
dataSource.push({
|
|
||||||
name: getRandomName(),
|
|
||||||
age:getRandomAge(),
|
|
||||||
address: getRandomAddresses(),
|
|
||||||
nickname: getRandomNickname()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
table_view.dataSource = dataSource
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_combobox
|
|
||||||
|
|
||||||
FluComboBox {
|
|
||||||
anchors.fill: parent
|
|
||||||
currentIndex: display
|
|
||||||
editable: true
|
|
||||||
model: ListModel {
|
|
||||||
ListElement { text: 100 }
|
|
||||||
ListElement { text: 300 }
|
|
||||||
ListElement { text: 500 }
|
|
||||||
ListElement { text: 1000 }
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
TableView.onCommit: {
|
|
||||||
display = editText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTableView2{
|
|
||||||
id:table_view
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: 20
|
|
||||||
columnSource:[
|
|
||||||
{
|
|
||||||
title: '姓名',
|
|
||||||
dataIndex: 'name',
|
|
||||||
width:100,
|
|
||||||
minimumWidth:50
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '年龄',
|
|
||||||
dataIndex: 'age',
|
|
||||||
editDelegate:com_combobox,
|
|
||||||
width:100,
|
|
||||||
minimumWidth:100,
|
|
||||||
maximumWidth: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '住址',
|
|
||||||
dataIndex: 'address',
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '别名',
|
|
||||||
dataIndex: 'nickname',
|
|
||||||
width:100,
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -7,8 +7,9 @@ import "qrc:///example/qml/component"
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TextBox"
|
pageMode: FluNavigationView.SingleInstance
|
||||||
|
|
||||||
|
title:"TextBox"
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ endif()
|
|||||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,5,0)
|
add_definitions(-DVERSION=1,3,6,0)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
@ -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 !== ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ ComboBox {
|
|||||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
||||||
palette.text: control.palette.text
|
palette.text: control.palette.text
|
||||||
palette.highlightedText: control.palette.highlightedText
|
palette.highlightedText: control.palette.highlightedText
|
||||||
font.bold: control.currentIndex === index
|
|
||||||
highlighted: control.highlightedIndex === index
|
highlighted: control.highlightedIndex === index
|
||||||
hoverEnabled: control.hoverEnabled
|
hoverEnabled: control.hoverEnabled
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,13 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
FluPage {
|
||||||
property alias title: text_title.text
|
property alias title: text_title.text
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property int leftPadding: 10
|
property int leftPadding: 10
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
property int rightPadding: 10
|
property int rightPadding: 10
|
||||||
property int bottomPadding: 10
|
property int bottomPadding: 10
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
|
||||||
property string url: ''
|
|
||||||
id:control
|
id:control
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
|
@ -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
|
||||||
@ -77,7 +77,7 @@ Button {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
if(items && menu.count !==0){
|
if(items && menu.count !==0){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
var containerHeight = menu.height
|
var containerHeight = menu.count*36
|
||||||
if(window.height>pos.y+control.height+containerHeight){
|
if(window.height>pos.y+control.height+containerHeight){
|
||||||
menu.y = control.height
|
menu.y = control.height
|
||||||
}else if(pos.y>containerHeight){
|
}else if(pos.y>containerHeight){
|
||||||
@ -90,6 +90,7 @@ Button {
|
|||||||
}
|
}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
id:menu
|
id:menu
|
||||||
|
modal:true
|
||||||
width: control.width
|
width: control.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,7 @@ Item {
|
|||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: expand ? [ 0, 0, 0, 1 ] : [ 1, 0, 0, 0 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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){
|
||||||
|
@ -9,12 +9,12 @@ Button {
|
|||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int radius:4
|
property int radius:4
|
||||||
property string contentDescription: ""
|
property string contentDescription: ""
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
property color pressedColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.06)
|
property color pressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||||
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,34 +5,32 @@ 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)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
contentHeight + topPadding + bottomPadding)
|
contentHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
margins: 0
|
margins: 0
|
||||||
overlap: 1
|
overlap: 1
|
||||||
spacing: 0
|
spacing: 0
|
||||||
delegate: FluMenuItem { }
|
delegate: FluMenuItem { }
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
reversible: true
|
NumberAnimation {
|
||||||
NumberAnimation {
|
property: "opacity"
|
||||||
property: "opacity"
|
from:0
|
||||||
from:0
|
to:1
|
||||||
to:1
|
duration: animEnabled ? 83 : 0
|
||||||
duration: 83
|
}
|
||||||
}
|
}
|
||||||
}
|
exit:Transition {
|
||||||
exit:Transition {
|
NumberAnimation {
|
||||||
NumberAnimation {
|
property: "opacity"
|
||||||
property: "opacity"
|
from:1
|
||||||
from:1
|
to:0
|
||||||
to:0
|
duration: animEnabled ? 83 : 0
|
||||||
duration: 83
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
model: control.contentModel
|
model: control.contentModel
|
||||||
@ -43,22 +41,18 @@ T.Menu {
|
|||||||
currentIndex: control.currentIndex
|
currentIndex: control.currentIndex
|
||||||
ScrollIndicator.vertical: ScrollIndicator {}
|
ScrollIndicator.vertical: ScrollIndicator {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 36
|
||||||
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
|
||||||
radius: 5
|
radius: 5
|
||||||
FluShadow{}
|
FluShadow{}
|
||||||
}
|
}
|
||||||
|
|
||||||
T.Overlay.modal: Rectangle {
|
T.Overlay.modal: Rectangle {
|
||||||
color: Color.transparent(control.palette.shadow, 0.5)
|
color: Color.transparent(control.palette.shadow, 0.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
T.Overlay.modeless: Rectangle {
|
T.Overlay.modeless: Rectangle {
|
||||||
color: Color.transparent(control.palette.shadow, 0.12)
|
color: Color.transparent(control.palette.shadow, 0.12)
|
||||||
}
|
}
|
||||||
|
@ -4,21 +4,17 @@ import QtQuick.Controls.impl
|
|||||||
|
|
||||||
T.MenuBar {
|
T.MenuBar {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
contentWidth + leftPadding + rightPadding)
|
contentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
contentHeight + topPadding + bottomPadding)
|
contentHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
delegate: FluMenuBarItem { }
|
delegate: FluMenuBarItem { }
|
||||||
|
|
||||||
contentItem: Row {
|
contentItem: Row {
|
||||||
spacing: control.spacing
|
spacing: control.spacing
|
||||||
Repeater {
|
Repeater {
|
||||||
model: control.contentModel
|
model: control.contentModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
}
|
}
|
||||||
|
@ -4,28 +4,45 @@ 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,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
spacing: 6
|
spacing: 6
|
||||||
padding: 6
|
padding: 6
|
||||||
leftPadding: 12
|
leftPadding: 12
|
||||||
rightPadding: 16
|
rightPadding: 16
|
||||||
|
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.color: control.palette.buttonText
|
icon.color: control.palette.buttonText
|
||||||
|
|
||||||
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
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
@ -5,64 +5,82 @@ 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
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.color: control.palette.windowText
|
icon.color: control.palette.windowText
|
||||||
|
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
|
||||||
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
|
||||||
y: control.topPadding + (control.availableHeight - height) / 2
|
y: control.topPadding + (control.availableHeight - height) / 2
|
||||||
visible: control.checked
|
visible: control.checked
|
||||||
iconSource: FluentIcons.CheckMark
|
iconSource: FluentIcons.CheckMark
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow: FluIcon {
|
arrow: FluIcon {
|
||||||
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
|
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
|
||||||
y: control.topPadding + (control.availableHeight - height) / 2
|
y: control.topPadding + (control.availableHeight - height) / 2
|
||||||
visible: control.subMenu
|
visible: control.subMenu
|
||||||
iconSource: FluentIcons.ChevronRightMed
|
iconSource: FluentIcons.ChevronRightMed
|
||||||
}
|
}
|
||||||
|
background: Item {
|
||||||
background: Rectangle {
|
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 36
|
||||||
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: 3
|
||||||
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.06)
|
||||||
|
}
|
||||||
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,12 @@ import FluentUI
|
|||||||
|
|
||||||
T.MenuSeparator {
|
T.MenuSeparator {
|
||||||
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)
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
verticalPadding: 0
|
verticalPadding: 0
|
||||||
|
|
||||||
contentItem: Rectangle {
|
contentItem: Rectangle {
|
||||||
implicitWidth: 188
|
implicitWidth: 188
|
||||||
implicitHeight: 1
|
implicitHeight: 1
|
||||||
|
@ -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){
|
||||||
|
@ -15,7 +15,8 @@ Item {
|
|||||||
enum PageModeFlag{
|
enum PageModeFlag{
|
||||||
Standard = 0,
|
Standard = 0,
|
||||||
SingleTask = 1,
|
SingleTask = 1,
|
||||||
SingleTop = 2
|
SingleTop = 2,
|
||||||
|
SingleInstance = 3
|
||||||
}
|
}
|
||||||
property url logo
|
property url logo
|
||||||
property string title: ""
|
property string title: ""
|
||||||
@ -30,6 +31,7 @@ Item {
|
|||||||
id:control
|
id:control
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
|
property var pageMap: ({})
|
||||||
property var stackItems: []
|
property var stackItems: []
|
||||||
property int displayMode: FluNavigationView.Open
|
property int displayMode: FluNavigationView.Open
|
||||||
property bool enableNavigationPanel: false
|
property bool enableNavigationPanel: false
|
||||||
@ -120,8 +122,7 @@ Item {
|
|||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,8 +139,7 @@ Item {
|
|||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
@ -331,8 +331,7 @@ Item {
|
|||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
@ -490,7 +489,7 @@ Item {
|
|||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: d
|
target: d
|
||||||
function onIsCompactAndNotPanelChanged(){
|
function onIsCompactAndNotPanelChanged(){
|
||||||
if(item_dot_loader.item){
|
if(item_dot_loader.item){
|
||||||
item_dot_loader.item.isDot = d.isCompactAndNotPanel
|
item_dot_loader.item.isDot = d.isCompactAndNotPanel
|
||||||
}
|
}
|
||||||
@ -532,6 +531,20 @@ Item {
|
|||||||
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
||||||
}
|
}
|
||||||
nav_list.currentIndex = item.idx
|
nav_list.currentIndex = item.idx
|
||||||
|
if(nav_swipe.currentItem.pageMode === FluNavigationView.SingleInstance){
|
||||||
|
var url = nav_swipe.currentItem.url
|
||||||
|
var pageIndex = -1
|
||||||
|
for(var i=0;i<nav_swipe2.children.length;i++){
|
||||||
|
var obj = nav_swipe2.children[i]
|
||||||
|
if(obj.url === url){
|
||||||
|
pageIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pageIndex !== -1){
|
||||||
|
nav_swipe2.currentIndex = pageIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
@ -555,8 +568,7 @@ Item {
|
|||||||
Behavior on Layout.preferredWidth {
|
Behavior on Layout.preferredWidth {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,39 +634,27 @@ Item {
|
|||||||
Behavior on anchors.leftMargin {
|
Behavior on anchors.leftMargin {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StackView{
|
StackView{
|
||||||
id:nav_swipe
|
id:nav_swipe
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
|
visible: !nav_swipe2.visible
|
||||||
popEnter : Transition{}
|
popEnter : Transition{}
|
||||||
popExit : Transition {
|
popExit : Transition {}
|
||||||
NumberAnimation {
|
pushEnter: Transition {}
|
||||||
properties: "y"
|
|
||||||
from: 0
|
|
||||||
to: nav_swipe.height
|
|
||||||
duration: dontPageAnimation ? 0 : 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pushEnter: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "y";
|
|
||||||
from: nav_swipe.height;
|
|
||||||
to: 0
|
|
||||||
duration: dontPageAnimation ? 0 : 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pushExit : Transition{}
|
pushExit : Transition{}
|
||||||
replaceEnter : Transition{}
|
replaceEnter : Transition{}
|
||||||
replaceExit : Transition{}
|
replaceExit : Transition{}
|
||||||
}
|
}
|
||||||
|
StackLayout{
|
||||||
|
id:nav_swipe2
|
||||||
|
anchors.fill: nav_swipe
|
||||||
|
clip: true
|
||||||
|
visible: nav_swipe.currentItem.pageMode === FluNavigationView.SingleInstance
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -690,15 +690,13 @@ Item {
|
|||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.InCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: {
|
visible: {
|
||||||
@ -763,7 +761,7 @@ Item {
|
|||||||
clip: true
|
clip: true
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
model:d.handleItems()
|
model:d.handleItems()
|
||||||
highlightMoveDuration: 150
|
highlightMoveDuration: 167
|
||||||
highlight: Item{
|
highlight: Item{
|
||||||
clip: true
|
clip: true
|
||||||
Rectangle{
|
Rectangle{
|
||||||
@ -872,7 +870,7 @@ Item {
|
|||||||
if(!d.isCompact){
|
if(!d.isCompact){
|
||||||
control_popup.close()
|
control_popup.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
padding: 0
|
padding: 0
|
||||||
focus: true
|
focus: true
|
||||||
@ -887,14 +885,21 @@ Item {
|
|||||||
delegate:Button{
|
delegate:Button{
|
||||||
id:item_button
|
id:item_button
|
||||||
width: 180
|
width: 180
|
||||||
padding:10
|
height: 38
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
color: {
|
color: {
|
||||||
if(hovered){
|
if(FluTheme.dark){
|
||||||
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
if(item_button.hovered){
|
||||||
|
return Qt.rgba(1,1,1,0.06)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
|
}else{
|
||||||
|
if(item_button.hovered){
|
||||||
|
return Qt.rgba(0,0,0,0.03)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
}
|
}
|
||||||
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
|
||||||
}
|
}
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: item_button.activeFocus
|
visible: item_button.activeFocus
|
||||||
@ -921,6 +926,7 @@ Item {
|
|||||||
text:modelData.title
|
text:modelData.title
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
rightPadding: item_dot_loader.width
|
rightPadding: item_dot_loader.width
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
@ -976,6 +982,16 @@ Item {
|
|||||||
function getItems(){
|
function getItems(){
|
||||||
return nav_list.model
|
return nav_list.model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_placeholder
|
||||||
|
Item{
|
||||||
|
property int pageMode: FluNavigationView.SingleInstance
|
||||||
|
property string url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function push(url,argument={}){
|
function push(url,argument={}){
|
||||||
let page = nav_swipe.find(function(item) {
|
let page = nav_swipe.find(function(item) {
|
||||||
return item.url === url;
|
return item.url === url;
|
||||||
@ -999,8 +1015,35 @@ Item {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nav_swipe.push(url,Object.assign(argument,{url:url}))
|
var comp = Qt.createComponent(url)
|
||||||
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
if (comp.status === Component.Ready) {
|
||||||
|
//先判断nav_swipe2中是否有当前url数据
|
||||||
|
var pageIndex = -1
|
||||||
|
for(var i=0;i<nav_swipe2.children.length;i++){
|
||||||
|
var item = nav_swipe2.children[i]
|
||||||
|
if(item.url === url){
|
||||||
|
pageIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var options = Object.assign(argument,{url:url})
|
||||||
|
if(pageIndex!==-1){
|
||||||
|
nav_swipe2.currentIndex = pageIndex
|
||||||
|
nav_swipe.push(com_placeholder,options)
|
||||||
|
}else{
|
||||||
|
var obj = comp.createObject(nav_swipe,options)
|
||||||
|
if(obj.pageMode === FluNavigationView.SingleInstance){
|
||||||
|
nav_swipe.push(com_placeholder,options)
|
||||||
|
nav_swipe2.children.push(obj)
|
||||||
|
nav_swipe2.currentIndex = nav_swipe2.count - 1
|
||||||
|
}else{
|
||||||
|
nav_swipe.push(obj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
||||||
|
}else{
|
||||||
|
console.error(comp.errorString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function getCurrentIndex(){
|
function getCurrentIndex(){
|
||||||
return nav_list.currentIndex
|
return nav_list.currentIndex
|
||||||
|
@ -3,6 +3,6 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
default property list<QtObject> children;
|
default property list<QtObject> children
|
||||||
id:flu_object;
|
id:control
|
||||||
}
|
}
|
||||||
|
22
src/imports/FluentUI/Controls/FluPage.qml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
|
property string url : ""
|
||||||
|
id: control
|
||||||
|
opacity: visible
|
||||||
|
visible: false
|
||||||
|
Behavior on opacity{
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,9 +9,9 @@ Item {
|
|||||||
property string nextText: "下一页>"
|
property string nextText: "下一页>"
|
||||||
property int pageCurrent: 0
|
property int pageCurrent: 0
|
||||||
property int itemCount: 0
|
property int itemCount: 0
|
||||||
|
property int pageButtonCount: 5
|
||||||
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
||||||
property int __itemPerPage: 10
|
property int __itemPerPage: 10
|
||||||
property int pageButtonCount: 5
|
|
||||||
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
||||||
id: control
|
id: control
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
@ -34,7 +34,6 @@ Item {
|
|||||||
FluToggleButton{
|
FluToggleButton{
|
||||||
property int pageNumber:1
|
property int pageNumber:1
|
||||||
visible: control.pageCount>0
|
visible: control.pageCount>0
|
||||||
enabled: control.pageCurrent>1
|
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text:String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener:function() {
|
clickListener:function() {
|
||||||
|
@ -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){
|
||||||
|
@ -27,7 +27,8 @@ Item {
|
|||||||
clip: true
|
clip: true
|
||||||
spacing: 20
|
spacing: 20
|
||||||
interactive: false
|
interactive: false
|
||||||
orientation:ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
|
highlightMoveDuration: 167
|
||||||
highlight: Item{
|
highlight: Item{
|
||||||
clip: true
|
clip: true
|
||||||
Rectangle{
|
Rectangle{
|
||||||
@ -38,7 +39,8 @@ Item {
|
|||||||
y:37
|
y:37
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 150
|
duration: 167
|
||||||
|
easing.type: Easing.InCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,11 +63,6 @@ Item {
|
|||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transitions: Transition {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 400;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
nav_list.currentIndex = index
|
nav_list.currentIndex = index
|
||||||
|
@ -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){
|
||||||
|
30
src/imports/FluentUI/Controls/FluRadioButtons.qml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
default property alias buttons: control.data
|
||||||
|
property int currentIndex : -1
|
||||||
|
id:control
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
for(var i = 0;i<buttons.length;i++){
|
||||||
|
buttons[i].checked = false
|
||||||
|
}
|
||||||
|
buttons[currentIndex].checked = true
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
for(var i = 0;i<buttons.length;i++){
|
||||||
|
buttons[i].clickListener = function(){
|
||||||
|
for(var i = 0;i<buttons.length;i++){
|
||||||
|
var button = buttons[i]
|
||||||
|
if(this === button){
|
||||||
|
currentIndex = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentIndex = 0
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
FluPage {
|
||||||
property alias title: text_title.text
|
property alias title: text_title.text
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property int spacing : 0
|
property int spacing : 0
|
||||||
@ -12,8 +12,6 @@ Item {
|
|||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
property int rightPadding: 10
|
property int rightPadding: 10
|
||||||
property int bottomPadding: 10
|
property int bottomPadding: 10
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
|
||||||
property string url: ''
|
|
||||||
id:control
|
id:control
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Templates as T
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.Slider {
|
T.Slider {
|
||||||
|
property bool tooltipEnabled: true
|
||||||
id: control
|
id: control
|
||||||
to:100
|
to:100
|
||||||
stepSize:1
|
stepSize:1
|
||||||
@ -11,9 +12,7 @@ T.Slider {
|
|||||||
implicitHandleWidth + leftPadding + rightPadding)
|
implicitHandleWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitHandleHeight + topPadding + bottomPadding)
|
implicitHandleHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
padding: 6
|
padding: 6
|
||||||
|
|
||||||
handle: Rectangle {
|
handle: Rectangle {
|
||||||
x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
||||||
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
|
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
|
||||||
@ -43,7 +42,11 @@ T.Slider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluTooltip{
|
||||||
|
parent: control.handle
|
||||||
|
visible: control.tooltipEnabled && control.pressed
|
||||||
|
text:String(control.value)
|
||||||
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
|
x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
|
||||||
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
|
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
|
||||||
|
@ -110,6 +110,11 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
|
FluTooltip{
|
||||||
|
visible: item_mouse_hove.containsMouse
|
||||||
|
text:item_text.text
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:item_mouse_drag
|
id:item_mouse_drag
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -242,11 +247,6 @@ Item {
|
|||||||
Layout.preferredWidth: visible?item_container.width - 41 - item_btn_close.width:0
|
Layout.preferredWidth: visible?item_container.width - 41 - item_btn_close.width:0
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
FluTooltip{
|
|
||||||
visible: item_mouse_hove.containsMouse
|
|
||||||
text:item_text.text
|
|
||||||
delay: 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
@ -2,295 +2,163 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.Basic
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Qt.labs.qmlmodels
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Rectangle {
|
||||||
property var columns : []
|
property var columnSource
|
||||||
property var dataSource : []
|
property var dataSource
|
||||||
property int pageCurrent: 1
|
|
||||||
property int itemCount: 1000
|
|
||||||
property int pageCount: 10
|
|
||||||
property int itemHeight: 56
|
|
||||||
property bool pageVisible: true
|
|
||||||
signal requestPage(int page,int count)
|
|
||||||
id:control
|
id:control
|
||||||
implicitHeight: layout_table.height
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
QtObject{
|
onColumnSourceChanged: {
|
||||||
id:d
|
if(columnSource.length!==0){
|
||||||
property int columnsWidth: layout_table.headerItem.columnsWidth()
|
var com_column = Qt.createComponent("FluTableModelColumn.qml")
|
||||||
}
|
if (com_column.status === Component.Ready) {
|
||||||
MouseArea{
|
var columns= []
|
||||||
anchors.fill: parent
|
columnSource.forEach(function(item){
|
||||||
preventStealing: true
|
var column = com_column.createObject(table_model,{display:item.dataIndex});
|
||||||
}
|
columns.push(column)
|
||||||
ListModel{
|
})
|
||||||
id:model_columns
|
table_model.columns = columns
|
||||||
}
|
}
|
||||||
ListModel{
|
}
|
||||||
id:model_data_source
|
|
||||||
}
|
|
||||||
onColumnsChanged: {
|
|
||||||
model_columns.clear()
|
|
||||||
model_columns.append(columns)
|
|
||||||
}
|
}
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
model_data_source.clear()
|
table_model.clear()
|
||||||
model_data_source.append(dataSource)
|
dataSource.forEach(function(item){
|
||||||
|
table_model.appendRow(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
TableModel {
|
||||||
|
id:table_model
|
||||||
}
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:header_columns
|
id:com_edit
|
||||||
FluRectangle{
|
FluTextBox {
|
||||||
id:layout_columns
|
anchors.fill: parent
|
||||||
height: control.itemHeight
|
text: display
|
||||||
width: parent.width
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
Component.onCompleted: selectAll()
|
||||||
radius: [5,5,0,0]
|
TableView.onCommit: {
|
||||||
function columnsWidth(){
|
display = text
|
||||||
var w = 0
|
|
||||||
for(var i=0;i<repeater_columns.count;i++){
|
|
||||||
var item = repeater_columns.itemAt(i)
|
|
||||||
w=w+item.width
|
|
||||||
}
|
|
||||||
return w
|
|
||||||
}
|
}
|
||||||
function widthByColumnIndex(index){
|
}
|
||||||
return repeater_columns.itemAt(index).width
|
}
|
||||||
|
ScrollView{
|
||||||
|
id:scroll_table
|
||||||
|
anchors.left: header_vertical.right
|
||||||
|
anchors.top: header_horizontal.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||||
|
TableView {
|
||||||
|
id:table_view
|
||||||
|
ListModel{
|
||||||
|
id:model_columns
|
||||||
}
|
}
|
||||||
Row{
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
id:list_columns
|
ScrollBar.horizontal: FluScrollBar{}
|
||||||
spacing: 0
|
ScrollBar.vertical: FluScrollBar{}
|
||||||
anchors.fill: parent
|
selectionModel: ItemSelectionModel {}
|
||||||
Repeater{
|
columnWidthProvider: function(column) {
|
||||||
id:repeater_columns
|
let w = explicitColumnWidth(column)
|
||||||
model: model_columns
|
if (w >= 0){
|
||||||
delegate: Item{
|
var minimumWidth = columnSource[column].minimumWidth
|
||||||
id:item_column
|
var maximumWidth = columnSource[column].maximumWidth
|
||||||
property point clickPos: "0,0"
|
if(!minimumWidth){
|
||||||
height: list_columns.height
|
minimumWidth = 100
|
||||||
width: model.width
|
|
||||||
FluText{
|
|
||||||
id:item_column_text
|
|
||||||
text:model.title
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 14
|
|
||||||
}
|
|
||||||
font: FluTextStyle.BodyStrong
|
|
||||||
}
|
|
||||||
FluDivider{
|
|
||||||
id:item_divider
|
|
||||||
width: 1
|
|
||||||
height: 40
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
visible: index !== model_columns.count-1
|
|
||||||
}
|
|
||||||
MouseArea{
|
|
||||||
height: 40
|
|
||||||
width: 6
|
|
||||||
anchors.centerIn: item_divider
|
|
||||||
visible: item_divider.visible
|
|
||||||
cursorShape: Qt.SplitHCursor
|
|
||||||
onPressed:
|
|
||||||
(mouse)=>{
|
|
||||||
clickPos = Qt.point(mouse.x, mouse.y)
|
|
||||||
}
|
|
||||||
preventStealing: true
|
|
||||||
onPositionChanged:
|
|
||||||
(mouse)=>{
|
|
||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
|
||||||
var minimumWidth = item_column_text.implicitWidth+28
|
|
||||||
if(model.minimumWidth){
|
|
||||||
minimumWidth = model.minimumWidth
|
|
||||||
}
|
|
||||||
item_column.width = Math.max(item_column.width+delta.x,minimumWidth)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if(!maximumWidth){
|
||||||
|
maximumWidth = 65535
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.min(Math.max(minimumWidth, w),maximumWidth)
|
||||||
|
}
|
||||||
|
return implicitColumnWidth(column)
|
||||||
|
}
|
||||||
|
rowHeightProvider: function(row) {
|
||||||
|
let h = explicitRowHeight(row)
|
||||||
|
if (h >= 0){
|
||||||
|
return Math.max(40, h)
|
||||||
|
}
|
||||||
|
return implicitRowHeight(row)
|
||||||
|
}
|
||||||
|
model: table_model
|
||||||
|
clip: true
|
||||||
|
delegate: Rectangle {
|
||||||
|
required property bool selected
|
||||||
|
required property bool current
|
||||||
|
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||||
|
implicitHeight: 40
|
||||||
|
implicitWidth: columnSource[column].width
|
||||||
|
FluText {
|
||||||
|
text: display
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 10
|
||||||
|
elide: Text.ElideRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
TableView.editDelegate: {
|
||||||
|
var obj =columnSource[column].editDelegate
|
||||||
|
if(obj){
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
return com_edit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable{
|
|
||||||
id:layout_flickable
|
|
||||||
height: layout_table.height
|
|
||||||
anchors{
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
contentWidth: layout_table.width
|
|
||||||
clip:true
|
|
||||||
ScrollBar.horizontal: FluScrollBar {
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
anchors.fill: layout_table
|
|
||||||
radius: 5
|
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
|
||||||
}
|
|
||||||
ListView{
|
|
||||||
id:layout_table
|
|
||||||
height: contentHeight
|
|
||||||
width: Math.max(layout_flickable.width,d.columnsWidth)
|
|
||||||
clip:true
|
|
||||||
interactive: false
|
|
||||||
removeDisplaced: Transition {
|
|
||||||
NumberAnimation { properties: "x,y"; duration: 167 }
|
|
||||||
}
|
|
||||||
header: header_columns
|
|
||||||
footer: Item{
|
|
||||||
height: pageVisible ? 54 : 0
|
|
||||||
clip: true
|
|
||||||
width: layout_table.width
|
|
||||||
FluPagination{
|
|
||||||
id:pagination
|
|
||||||
height: 40
|
|
||||||
pageCurrent: control.pageCurrent
|
|
||||||
onPageCurrentChanged: control.pageCurrent = pageCurrent
|
|
||||||
itemCount: control.itemCount
|
|
||||||
pageCount: control.pageCount
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
control.requestPage(page,count)
|
|
||||||
}
|
|
||||||
anchors{
|
|
||||||
top: parent.top
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
Connections{
|
|
||||||
target: control
|
|
||||||
function onPageCurrentChanged(){
|
|
||||||
if (control.pageCurrent!==pagination.pageCurrent)
|
|
||||||
{
|
|
||||||
pagination.calcNewPage(control.pageCurrent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model:model_data_source
|
|
||||||
delegate: Control{
|
|
||||||
id:item_control
|
|
||||||
height: maxHeight()
|
|
||||||
width: layout_table.width
|
|
||||||
property var model_values : getObjectValues(index)
|
|
||||||
property var itemObject: getObject(index)
|
|
||||||
property var listModel: model
|
|
||||||
Rectangle{
|
|
||||||
anchors.fill: parent
|
|
||||||
color: {
|
|
||||||
if(item_control.hovered){
|
|
||||||
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
|
||||||
}
|
|
||||||
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluDivider{
|
|
||||||
id:item_divider
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
}
|
|
||||||
Row{
|
|
||||||
id: table_row
|
|
||||||
spacing: 0
|
|
||||||
anchors.fill: parent
|
|
||||||
Repeater{
|
|
||||||
id:repeater_rows
|
|
||||||
model: model_values
|
|
||||||
delegate:FluControl{
|
|
||||||
id:item_row_control
|
|
||||||
width: layout_table.headerItem.widthByColumnIndex(index)
|
|
||||||
height: item_control.height
|
|
||||||
focusPolicy:Qt.TabFocus
|
|
||||||
background: Item{
|
|
||||||
FluFocusRectangle{
|
|
||||||
visible: item_row_control.activeFocus
|
|
||||||
radius:8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loader{
|
|
||||||
id:item_column_loader
|
|
||||||
property var model : modelData
|
|
||||||
property var dataModel : listModel
|
|
||||||
property var dataObject : itemObject
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
sourceComponent: {
|
|
||||||
if(model.itemData instanceof Component){
|
|
||||||
return model.itemData
|
|
||||||
}
|
|
||||||
return com_text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function columnHeight(){
|
|
||||||
return item_column_loader.item.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function maxHeight(){
|
|
||||||
var h = 0
|
|
||||||
for(var i=0;i<repeater_rows.count;i++){
|
|
||||||
var item = repeater_rows.itemAt(i)
|
|
||||||
h=Math.max(h,item.columnHeight())
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_text
|
id:com_handle
|
||||||
Item{
|
FluControl {
|
||||||
height: table_value.implicitHeight + 20
|
width: 24
|
||||||
FluCopyableText{
|
height: 24
|
||||||
id:table_value
|
background: Rectangle{
|
||||||
text:String(model.itemData)
|
radius: 12
|
||||||
width: Math.min(parent.width - 14,implicitWidth)
|
color: FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||||
wrapMode: Text.WordWrap
|
}
|
||||||
anchors{
|
visible: SelectionRectangle.control.active
|
||||||
verticalCenter: parent.verticalCenter
|
FluShadow{
|
||||||
left: parent.left
|
radius: 12
|
||||||
leftMargin: 14
|
}
|
||||||
}
|
Rectangle{
|
||||||
rightPadding: 14
|
width: 24
|
||||||
MouseArea{
|
height: 24
|
||||||
id:item_mouse
|
radius: 12
|
||||||
hoverEnabled: true
|
scale: pressed?4/10:hovered?6/10:5/10
|
||||||
anchors.fill: parent
|
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||||
cursorShape: Qt.IBeamCursor
|
anchors.centerIn: parent
|
||||||
acceptedButtons: Qt.NoButton
|
Behavior on scale {
|
||||||
}
|
NumberAnimation{
|
||||||
FluTooltip{
|
duration: 167
|
||||||
visible: item_mouse.containsMouse
|
}
|
||||||
text:parent.text
|
|
||||||
delay: 1000
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getObject(index){
|
SelectionRectangle {
|
||||||
return model_data_source.get(index)
|
target: table_view
|
||||||
|
bottomRightHandle:com_handle
|
||||||
|
topLeftHandle: com_handle
|
||||||
}
|
}
|
||||||
function getObjectValues(index) {
|
FluHorizontalHeaderView {
|
||||||
var obj = model_data_source.get(index)
|
id: header_horizontal
|
||||||
if(!obj)
|
textRole: "title"
|
||||||
return
|
model: columnSource
|
||||||
var data = []
|
anchors.left: scroll_table.left
|
||||||
for(var i=0;i<model_columns.count;i++){
|
anchors.top: parent.top
|
||||||
var item = model_columns.get(i)
|
syncView: table_view
|
||||||
data.push({itemData:obj[item.dataIndex],width:item.width})
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
}
|
clip: true
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
function remove(index){
|
FluVerticalHeaderView {
|
||||||
model_data_source.remove(index)
|
id: header_vertical
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
anchors.top: scroll_table.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
syncView: table_view
|
||||||
|
clip: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,178 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Controls.Basic
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Qt.labs.qmlmodels
|
|
||||||
import FluentUI
|
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
|
|
||||||
id:control
|
|
||||||
|
|
||||||
property var columnSource
|
|
||||||
property var dataSource
|
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
|
||||||
onColumnSourceChanged: {
|
|
||||||
if(columnSource.length!==0){
|
|
||||||
var com_column = Qt.createComponent("FluTableModelColumn.qml")
|
|
||||||
if (com_column.status === Component.Ready) {
|
|
||||||
var columns= []
|
|
||||||
columnSource.forEach(function(item){
|
|
||||||
var column = com_column.createObject(table_model,{display:item.dataIndex});
|
|
||||||
columns.push(column)
|
|
||||||
})
|
|
||||||
table_model.columns = columns
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TableModel {
|
|
||||||
id:table_model
|
|
||||||
}
|
|
||||||
|
|
||||||
onDataSourceChanged: {
|
|
||||||
table_model.clear()
|
|
||||||
dataSource.forEach(function(item){
|
|
||||||
table_model.appendRow(item)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_edit
|
|
||||||
FluTextBox {
|
|
||||||
anchors.fill: parent
|
|
||||||
text: display
|
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
|
||||||
Component.onCompleted: selectAll()
|
|
||||||
TableView.onCommit: {
|
|
||||||
display = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollView{
|
|
||||||
id:scroll_table
|
|
||||||
anchors.left: header_vertical.right
|
|
||||||
anchors.top: header_horizontal.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
|
||||||
TableView {
|
|
||||||
id:table_view
|
|
||||||
ListModel{
|
|
||||||
id:model_columns
|
|
||||||
}
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
ScrollBar.horizontal: FluScrollBar{}
|
|
||||||
ScrollBar.vertical: FluScrollBar{}
|
|
||||||
selectionModel: ItemSelectionModel {}
|
|
||||||
columnWidthProvider: function(column) {
|
|
||||||
let w = explicitColumnWidth(column)
|
|
||||||
if (w >= 0){
|
|
||||||
var minimumWidth = columnSource[column].minimumWidth
|
|
||||||
var maximumWidth = columnSource[column].maximumWidth
|
|
||||||
if(!minimumWidth){
|
|
||||||
minimumWidth = 100
|
|
||||||
}
|
|
||||||
if(!maximumWidth){
|
|
||||||
maximumWidth = 65535
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.min(Math.max(minimumWidth, w),maximumWidth)
|
|
||||||
}
|
|
||||||
return implicitColumnWidth(column)
|
|
||||||
}
|
|
||||||
rowHeightProvider: function(row) {
|
|
||||||
let h = explicitRowHeight(row)
|
|
||||||
if (h >= 0){
|
|
||||||
return Math.max(40, h)
|
|
||||||
}
|
|
||||||
return implicitRowHeight(row)
|
|
||||||
}
|
|
||||||
model: table_model
|
|
||||||
clip: true
|
|
||||||
delegate: Rectangle {
|
|
||||||
required property bool selected
|
|
||||||
required property bool current
|
|
||||||
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
|
||||||
implicitHeight: 40
|
|
||||||
implicitWidth: columnSource[column].width
|
|
||||||
FluText {
|
|
||||||
text: display
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 10
|
|
||||||
elide: Text.ElideRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
TableView.editDelegate: {
|
|
||||||
var obj =columnSource[column].editDelegate
|
|
||||||
if(obj){
|
|
||||||
return obj
|
|
||||||
}
|
|
||||||
return com_edit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_handle
|
|
||||||
FluControl {
|
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
background: Rectangle{
|
|
||||||
radius: 12
|
|
||||||
color: FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
|
||||||
}
|
|
||||||
visible: SelectionRectangle.control.active
|
|
||||||
FluShadow{
|
|
||||||
radius: 12
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
radius: 12
|
|
||||||
scale: pressed?4/10:hovered?6/10:5/10
|
|
||||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
|
||||||
anchors.centerIn: parent
|
|
||||||
Behavior on scale {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 167
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SelectionRectangle {
|
|
||||||
target: table_view
|
|
||||||
bottomRightHandle:com_handle
|
|
||||||
topLeftHandle: com_handle
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FluHorizontalHeaderView {
|
|
||||||
id: header_horizontal
|
|
||||||
textRole: "title"
|
|
||||||
model: columnSource
|
|
||||||
anchors.left: scroll_table.left
|
|
||||||
anchors.top: parent.top
|
|
||||||
syncView: table_view
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
clip: true
|
|
||||||
}
|
|
||||||
|
|
||||||
FluVerticalHeaderView {
|
|
||||||
id: header_vertical
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
anchors.top: scroll_table.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
syncView: table_view
|
|
||||||
clip: 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
|
||||||
@ -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){
|
||||||
|
@ -10,9 +10,13 @@ Button {
|
|||||||
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15)
|
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15)
|
||||||
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3)
|
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3)
|
||||||
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 color backgroundHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
|
property color backgroundPressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||||
|
property color backgroundNormalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
|
property color backgroundDisableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
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){
|
||||||
@ -21,12 +25,25 @@ Button {
|
|||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
}
|
}
|
||||||
id: control
|
id: control
|
||||||
horizontalPadding:2
|
horizontalPadding:6
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
font:FluTextStyle.Body
|
||||||
background: Item{
|
background: Rectangle{
|
||||||
implicitWidth: 28
|
implicitWidth: 28
|
||||||
implicitHeight: 28
|
implicitHeight: 28
|
||||||
|
radius: 4
|
||||||
|
color: {
|
||||||
|
if(!enabled){
|
||||||
|
return backgroundDisableColor
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return backgroundPressedColor
|
||||||
|
}
|
||||||
|
if(hovered){
|
||||||
|
return backgroundHoverColor
|
||||||
|
}
|
||||||
|
return backgroundNormalColor
|
||||||
|
}
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: control.visualFocus
|
visible: control.visualFocus
|
||||||
radius:8
|
radius:8
|
||||||
@ -40,9 +57,9 @@ Button {
|
|||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
id:btn_text
|
id:btn_text
|
||||||
text: control.text
|
text: control.text
|
||||||
|
font: control.font
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.bold: control.textBold
|
|
||||||
color: control.textColor
|
color: control.textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import QtQuick.Window
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
||||||
enum HourFormat {
|
enum HourFormat {
|
||||||
H,
|
H,
|
||||||
HH
|
HH
|
||||||
@ -16,7 +15,6 @@ Rectangle {
|
|||||||
property var window : Window.window
|
property var window : Window.window
|
||||||
property int hourFormat: FluTimePicker.H
|
property int hourFormat: FluTimePicker.H
|
||||||
property int isH: hourFormat === FluTimePicker.H
|
property int isH: hourFormat === FluTimePicker.H
|
||||||
|
|
||||||
id:root
|
id:root
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -29,7 +27,6 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
@ -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,15 +7,19 @@ 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(159/255,159/255,159/255,1) :FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(240/255,240/255,240/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)
|
||||||
property color borderNormalColor: FluTheme.dark ? Qt.rgba(161/255,161/255,161/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
property color borderNormalColor: FluTheme.dark ? Qt.rgba(161/255,161/255,161/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||||
property color borderCheckColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color borderCheckColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
property color borderDisableColor: FluTheme.dark ? Qt.rgba(208/255,208/255,208/255,1) : Qt.rgba(93/255,93/255,93/255,1)
|
property color borderDisableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(200/255,200/255,200/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 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 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
|
||||||
}
|
}
|
||||||
@ -31,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
|
||||||
@ -42,7 +47,7 @@ Button {
|
|||||||
radius: 20
|
radius: 20
|
||||||
}
|
}
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -55,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){
|
||||||
@ -73,9 +78,12 @@ 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(!enabled){
|
||||||
|
return dotDisableColor
|
||||||
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
return dotCheckColor
|
return dotCheckColor
|
||||||
}
|
}
|
||||||
@ -92,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 !== ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,30 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls.impl
|
||||||
|
import QtQuick.Templates as T
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
ToolTip {
|
T.ToolTip {
|
||||||
id:tool_tip
|
id: control
|
||||||
|
x: parent ? (parent.width - implicitWidth) / 2 : 0
|
||||||
|
y: -implicitHeight - 3
|
||||||
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
|
contentWidth + leftPadding + rightPadding)
|
||||||
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
|
contentHeight + topPadding + bottomPadding)
|
||||||
|
margins: 6
|
||||||
|
padding: 6
|
||||||
|
font: FluTextStyle.Body
|
||||||
|
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: tool_tip.text
|
text: control.text
|
||||||
padding: 4
|
font: control.font
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
background: Rectangle{
|
background: Rectangle {
|
||||||
anchors.fill: parent
|
|
||||||
color: FluTheme.dark ? Qt.rgba(50/255,49/255,48/255,1) : Qt.rgba(1,1,1,1)
|
color: FluTheme.dark ? Qt.rgba(50/255,49/255,48/255,1) : Qt.rgba(1,1,1,1)
|
||||||
radius: 5
|
radius: 3
|
||||||
FluShadow{}
|
FluShadow{
|
||||||
|
radius: 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|