mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-06 02:15:23 +08:00
Compare commits
21 Commits
1.7.5
...
2e379fcd7e
Author | SHA1 | Date | |
---|---|---|---|
2e379fcd7e | |||
0a8732c91b | |||
b98c5d327a | |||
7163c739c2 | |||
f830d5a9bf | |||
ed49e3f6af | |||
9aa6615189 | |||
c36515f19c | |||
5f6745b630 | |||
4f202831b8 | |||
29cee84edd | |||
2d4e61445e | |||
cc79854191 | |||
500efa6298 | |||
355332da96 | |||
a0d662a8a5 | |||
aecc3fe3b4 | |||
3554fb99cd | |||
24fdff7e35 | |||
d2fdd08604 | |||
1f5d6ce1aa |
@ -13,7 +13,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/)
|
|||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
|
|
||||||
option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
|
option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
|
||||||
set(FLUENTUI_BUILD_STATIC_LIB OFF)
|
option(FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
||||||
|
@ -1968,7 +1968,7 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="177"/>
|
<location filename="qml/page/T_TableView.qml" line="177"/>
|
||||||
<location filename="qml/page/T_TableView.qml" line="478"/>
|
<location filename="qml/page/T_TableView.qml" line="513"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1988,57 +1988,67 @@ Some contents...</source>
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="337"/>
|
<location filename="qml/page/T_TableView.qml" line="358"/>
|
||||||
<source>Age</source>
|
<source>Age</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="412"/>
|
<location filename="qml/page/T_TableView.qml" line="433"/>
|
||||||
<source>Clear All</source>
|
<source>Clear All</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="473"/>
|
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||||
|
<source>Insert a Row</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="478"/>
|
||||||
|
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="508"/>
|
||||||
<source>Avatar</source>
|
<source>Avatar</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="491"/>
|
<location filename="qml/page/T_TableView.qml" line="526"/>
|
||||||
<source>Address</source>
|
<source>Address</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="498"/>
|
<location filename="qml/page/T_TableView.qml" line="534"/>
|
||||||
<source>Nickname</source>
|
<source>Nickname</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="505"/>
|
<location filename="qml/page/T_TableView.qml" line="541"/>
|
||||||
<source>Long String</source>
|
<source>Long String</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="513"/>
|
<location filename="qml/page/T_TableView.qml" line="549"/>
|
||||||
<source>Options</source>
|
<source>Options</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="532"/>
|
<location filename="qml/page/T_TableView.qml" line="568"/>
|
||||||
<source><Previous</source>
|
<source><Previous</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="533"/>
|
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||||
<source>Next></source>
|
<source>Next></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="419"/>
|
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||||
<source>Delete Selection</source>
|
<source>Delete Selection</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="443"/>
|
<location filename="qml/page/T_TableView.qml" line="464"/>
|
||||||
<source>Add a row of Data</source>
|
<source>Add a row of Data</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2110,7 +2110,7 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="177"/>
|
<location filename="qml/page/T_TableView.qml" line="177"/>
|
||||||
<location filename="qml/page/T_TableView.qml" line="478"/>
|
<location filename="qml/page/T_TableView.qml" line="513"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished">名称</translation>
|
<translation type="unfinished">名称</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2130,57 +2130,67 @@ Some contents...</source>
|
|||||||
<translation type="unfinished">全选</translation>
|
<translation type="unfinished">全选</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="337"/>
|
<location filename="qml/page/T_TableView.qml" line="358"/>
|
||||||
<source>Age</source>
|
<source>Age</source>
|
||||||
<translation type="unfinished">年龄</translation>
|
<translation type="unfinished">年龄</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="412"/>
|
<location filename="qml/page/T_TableView.qml" line="433"/>
|
||||||
<source>Clear All</source>
|
<source>Clear All</source>
|
||||||
<translation type="unfinished">清除所有</translation>
|
<translation type="unfinished">清除所有</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="473"/>
|
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||||
|
<source>Insert a Row</source>
|
||||||
|
<translation type="unfinished">插入一行</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="478"/>
|
||||||
|
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
|
||||||
|
<translation type="unfinished">焦点未获取:请点击表格中的任意一项,作为插入的靶点!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="508"/>
|
||||||
<source>Avatar</source>
|
<source>Avatar</source>
|
||||||
<translation type="unfinished">头像</translation>
|
<translation type="unfinished">头像</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="491"/>
|
<location filename="qml/page/T_TableView.qml" line="526"/>
|
||||||
<source>Address</source>
|
<source>Address</source>
|
||||||
<translation type="unfinished">地址</translation>
|
<translation type="unfinished">地址</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="498"/>
|
<location filename="qml/page/T_TableView.qml" line="534"/>
|
||||||
<source>Nickname</source>
|
<source>Nickname</source>
|
||||||
<translation type="unfinished">昵称</translation>
|
<translation type="unfinished">昵称</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="505"/>
|
<location filename="qml/page/T_TableView.qml" line="541"/>
|
||||||
<source>Long String</source>
|
<source>Long String</source>
|
||||||
<translation type="unfinished">长字符串</translation>
|
<translation type="unfinished">长字符串</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="513"/>
|
<location filename="qml/page/T_TableView.qml" line="549"/>
|
||||||
<source>Options</source>
|
<source>Options</source>
|
||||||
<translation type="unfinished">操作</translation>
|
<translation type="unfinished">操作</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="532"/>
|
<location filename="qml/page/T_TableView.qml" line="568"/>
|
||||||
<source><Previous</source>
|
<source><Previous</source>
|
||||||
<translation type="unfinished"><上一页</translation>
|
<translation type="unfinished"><上一页</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="533"/>
|
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||||
<source>Next></source>
|
<source>Next></source>
|
||||||
<translation type="unfinished">下一页></translation>
|
<translation type="unfinished">下一页></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="419"/>
|
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||||
<source>Delete Selection</source>
|
<source>Delete Selection</source>
|
||||||
<translation type="unfinished">删除选中</translation>
|
<translation type="unfinished">删除选中</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="443"/>
|
<location filename="qml/page/T_TableView.qml" line="464"/>
|
||||||
<source>Add a row of Data</source>
|
<source>Add a row of Data</source>
|
||||||
<translation type="unfinished">添加一行数据</translation>
|
<translation type="unfinished">添加一行数据</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -22,18 +22,37 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluGroupBox {
|
FluGroupBox {
|
||||||
title: qsTr("RadioButton Group")
|
title: qsTr("RadioButton Group")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 150
|
||||||
|
Layout.topMargin: 20
|
||||||
FluRadioButtons {
|
FluRadioButtons {
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
FluRadioButton { text: qsTr("E-mail") }
|
FluRadioButton { text: qsTr("E-mail") }
|
||||||
FluRadioButton { text: qsTr("Calendar") }
|
FluRadioButton { text: qsTr("Calendar") }
|
||||||
FluRadioButton { text: qsTr("Contacts") }
|
FluRadioButton { text: qsTr("Contacts") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluToggleSwitch{
|
||||||
|
id: radio_button_switch
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text: qsTr("Disabled")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 4
|
Layout.topMargin: 4
|
||||||
code:'FluGroupBox {
|
code:`
|
||||||
|
FluGroupBox {
|
||||||
title: qsTr("CheckBox Group")
|
title: qsTr("CheckBox Group")
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
@ -42,7 +61,20 @@ FluScrollablePage{
|
|||||||
FluCheckBox { text: qsTr("Calendar") }
|
FluCheckBox { text: qsTr("Calendar") }
|
||||||
FluCheckBox { text: qsTr("Contacts") }
|
FluCheckBox { text: qsTr("Contacts") }
|
||||||
}
|
}
|
||||||
}'
|
}
|
||||||
|
|
||||||
|
FluGroupBox {
|
||||||
|
title: qsTr("RadioButton Group")
|
||||||
|
FluRadioButtons {
|
||||||
|
spacing: 10
|
||||||
|
disabled: true // 禁用所有FluRadioButton子组件
|
||||||
|
manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项
|
||||||
|
FluRadioButton { text: qsTr("E-mail") }
|
||||||
|
FluRadioButton { text: qsTr("Calendar") }
|
||||||
|
FluRadioButton { text: qsTr("Contacts") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,13 @@ FluScrollablePage{
|
|||||||
|
|
||||||
title: qsTr("InfoBar")
|
title: qsTr("InfoBar")
|
||||||
|
|
||||||
|
property var info1
|
||||||
|
property var info2
|
||||||
|
property var info3
|
||||||
|
|
||||||
FluFrame{
|
FluFrame{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 270
|
Layout.preferredHeight: 350
|
||||||
padding: 10
|
padding: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
@ -49,6 +53,51 @@ FluScrollablePage{
|
|||||||
showInfo(qsTr("This is an InfoBar in the Info Style"),0,qsTr("Manual shutdown is supported"))
|
showInfo(qsTr("This is an InfoBar in the Info Style"),0,qsTr("Manual shutdown is supported"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
width: parent.width
|
||||||
|
text: qsTr("Manually close the info message box")
|
||||||
|
}
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
FluButton{
|
||||||
|
text: (info1 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info1")
|
||||||
|
onClicked: {
|
||||||
|
if(info1) {
|
||||||
|
info1.close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info1 = showInfo(qsTr("This is an '%1'").arg("info1"), 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text: (info2 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info2")
|
||||||
|
onClicked: {
|
||||||
|
if(info2) {
|
||||||
|
info2.close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info2 = showInfo(qsTr("This is an '%1'").arg("info2"), 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text: (info3 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info3")
|
||||||
|
onClicked: {
|
||||||
|
if(info3) {
|
||||||
|
info3.close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info3 = showInfo(qsTr("This is an '%1'").arg("info3"), 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text: qsTr("clear all info")
|
||||||
|
onClicked: {
|
||||||
|
clearAllInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"Loading"
|
text:"Loading"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -60,12 +109,17 @@ FluScrollablePage{
|
|||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -6
|
Layout.topMargin: -6
|
||||||
code:'showInfo(qsTr("This is an InfoBar in the Info Style"))
|
code:`
|
||||||
|
showInfo(qsTr("This is an InfoBar in the Info Style"))
|
||||||
|
|
||||||
showWarning(qsTr("This is an InfoBar in the Warning Style"))
|
showWarning(qsTr("This is an InfoBar in the Warning Style"))
|
||||||
|
|
||||||
showError(qsTr("This is an InfoBar in the Error Style"))
|
showError(qsTr("This is an InfoBar in the Error Style"))
|
||||||
|
|
||||||
showSuccess(qsTr("This is an InfoBar in the Success Style"))'
|
showSuccess(qsTr("This is an InfoBar in the Success Style"))
|
||||||
|
|
||||||
|
var info1 = showInfo(qsTr("This is an 'Info1'"), 0)
|
||||||
|
info1.close()
|
||||||
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ FluContentPage{
|
|||||||
|
|
||||||
property var dataSource : []
|
property var dataSource : []
|
||||||
property int sortType: 0
|
property int sortType: 0
|
||||||
property bool seletedAll: true
|
property bool selectedAll: true
|
||||||
property string nameKeyword: ""
|
property string nameKeyword: ""
|
||||||
|
|
||||||
onNameKeywordChanged: {
|
onNameKeywordChanged: {
|
||||||
@ -32,11 +32,11 @@ FluContentPage{
|
|||||||
onCheckBoxChanged: {
|
onCheckBoxChanged: {
|
||||||
for(var i =0;i< table_view.rows ;i++){
|
for(var i =0;i< table_view.rows ;i++){
|
||||||
if(false === table_view.getRow(i).checkbox.options.checked){
|
if(false === table_view.getRow(i).checkbox.options.checked){
|
||||||
root.seletedAll = false
|
root.selectedAll = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.seletedAll = true
|
root.selectedAll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onSortTypeChanged: {
|
onSortTypeChanged: {
|
||||||
@ -238,12 +238,12 @@ FluContentPage{
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
checked: true === root.seletedAll
|
checked: true === root.selectedAll
|
||||||
animationEnabled: false
|
animationEnabled: false
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
clickListener: function(){
|
clickListener: function(){
|
||||||
root.seletedAll = !root.seletedAll
|
root.selectedAll = !root.selectedAll
|
||||||
var checked = root.seletedAll
|
var checked = root.selectedAll
|
||||||
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
|
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
|
||||||
for(var i =0;i< table_view.rows ;i++){
|
for(var i =0;i< table_view.rows ;i++){
|
||||||
var rowData = table_view.getRow(i)
|
var rowData = table_view.getRow(i)
|
||||||
@ -280,6 +280,27 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_auto_suggestbox
|
||||||
|
FluAutoSuggestBox {
|
||||||
|
id: textbox
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
Component.onCompleted: {
|
||||||
|
var data = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
|
||||||
|
var result = data.map(function(item) {
|
||||||
|
return {title: item};
|
||||||
|
});
|
||||||
|
items = result
|
||||||
|
textbox.text= String(display)
|
||||||
|
}
|
||||||
|
onCommit: {
|
||||||
|
editTextChaged(textbox.text)
|
||||||
|
tableView.closeEditor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_avatar
|
id:com_avatar
|
||||||
Item{
|
Item{
|
||||||
@ -445,6 +466,20 @@ FluContentPage{
|
|||||||
table_view.appendRow(genTestObject())
|
table_view.appendRow(genTestObject())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluButton{
|
||||||
|
text: qsTr("Insert a Row")
|
||||||
|
onClicked: {
|
||||||
|
if(typeof table_view.current !== 'undefined'){
|
||||||
|
var newLine = genTestObject()
|
||||||
|
var currentLine = dataSource.findIndex(obj => obj._key === table_view.current._key)
|
||||||
|
root.dataSource.splice(currentLine, 0, newLine);
|
||||||
|
table_view.dataSource = root.dataSource
|
||||||
|
}else{
|
||||||
|
showWarning(qsTr("Focus not acquired: Please click any item in the form as the target for insertion!"))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,6 +525,7 @@ FluContentPage{
|
|||||||
{
|
{
|
||||||
title: qsTr("Address"),
|
title: qsTr("Address"),
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
|
editDelegate: com_auto_suggestbox,
|
||||||
width:200,
|
width:200,
|
||||||
minimumWidth:100,
|
minimumWidth:100,
|
||||||
maximumWidth:250
|
maximumWidth:250
|
||||||
@ -566,7 +602,7 @@ FluContentPage{
|
|||||||
return avatars[randomIndex];
|
return avatars[randomIndex];
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
checkbox: table_view.customItem(com_checbox,{checked:root.seletedAll}),
|
checkbox: table_view.customItem(com_checbox,{checked:root.selectedAll}),
|
||||||
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
@ -579,7 +615,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
root.seletedAll = true
|
root.selectedAll = true
|
||||||
const dataSource = []
|
const dataSource = []
|
||||||
for(var i=0;i<count;i++){
|
for(var i=0;i<count;i++){
|
||||||
dataSource.push(genTestObject())
|
dataSource.push(genTestObject())
|
||||||
|
@ -15,7 +15,7 @@ FluWindow {
|
|||||||
title: "FluentUI"
|
title: "FluentUI"
|
||||||
width: 1000
|
width: 1000
|
||||||
height: 680
|
height: 680
|
||||||
minimumWidth: 1000
|
minimumWidth: 680
|
||||||
minimumHeight: 200
|
minimumHeight: 200
|
||||||
launchMode: FluWindowType.SingleTask
|
launchMode: FluWindowType.SingleTask
|
||||||
fitsAppBarWindows: true
|
fitsAppBarWindows: true
|
||||||
|
@ -73,12 +73,7 @@ void FluFrameless::componentComplete() {
|
|||||||
int w = window()->width();
|
int w = window()->width();
|
||||||
int h = window()->height();
|
int h = window()->height();
|
||||||
_current = window()->winId();
|
_current = window()->winId();
|
||||||
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
|
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
if (QQuickWindow::sceneGraphBackend() == "software") {
|
|
||||||
window()->setFlag(Qt::FramelessWindowHint, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!_fixSize) {
|
if (!_fixSize) {
|
||||||
window()->setFlag(Qt::WindowMaximizeButtonHint);
|
window()->setFlag(Qt::WindowMaximizeButtonHint);
|
||||||
}
|
}
|
||||||
@ -97,14 +92,14 @@ void FluFrameless::componentComplete() {
|
|||||||
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
||||||
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
if (_fixSize) {
|
if (_fixSize) {
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
|
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_CAPTION);
|
||||||
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
|
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
|
||||||
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
|
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
|
||||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
|
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_CAPTION);
|
||||||
}
|
}
|
||||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
|
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
|
||||||
@ -141,7 +136,6 @@ void FluFrameless::componentComplete() {
|
|||||||
const auto uMsg = msg->message;
|
const auto uMsg = msg->message;
|
||||||
const auto wParam = msg->wParam;
|
const auto wParam = msg->wParam;
|
||||||
const auto lParam = msg->lParam;
|
const auto lParam = msg->lParam;
|
||||||
static QPoint offsetXY;
|
|
||||||
if (uMsg == WM_WINDOWPOSCHANGING) {
|
if (uMsg == WM_WINDOWPOSCHANGING) {
|
||||||
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
|
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
|
||||||
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
|
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
|
||||||
@ -152,42 +146,22 @@ void FluFrameless::componentComplete() {
|
|||||||
return false;
|
return false;
|
||||||
} else if (uMsg == WM_NCCALCSIZE) {
|
} else if (uMsg == WM_NCCALCSIZE) {
|
||||||
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
|
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
|
||||||
const LONG originalTop = clientRect->top;
|
|
||||||
const LONG originalLeft = clientRect->left;
|
|
||||||
const LONG originalRight = clientRect->right;
|
|
||||||
const LONG originalBottom = clientRect->bottom;
|
|
||||||
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
|
|
||||||
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
|
|
||||||
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
int offsetSize;
|
|
||||||
bool isMaximum = ::IsZoomed(hwnd);
|
bool isMaximum = ::IsZoomed(hwnd);
|
||||||
auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
|
if (!isMaximum){
|
||||||
if (_offsetXY.x() != 0) {
|
if (clientRect->top != 0)
|
||||||
offsetXY = _offsetXY;
|
{
|
||||||
|
clientRect->top -= 1;
|
||||||
|
clientRect->bottom -= 1;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
const LONG originalTop = clientRect->top;
|
||||||
|
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
|
||||||
|
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
|
||||||
|
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
clientRect->top = originalTop-originalTop;
|
||||||
}
|
}
|
||||||
if (isMaximum || _isFullScreen()) {
|
|
||||||
offsetSize = 0;
|
|
||||||
} else {
|
|
||||||
offsetSize = 1;
|
|
||||||
}
|
|
||||||
if (!isCompositionEnabled()) {
|
|
||||||
offsetSize = 0;
|
|
||||||
}
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
clientRect->top = originalTop + offsetSize;
|
|
||||||
clientRect->bottom = originalBottom - offsetSize;
|
|
||||||
clientRect->left = originalLeft + offsetSize;
|
|
||||||
clientRect->right = originalRight - offsetSize;
|
|
||||||
#else
|
|
||||||
if (!isMaximum) {
|
|
||||||
clientRect->top = originalTop + offsetSize;
|
|
||||||
clientRect->bottom = originalBottom - offsetSize;
|
|
||||||
clientRect->left = originalLeft + offsetSize;
|
|
||||||
clientRect->right = originalRight - offsetSize;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
_setMaximizeHovered(false);
|
_setMaximizeHovered(false);
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
return true;
|
return true;
|
||||||
@ -244,6 +218,18 @@ void FluFrameless::componentComplete() {
|
|||||||
}
|
}
|
||||||
*result = HTCLIENT;
|
*result = HTCLIENT;
|
||||||
return true;
|
return true;
|
||||||
|
} else if (uMsg == WM_NCPAINT) {
|
||||||
|
if(isCompositionEnabled()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*result = FALSE;
|
||||||
|
return true;
|
||||||
|
} else if (uMsg == WM_NCACTIVATE) {
|
||||||
|
if(isCompositionEnabled()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*result = TRUE;
|
||||||
|
return true;
|
||||||
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
||||||
if (_hitMaximizeButton()) {
|
if (_hitMaximizeButton()) {
|
||||||
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||||
@ -258,35 +244,8 @@ void FluFrameless::componentComplete() {
|
|||||||
_setMaximizePressed(false);
|
_setMaximizePressed(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (uMsg == WM_NCPAINT) {
|
} else if (uMsg == WM_ERASEBKGND) {
|
||||||
*result = FALSE;
|
|
||||||
return true;
|
return true;
|
||||||
} else if (uMsg == WM_NCACTIVATE) {
|
|
||||||
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1));
|
|
||||||
return true;
|
|
||||||
} else if (uMsg == WM_GETMINMAXINFO) {
|
|
||||||
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
minmaxInfo->ptMaxPosition.x = 0;
|
|
||||||
minmaxInfo->ptMaxPosition.y = 0;
|
|
||||||
minmaxInfo->ptMaxSize.x = 0;
|
|
||||||
minmaxInfo->ptMaxSize.y = 0;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
auto pixelRatio = window()->devicePixelRatio();
|
|
||||||
auto geometry = window()->screen()->availableGeometry();
|
|
||||||
RECT rect;
|
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
|
|
||||||
if (!_fixSize) {
|
|
||||||
minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x());
|
|
||||||
minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio);
|
|
||||||
}
|
|
||||||
minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x();
|
|
||||||
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
|
|
||||||
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2;
|
|
||||||
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2;
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
} else if (uMsg == WM_NCRBUTTONDOWN) {
|
} else if (uMsg == WM_NCRBUTTONDOWN) {
|
||||||
if (wParam == HTCAPTION) {
|
if (wParam == HTCAPTION) {
|
||||||
_showSystemMenu(QCursor::pos());
|
_showSystemMenu(QCursor::pos());
|
||||||
@ -384,27 +343,27 @@ void FluFrameless::_setMaximizeHovered(bool val) {
|
|||||||
|
|
||||||
void FluFrameless::_updateCursor(int edges) {
|
void FluFrameless::_updateCursor(int edges) {
|
||||||
switch (edges) {
|
switch (edges) {
|
||||||
case 0:
|
case 0:
|
||||||
window()->setCursor(Qt::ArrowCursor);
|
window()->setCursor(Qt::ArrowCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
case Qt::RightEdge:
|
case Qt::RightEdge:
|
||||||
window()->setCursor(Qt::SizeHorCursor);
|
window()->setCursor(Qt::SizeHorCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::TopEdge:
|
case Qt::TopEdge:
|
||||||
case Qt::BottomEdge:
|
case Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeVerCursor);
|
window()->setCursor(Qt::SizeVerCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge | Qt::TopEdge:
|
case Qt::LeftEdge | Qt::TopEdge:
|
||||||
case Qt::RightEdge | Qt::BottomEdge:
|
case Qt::RightEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeFDiagCursor);
|
window()->setCursor(Qt::SizeFDiagCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::RightEdge | Qt::TopEdge:
|
case Qt::RightEdge | Qt::TopEdge:
|
||||||
case Qt::LeftEdge | Qt::BottomEdge:
|
case Qt::LeftEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeBDiagCursor);
|
window()->setCursor(Qt::SizeBDiagCursor);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ FluTextBox{
|
|||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: qsTr("No results found")
|
property string emptyText: qsTr("No results found")
|
||||||
property int autoSuggestBoxReplacement: FluentIcons.Search
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
|
property string textRole: "title"
|
||||||
property var filter: function(item){
|
property var filter: function(item){
|
||||||
if(item.title.indexOf(control.text)!==-1){
|
if(item.title.indexOf(control.text)!==-1){
|
||||||
return true
|
return true
|
||||||
@ -25,7 +26,7 @@ FluTextBox{
|
|||||||
function handleClick(modelData){
|
function handleClick(modelData){
|
||||||
control_popup.visible = false
|
control_popup.visible = false
|
||||||
control.itemClicked(modelData)
|
control.itemClicked(modelData)
|
||||||
control.updateText(modelData.title)
|
control.updateText(modelData[textRole])
|
||||||
}
|
}
|
||||||
function loadData(){
|
function loadData(){
|
||||||
var result = []
|
var result = []
|
||||||
@ -48,7 +49,6 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
Popup{
|
Popup{
|
||||||
id:control_popup
|
id:control_popup
|
||||||
y:control.height
|
|
||||||
focus: false
|
focus: false
|
||||||
padding: 0
|
padding: 0
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
@ -62,7 +62,7 @@ FluTextBox{
|
|||||||
contentItem: FluClip{
|
contentItem: FluClip{
|
||||||
radius: [5,5,5,5]
|
radius: [5,5,5,5]
|
||||||
ListView{
|
ListView{
|
||||||
id:list_view
|
id: list_view
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
@ -72,7 +72,7 @@ FluTextBox{
|
|||||||
height: visible ? 38 : 0
|
height: visible ? 38 : 0
|
||||||
visible: list_view.count === 0
|
visible: list_view.count === 0
|
||||||
FluText{
|
FluText{
|
||||||
text:emptyText
|
text: emptyText
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -81,10 +81,10 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate:FluControl{
|
delegate:FluControl{
|
||||||
id:item_control
|
id: item_control
|
||||||
height: 38
|
height: 38
|
||||||
width: control.width
|
width: control.width
|
||||||
onClicked:{
|
onClicked: {
|
||||||
d.handleClick(modelData)
|
d.handleClick(modelData)
|
||||||
}
|
}
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
@ -103,7 +103,7 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: FluText{
|
contentItem: FluText{
|
||||||
text:modelData.title
|
text: modelData[textRole]
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
rightPadding: 10
|
rightPadding: 10
|
||||||
verticalAlignment : Qt.AlignVCenter
|
verticalAlignment : Qt.AlignVCenter
|
||||||
@ -128,7 +128,7 @@ FluTextBox{
|
|||||||
if(d.flagVisible){
|
if(d.flagVisible){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
|
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
|
||||||
control_popup.y = control.height
|
control_popup.y = Qt.binding(function(){return control.height})
|
||||||
} else if(pos.y>rect_background.implicitHeight){
|
} else if(pos.y>rect_background.implicitHeight){
|
||||||
control_popup.y = -rect_background.implicitHeight
|
control_popup.y = -rect_background.implicitHeight
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,22 +18,23 @@ FluObject {
|
|||||||
if(screenLayout){
|
if(screenLayout){
|
||||||
var last = screenLayout.getLastloader();
|
var last = screenLayout.getLastloader();
|
||||||
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
||||||
last.restart();
|
last.duration = duration
|
||||||
return;
|
if (duration > 0) last.restart();
|
||||||
|
return last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initScreenLayout();
|
initScreenLayout();
|
||||||
contentComponent.createObject(screenLayout,{
|
return contentComponent.createObject(screenLayout,{
|
||||||
type:type,
|
type:type,
|
||||||
text:text,
|
text:text,
|
||||||
duration:duration,
|
duration:duration,
|
||||||
moremsg:moremsg,
|
moremsg:moremsg,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function createCustom(itemcomponent,duration){
|
function createCustom(itemcomponent,duration){
|
||||||
initScreenLayout();
|
initScreenLayout();
|
||||||
if(itemcomponent){
|
if(itemcomponent){
|
||||||
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function initScreenLayout(){
|
function initScreenLayout(){
|
||||||
@ -85,7 +86,9 @@ FluObject {
|
|||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
id:delayTimer
|
id:delayTimer
|
||||||
interval: duration; running: duration > 0; repeat: duration > 0
|
interval: duration;
|
||||||
|
running: duration > 0;
|
||||||
|
repeat: duration > 0
|
||||||
onTriggered: content.close();
|
onTriggered: content.close();
|
||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
@ -235,18 +238,26 @@ FluObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showSuccess(text,duration=1000,moremsg){
|
function showSuccess(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showInfo(text,duration=1000,moremsg){
|
function showInfo(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showWarning(text,duration=1000,moremsg){
|
function showWarning(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showError(text,duration=1000,moremsg){
|
function showError(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showCustom(itemcomponent,duration=1000){
|
function showCustom(itemcomponent,duration=1000){
|
||||||
mcontrol.createCustom(itemcomponent,duration);
|
return mcontrol.createCustom(itemcomponent,duration);
|
||||||
|
}
|
||||||
|
function clearAllInfo(){
|
||||||
|
if(mcontrol.screenLayout != null) {
|
||||||
|
mcontrol.screenLayout.destroy()
|
||||||
|
mcontrol.screenLayout = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,6 @@ T.MenuBarItem {
|
|||||||
radius: 3
|
radius: 3
|
||||||
color: {
|
color: {
|
||||||
if(control.highlighted){
|
if(control.highlighted){
|
||||||
return FluTheme.itemCheckColor
|
|
||||||
}
|
|
||||||
if(control.hovered){
|
|
||||||
return FluTheme.itemHoverColor
|
return FluTheme.itemHoverColor
|
||||||
}
|
}
|
||||||
return FluTheme.itemNormalColor
|
return FluTheme.itemNormalColor
|
||||||
|
@ -99,9 +99,9 @@ T.MenuItem {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 3
|
anchors.margins: 3
|
||||||
radius: 4
|
radius: 4
|
||||||
color:{
|
color: {
|
||||||
if(control.highlighted){
|
if(control.highlighted){
|
||||||
return FluTheme.itemCheckColor
|
return FluTheme.itemHoverColor
|
||||||
}
|
}
|
||||||
return FluTheme.itemNormalColor
|
return FluTheme.itemNormalColor
|
||||||
}
|
}
|
||||||
|
@ -1,100 +1,112 @@
|
|||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import FluentUI 1.0
|
import FluentUI 1.0
|
||||||
|
|
||||||
Item {
|
|
||||||
signal requestPage(int page,int count)
|
Item {
|
||||||
property string previousText: qsTr("<Previous")
|
signal requestPage(int page, int count)
|
||||||
property string nextText: qsTr("Next>")
|
|
||||||
property int pageCurrent: 0
|
property string previousText: qsTr("<Previous")
|
||||||
property int itemCount: 0
|
property string nextText: qsTr("Next>")
|
||||||
property int pageButtonCount: 5
|
property int pageCurrent: 0
|
||||||
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
property int itemCount: 0
|
||||||
property int __itemPerPage: 10
|
property int pageButtonCount: 5
|
||||||
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
property int pageCount: itemCount > 0 ? Math.ceil(itemCount / __itemPerPage) : 0
|
||||||
id: control
|
property int __itemPerPage: 10
|
||||||
implicitHeight: 40
|
property int __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
|
||||||
implicitWidth: content.width
|
property Component header: null
|
||||||
Row{
|
property Component footer: null
|
||||||
id: content
|
id: control
|
||||||
height: control.height
|
implicitHeight: 40
|
||||||
spacing: 10
|
implicitWidth: content.width
|
||||||
padding: 10
|
Row {
|
||||||
FluToggleButton{
|
id: content
|
||||||
visible: control.pageCount>1
|
height: control.height
|
||||||
disabled: control.pageCurrent<=1
|
spacing: 10
|
||||||
text:control.previousText
|
padding: 10
|
||||||
clickListener:function() {
|
Loader {
|
||||||
control.calcNewPage(control.pageCurrent-1);
|
sourceComponent: header
|
||||||
}
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
Row{
|
visible: control.pageCount > 1
|
||||||
spacing: 5
|
disabled: control.pageCurrent <= 1
|
||||||
FluToggleButton{
|
text: control.previousText
|
||||||
property int pageNumber:1
|
clickListener: function () {
|
||||||
visible: control.pageCount>0
|
control.calcNewPage(control.pageCurrent - 1);
|
||||||
checked: pageNumber === control.pageCurrent
|
}
|
||||||
text:String(pageNumber)
|
}
|
||||||
clickListener:function() {
|
Row {
|
||||||
control.calcNewPage(pageNumber);
|
spacing: 5
|
||||||
}
|
|
||||||
}
|
FluToggleButton {
|
||||||
FluText{
|
property int pageNumber: 1
|
||||||
visible: (control.pageCount>control.pageButtonCount&&
|
visible: control.pageCount > 0
|
||||||
control.pageCurrent>control.__pageButtonHalf)
|
checked: pageNumber === control.pageCurrent
|
||||||
text: "..."
|
text: String(pageNumber)
|
||||||
}
|
clickListener: function () {
|
||||||
Repeater{
|
control.calcNewPage(pageNumber);
|
||||||
id: button_repeator
|
}
|
||||||
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
|
}
|
||||||
delegate:FluToggleButton{
|
FluText {
|
||||||
property int pageNumber: {
|
visible: (control.pageCount > control.pageButtonCount &&
|
||||||
return (control.pageCurrent<=control.__pageButtonHalf)
|
control.pageCurrent > control.__pageButtonHalf)
|
||||||
?(2+index)
|
text: "..."
|
||||||
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
|
}
|
||||||
?(control.pageCount-button_repeator.count+index)
|
Repeater {
|
||||||
:(control.pageCurrent+2+index-control.__pageButtonHalf)
|
id: button_repeator
|
||||||
}
|
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
|
||||||
text:String(pageNumber)
|
delegate: FluToggleButton {
|
||||||
checked: pageNumber === control.pageCurrent
|
property int pageNumber: {
|
||||||
clickListener:function(){
|
return (control.pageCurrent <= control.__pageButtonHalf)
|
||||||
control.calcNewPage(pageNumber);
|
? (2 + index)
|
||||||
}
|
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
|
||||||
}
|
? (control.pageCount - button_repeator.count + index)
|
||||||
}
|
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
|
||||||
FluText{
|
}
|
||||||
visible: (control.pageCount>control.pageButtonCount&&
|
text: String(pageNumber)
|
||||||
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
|
checked: pageNumber === control.pageCurrent
|
||||||
text: "..."
|
clickListener: function () {
|
||||||
}
|
control.calcNewPage(pageNumber);
|
||||||
FluToggleButton{
|
}
|
||||||
property int pageNumber:control.pageCount
|
}
|
||||||
visible: control.pageCount>1
|
}
|
||||||
checked: pageNumber === control.pageCurrent
|
FluText {
|
||||||
text:String(pageNumber)
|
visible: (control.pageCount > control.pageButtonCount &&
|
||||||
clickListener:function(){
|
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
|
||||||
control.calcNewPage(pageNumber);
|
text: "..."
|
||||||
}
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
}
|
property int pageNumber: control.pageCount
|
||||||
FluToggleButton{
|
visible: control.pageCount > 1
|
||||||
visible: control.pageCount>1
|
checked: pageNumber === control.pageCurrent
|
||||||
disabled: control.pageCurrent>=control.pageCount
|
text: String(pageNumber)
|
||||||
text:control.nextText
|
clickListener: function () {
|
||||||
clickListener:function() {
|
control.calcNewPage(pageNumber);
|
||||||
control.calcNewPage(control.pageCurrent+1);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
function calcNewPage(page)
|
visible: control.pageCount > 1
|
||||||
{
|
disabled: control.pageCurrent >= control.pageCount
|
||||||
if(!page)
|
text: control.nextText
|
||||||
return
|
clickListener: function () {
|
||||||
let page_num=Number(page)
|
control.calcNewPage(control.pageCurrent + 1);
|
||||||
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
|
}
|
||||||
return
|
}
|
||||||
control.pageCurrent=page_num
|
Loader {
|
||||||
control.requestPage(page_num,control.__itemPerPage)
|
sourceComponent: footer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calcNewPage(page) {
|
||||||
|
if (!page)
|
||||||
|
return
|
||||||
|
let page_num = Number(page)
|
||||||
|
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
|
||||||
|
return
|
||||||
|
control.pageCurrent = page_num
|
||||||
|
control.requestPage(page_num, control.__itemPerPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,6 +6,8 @@ import FluentUI 1.0
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
default property alias buttons: control.data
|
default property alias buttons: control.data
|
||||||
property int currentIndex : -1
|
property int currentIndex : -1
|
||||||
|
property bool disabled: false
|
||||||
|
property bool manuallyDisabled: false
|
||||||
id:control
|
id:control
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
for(var i = 0;i<buttons.length;i++){
|
for(var i = 0;i<buttons.length;i++){
|
||||||
@ -16,6 +18,12 @@ ColumnLayout {
|
|||||||
button.checked = true
|
button.checked = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onDisabledChanged: {
|
||||||
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
|
onManuallyDisabledChanged: {
|
||||||
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for(var i = 0;i<buttons.length;i++){
|
for(var i = 0;i<buttons.length;i++){
|
||||||
buttons[i].clickListener = function(){
|
buttons[i].clickListener = function(){
|
||||||
@ -27,6 +35,12 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentIndex = 0
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshButtonStatus() {
|
||||||
|
for(var i = 0;i<buttons.length;i++){
|
||||||
|
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,6 +196,11 @@ Rectangle {
|
|||||||
id:com_table_delegate
|
id:com_table_delegate
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:item_table_mouse
|
id:item_table_mouse
|
||||||
|
TableView.onPooled: {
|
||||||
|
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||||
|
control.closeEditor()
|
||||||
|
}
|
||||||
|
}
|
||||||
property var rowObject : control.getRow(row)
|
property var rowObject : control.getRow(row)
|
||||||
property var itemModel: model
|
property var itemModel: model
|
||||||
property bool editVisible: {
|
property bool editVisible: {
|
||||||
@ -274,9 +279,9 @@ Rectangle {
|
|||||||
if(typeof(display) == "object"){
|
if(typeof(display) == "object"){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loader_edit.display = display
|
||||||
d.editDelegate = d.getEditDelegate(column)
|
d.editDelegate = d.getEditDelegate(column)
|
||||||
updateEditPosition()
|
updateEditPosition()
|
||||||
loader_edit.display = display
|
|
||||||
}
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
(event)=>{
|
(event)=>{
|
||||||
|
@ -279,13 +279,7 @@ Window {
|
|||||||
id:loader_border
|
id:loader_border
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(window.useSystemAppBar){
|
if(window.useSystemAppBar || FluTools.isWin() || window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
if(FluTools.isWindows10OrGreater()){
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
return com_border
|
return com_border
|
||||||
@ -295,16 +289,19 @@ Window {
|
|||||||
loader_loading.sourceComponent = undefined
|
loader_loading.sourceComponent = undefined
|
||||||
}
|
}
|
||||||
function showSuccess(text,duration,moremsg){
|
function showSuccess(text,duration,moremsg){
|
||||||
info_bar.showSuccess(text,duration,moremsg)
|
return info_bar.showSuccess(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showInfo(text,duration,moremsg){
|
function showInfo(text,duration,moremsg){
|
||||||
info_bar.showInfo(text,duration,moremsg)
|
return info_bar.showInfo(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showWarning(text,duration,moremsg){
|
function showWarning(text,duration,moremsg){
|
||||||
info_bar.showWarning(text,duration,moremsg)
|
return info_bar.showWarning(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showError(text,duration,moremsg){
|
function showError(text,duration,moremsg){
|
||||||
info_bar.showError(text,duration,moremsg)
|
return info_bar.showError(text,duration,moremsg)
|
||||||
|
}
|
||||||
|
function clearAllInfo(){
|
||||||
|
return info_bar.clearAllInfo()
|
||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||||
|
@ -6,6 +6,7 @@ FluTextBox{
|
|||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: qsTr("No results found")
|
property string emptyText: qsTr("No results found")
|
||||||
property int autoSuggestBoxReplacement: FluentIcons.Search
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
|
property string textRole: "title"
|
||||||
property var filter: function(item){
|
property var filter: function(item){
|
||||||
if(item.title.indexOf(control.text)!==-1){
|
if(item.title.indexOf(control.text)!==-1){
|
||||||
return true
|
return true
|
||||||
@ -24,7 +25,7 @@ FluTextBox{
|
|||||||
function handleClick(modelData){
|
function handleClick(modelData){
|
||||||
control_popup.visible = false
|
control_popup.visible = false
|
||||||
control.itemClicked(modelData)
|
control.itemClicked(modelData)
|
||||||
control.updateText(modelData.title)
|
control.updateText(modelData[textRole])
|
||||||
}
|
}
|
||||||
function loadData(){
|
function loadData(){
|
||||||
var result = []
|
var result = []
|
||||||
@ -47,7 +48,6 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
Popup{
|
Popup{
|
||||||
id:control_popup
|
id:control_popup
|
||||||
y:control.height
|
|
||||||
focus: false
|
focus: false
|
||||||
padding: 0
|
padding: 0
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
@ -61,7 +61,7 @@ FluTextBox{
|
|||||||
contentItem: FluClip{
|
contentItem: FluClip{
|
||||||
radius: [5,5,5,5]
|
radius: [5,5,5,5]
|
||||||
ListView{
|
ListView{
|
||||||
id:list_view
|
id: list_view
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
@ -71,7 +71,7 @@ FluTextBox{
|
|||||||
height: visible ? 38 : 0
|
height: visible ? 38 : 0
|
||||||
visible: list_view.count === 0
|
visible: list_view.count === 0
|
||||||
FluText{
|
FluText{
|
||||||
text:emptyText
|
text: emptyText
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -80,10 +80,10 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate:FluControl{
|
delegate:FluControl{
|
||||||
id:item_control
|
id: item_control
|
||||||
height: 38
|
height: 38
|
||||||
width: control.width
|
width: control.width
|
||||||
onClicked:{
|
onClicked: {
|
||||||
d.handleClick(modelData)
|
d.handleClick(modelData)
|
||||||
}
|
}
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
@ -102,7 +102,7 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: FluText{
|
contentItem: FluText{
|
||||||
text:modelData.title
|
text: modelData[textRole]
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
rightPadding: 10
|
rightPadding: 10
|
||||||
verticalAlignment : Qt.AlignVCenter
|
verticalAlignment : Qt.AlignVCenter
|
||||||
@ -127,7 +127,7 @@ FluTextBox{
|
|||||||
if(d.flagVisible){
|
if(d.flagVisible){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
|
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
|
||||||
control_popup.y = control.height
|
control_popup.y = Qt.binding(function(){return control.height})
|
||||||
} else if(pos.y>rect_background.implicitHeight){
|
} else if(pos.y>rect_background.implicitHeight){
|
||||||
control_popup.y = -rect_background.implicitHeight
|
control_popup.y = -rect_background.implicitHeight
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls 2.15
|
||||||
import FluentUI
|
import FluentUI 1.0
|
||||||
|
|
||||||
FluObject {
|
FluObject {
|
||||||
property var root;
|
property var root;
|
||||||
@ -18,22 +18,23 @@ FluObject {
|
|||||||
if(screenLayout){
|
if(screenLayout){
|
||||||
var last = screenLayout.getLastloader();
|
var last = screenLayout.getLastloader();
|
||||||
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
||||||
last.restart();
|
last.duration = duration
|
||||||
return;
|
if (duration > 0) last.restart();
|
||||||
|
return last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initScreenLayout();
|
initScreenLayout();
|
||||||
contentComponent.createObject(screenLayout,{
|
return contentComponent.createObject(screenLayout,{
|
||||||
type:type,
|
type:type,
|
||||||
text:text,
|
text:text,
|
||||||
duration:duration,
|
duration:duration,
|
||||||
moremsg:moremsg,
|
moremsg:moremsg,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function createCustom(itemcomponent,duration){
|
function createCustom(itemcomponent,duration){
|
||||||
initScreenLayout();
|
initScreenLayout();
|
||||||
if(itemcomponent){
|
if(itemcomponent){
|
||||||
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function initScreenLayout(){
|
function initScreenLayout(){
|
||||||
@ -85,7 +86,9 @@ FluObject {
|
|||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
id:delayTimer
|
id:delayTimer
|
||||||
interval: duration; running: duration > 0; repeat: duration > 0
|
interval: duration;
|
||||||
|
running: duration > 0;
|
||||||
|
repeat: duration > 0
|
||||||
onTriggered: content.close();
|
onTriggered: content.close();
|
||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
@ -235,18 +238,26 @@ FluObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showSuccess(text,duration=1000,moremsg){
|
function showSuccess(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showInfo(text,duration=1000,moremsg){
|
function showInfo(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showWarning(text,duration=1000,moremsg){
|
function showWarning(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showError(text,duration=1000,moremsg){
|
function showError(text,duration=1000,moremsg){
|
||||||
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||||
}
|
}
|
||||||
function showCustom(itemcomponent,duration=1000){
|
function showCustom(itemcomponent,duration=1000){
|
||||||
mcontrol.createCustom(itemcomponent,duration);
|
return mcontrol.createCustom(itemcomponent,duration);
|
||||||
|
}
|
||||||
|
function clearAllInfo(){
|
||||||
|
if(mcontrol.screenLayout != null) {
|
||||||
|
mcontrol.screenLayout.destroy()
|
||||||
|
mcontrol.screenLayout = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,6 @@ T.MenuBarItem {
|
|||||||
radius: 3
|
radius: 3
|
||||||
color: {
|
color: {
|
||||||
if(control.highlighted){
|
if(control.highlighted){
|
||||||
return FluTheme.itemCheckColor
|
|
||||||
}
|
|
||||||
if(control.hovered){
|
|
||||||
return FluTheme.itemHoverColor
|
return FluTheme.itemHoverColor
|
||||||
}
|
}
|
||||||
return FluTheme.itemNormalColor
|
return FluTheme.itemNormalColor
|
||||||
|
@ -100,9 +100,9 @@ T.MenuItem {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 3
|
anchors.margins: 3
|
||||||
radius: 4
|
radius: 4
|
||||||
color:{
|
color: {
|
||||||
if(control.highlighted){
|
if(control.highlighted){
|
||||||
return FluTheme.itemCheckColor
|
return FluTheme.itemHoverColor
|
||||||
}
|
}
|
||||||
return FluTheme.itemNormalColor
|
return FluTheme.itemNormalColor
|
||||||
}
|
}
|
||||||
|
@ -1,100 +1,111 @@
|
|||||||
import QtQuick
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts 1.15
|
||||||
import FluentUI
|
import FluentUI 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
signal requestPage(int page,int count)
|
signal requestPage(int page, int count)
|
||||||
property string previousText: qsTr("<Previous")
|
|
||||||
property string nextText: qsTr("Next>")
|
property string previousText: qsTr("<Previous")
|
||||||
property int pageCurrent: 0
|
property string nextText: qsTr("Next>")
|
||||||
property int itemCount: 0
|
property int pageCurrent: 0
|
||||||
property int pageButtonCount: 5
|
property int itemCount: 0
|
||||||
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
property int pageButtonCount: 5
|
||||||
property int __itemPerPage: 10
|
property int pageCount: itemCount > 0 ? Math.ceil(itemCount / __itemPerPage) : 0
|
||||||
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
property int __itemPerPage: 10
|
||||||
id: control
|
property int __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
|
||||||
implicitHeight: 40
|
property Component header: null
|
||||||
implicitWidth: content.width
|
property Component footer: null
|
||||||
Row{
|
id: control
|
||||||
id: content
|
implicitHeight: 40
|
||||||
height: control.height
|
implicitWidth: content.width
|
||||||
spacing: 10
|
Row {
|
||||||
padding: 10
|
id: content
|
||||||
FluToggleButton{
|
height: control.height
|
||||||
visible: control.pageCount>1
|
spacing: 10
|
||||||
disabled: control.pageCurrent<=1
|
padding: 10
|
||||||
text:control.previousText
|
Loader {
|
||||||
clickListener:function() {
|
sourceComponent: header
|
||||||
control.calcNewPage(control.pageCurrent-1);
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
}
|
visible: control.pageCount > 1
|
||||||
Row{
|
disabled: control.pageCurrent <= 1
|
||||||
spacing: 5
|
text: control.previousText
|
||||||
FluToggleButton{
|
clickListener: function () {
|
||||||
property int pageNumber:1
|
control.calcNewPage(control.pageCurrent - 1);
|
||||||
visible: control.pageCount>0
|
}
|
||||||
checked: pageNumber === control.pageCurrent
|
}
|
||||||
text:String(pageNumber)
|
Row {
|
||||||
clickListener:function() {
|
spacing: 5
|
||||||
control.calcNewPage(pageNumber);
|
|
||||||
}
|
FluToggleButton {
|
||||||
}
|
property int pageNumber: 1
|
||||||
FluText{
|
visible: control.pageCount > 0
|
||||||
visible: (control.pageCount>control.pageButtonCount&&
|
checked: pageNumber === control.pageCurrent
|
||||||
control.pageCurrent>control.__pageButtonHalf)
|
text: String(pageNumber)
|
||||||
text: "..."
|
clickListener: function () {
|
||||||
}
|
control.calcNewPage(pageNumber);
|
||||||
Repeater{
|
}
|
||||||
id: button_repeator
|
}
|
||||||
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
|
FluText {
|
||||||
delegate:FluToggleButton{
|
visible: (control.pageCount > control.pageButtonCount &&
|
||||||
property int pageNumber: {
|
control.pageCurrent > control.__pageButtonHalf)
|
||||||
return (control.pageCurrent<=control.__pageButtonHalf)
|
text: "..."
|
||||||
?(2+index)
|
}
|
||||||
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
|
Repeater {
|
||||||
?(control.pageCount-button_repeator.count+index)
|
id: button_repeator
|
||||||
:(control.pageCurrent+2+index-control.__pageButtonHalf)
|
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
|
||||||
}
|
delegate: FluToggleButton {
|
||||||
text:String(pageNumber)
|
property int pageNumber: {
|
||||||
checked: pageNumber === control.pageCurrent
|
return (control.pageCurrent <= control.__pageButtonHalf)
|
||||||
clickListener:function(){
|
? (2 + index)
|
||||||
control.calcNewPage(pageNumber);
|
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
|
||||||
}
|
? (control.pageCount - button_repeator.count + index)
|
||||||
}
|
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
|
||||||
}
|
}
|
||||||
FluText{
|
text: String(pageNumber)
|
||||||
visible: (control.pageCount>control.pageButtonCount&&
|
checked: pageNumber === control.pageCurrent
|
||||||
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
|
clickListener: function () {
|
||||||
text: "..."
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
FluToggleButton{
|
}
|
||||||
property int pageNumber:control.pageCount
|
}
|
||||||
visible: control.pageCount>1
|
FluText {
|
||||||
checked: pageNumber === control.pageCurrent
|
visible: (control.pageCount > control.pageButtonCount &&
|
||||||
text:String(pageNumber)
|
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
|
||||||
clickListener:function(){
|
text: "..."
|
||||||
control.calcNewPage(pageNumber);
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
}
|
property int pageNumber: control.pageCount
|
||||||
}
|
visible: control.pageCount > 1
|
||||||
FluToggleButton{
|
checked: pageNumber === control.pageCurrent
|
||||||
visible: control.pageCount>1
|
text: String(pageNumber)
|
||||||
disabled: control.pageCurrent>=control.pageCount
|
clickListener: function () {
|
||||||
text:control.nextText
|
control.calcNewPage(pageNumber);
|
||||||
clickListener:function() {
|
}
|
||||||
control.calcNewPage(control.pageCurrent+1);
|
}
|
||||||
}
|
}
|
||||||
}
|
FluToggleButton {
|
||||||
}
|
visible: control.pageCount > 1
|
||||||
function calcNewPage(page)
|
disabled: control.pageCurrent >= control.pageCount
|
||||||
{
|
text: control.nextText
|
||||||
if(!page)
|
clickListener: function () {
|
||||||
return
|
control.calcNewPage(control.pageCurrent + 1);
|
||||||
let page_num=Number(page)
|
}
|
||||||
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
|
}
|
||||||
return
|
Loader {
|
||||||
control.pageCurrent=page_num
|
sourceComponent: footer
|
||||||
control.requestPage(page_num,control.__itemPerPage)
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
function calcNewPage(page) {
|
||||||
|
if (!page)
|
||||||
|
return
|
||||||
|
let page_num = Number(page)
|
||||||
|
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
|
||||||
|
return
|
||||||
|
control.pageCurrent = page_num
|
||||||
|
control.requestPage(page_num, control.__itemPerPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -7,6 +7,8 @@ import FluentUI
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
default property alias buttons: control.data
|
default property alias buttons: control.data
|
||||||
property int currentIndex : -1
|
property int currentIndex : -1
|
||||||
|
property bool disabled: false
|
||||||
|
property bool manuallyDisabled: false
|
||||||
id:control
|
id:control
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
for(var i = 0;i<buttons.length;i++){
|
for(var i = 0;i<buttons.length;i++){
|
||||||
@ -17,6 +19,12 @@ ColumnLayout {
|
|||||||
button.checked = true
|
button.checked = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onDisabledChanged: {
|
||||||
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
|
onManuallyDisabledChanged: {
|
||||||
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for(var i = 0;i<buttons.length;i++){
|
for(var i = 0;i<buttons.length;i++){
|
||||||
buttons[i].clickListener = function(){
|
buttons[i].clickListener = function(){
|
||||||
@ -28,6 +36,12 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentIndex = 0
|
refreshButtonStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshButtonStatus() {
|
||||||
|
for(var i = 0;i<buttons.length;i++){
|
||||||
|
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,9 @@ QtObject {
|
|||||||
var launchMode = win.launchMode
|
var launchMode = win.launchMode
|
||||||
if(launchMode === 1){
|
if(launchMode === 1){
|
||||||
win.argument = argument
|
win.argument = argument
|
||||||
win.show()
|
if(!win.visible){
|
||||||
|
win.visible = true
|
||||||
|
}
|
||||||
win.raise()
|
win.raise()
|
||||||
win.requestActivate()
|
win.requestActivate()
|
||||||
return
|
return
|
||||||
|
@ -196,6 +196,11 @@ Rectangle {
|
|||||||
id:com_table_delegate
|
id:com_table_delegate
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:item_table_mouse
|
id:item_table_mouse
|
||||||
|
TableView.onPooled: {
|
||||||
|
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||||
|
control.closeEditor()
|
||||||
|
}
|
||||||
|
}
|
||||||
property var rowObject : control.getRow(row)
|
property var rowObject : control.getRow(row)
|
||||||
property var itemModel: model
|
property var itemModel: model
|
||||||
property bool editVisible: {
|
property bool editVisible: {
|
||||||
@ -274,9 +279,9 @@ Rectangle {
|
|||||||
if(typeof(display) == "object"){
|
if(typeof(display) == "object"){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loader_edit.display = display
|
||||||
d.editDelegate = d.getEditDelegate(column)
|
d.editDelegate = d.getEditDelegate(column)
|
||||||
updateEditPosition()
|
updateEditPosition()
|
||||||
loader_edit.display = display
|
|
||||||
}
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
(event)=>{
|
(event)=>{
|
||||||
|
@ -278,13 +278,7 @@ Window {
|
|||||||
id:loader_border
|
id:loader_border
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(window.useSystemAppBar){
|
if(window.useSystemAppBar || FluTools.isWin() || window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
if(FluTools.isWindows10OrGreater()){
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
return com_border
|
return com_border
|
||||||
@ -294,16 +288,19 @@ Window {
|
|||||||
loader_loading.sourceComponent = undefined
|
loader_loading.sourceComponent = undefined
|
||||||
}
|
}
|
||||||
function showSuccess(text,duration,moremsg){
|
function showSuccess(text,duration,moremsg){
|
||||||
info_bar.showSuccess(text,duration,moremsg)
|
return info_bar.showSuccess(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showInfo(text,duration,moremsg){
|
function showInfo(text,duration,moremsg){
|
||||||
info_bar.showInfo(text,duration,moremsg)
|
return info_bar.showInfo(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showWarning(text,duration,moremsg){
|
function showWarning(text,duration,moremsg){
|
||||||
info_bar.showWarning(text,duration,moremsg)
|
return info_bar.showWarning(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function showError(text,duration,moremsg){
|
function showError(text,duration,moremsg){
|
||||||
info_bar.showError(text,duration,moremsg)
|
return info_bar.showError(text,duration,moremsg)
|
||||||
|
}
|
||||||
|
function clearAllInfo(){
|
||||||
|
return info_bar.clearAllInfo()
|
||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||||
@ -318,9 +315,6 @@ Window {
|
|||||||
window.minimumHeight = window.height
|
window.minimumHeight = window.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function registerForWindowResult(path){
|
|
||||||
return FluApp.createWindowRegister(window,path)
|
|
||||||
}
|
|
||||||
function setResult(data){
|
function setResult(data){
|
||||||
if(_windowRegister){
|
if(_windowRegister){
|
||||||
_windowRegister.setResult(data)
|
_windowRegister.setResult(data)
|
||||||
|
Reference in New Issue
Block a user