update
parent
12fa3487bb
commit
b349c22434
|
@ -90,6 +90,57 @@ FluScrollablePage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 10
|
||||||
|
code:'FluTableView{
|
||||||
|
id:table_view
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
width:parent.width
|
||||||
|
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){
|
||||||
const dataSource = []
|
const dataSource = []
|
||||||
|
|
|
@ -113,7 +113,9 @@ FluExpander{
|
||||||
"FluTooltip",
|
"FluTooltip",
|
||||||
"FluTreeView",
|
"FluTreeView",
|
||||||
"FluWindow",
|
"FluWindow",
|
||||||
"FluWindowResize"
|
"FluWindowResize",
|
||||||
|
"FluToggleButton",
|
||||||
|
"FluTableView"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
|
|
|
@ -33,6 +33,7 @@ void Fluent::registerTypes(const char *uri){
|
||||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||||
|
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTableView.qml"),uri,major,minor,"FluTableView");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTableView.qml"),uri,major,minor,"FluTableView");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
@ -7,6 +8,8 @@ Item {
|
||||||
|
|
||||||
|
|
||||||
signal requestPage(int page,int count)
|
signal requestPage(int page,int count)
|
||||||
|
property string previousText: "<上一页"
|
||||||
|
property string nextText: "下一页>"
|
||||||
property int pageCurrent: 0
|
property int pageCurrent: 0
|
||||||
property int itemCount: 0
|
property int itemCount: 0
|
||||||
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
||||||
|
@ -28,7 +31,7 @@ Item {
|
||||||
FluToggleButton{
|
FluToggleButton{
|
||||||
visible: control.pageCount>1
|
visible: control.pageCount>1
|
||||||
disabled: control.pageCurrent<=1
|
disabled: control.pageCurrent<=1
|
||||||
text:"<上一页"
|
text:control.previousText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
control.calcNewPage(control.pageCurrent-1);
|
control.calcNewPage(control.pageCurrent-1);
|
||||||
}
|
}
|
||||||
|
@ -76,8 +79,7 @@ Item {
|
||||||
}
|
}
|
||||||
FluToggleButton{
|
FluToggleButton{
|
||||||
property int pageNumber:control.pageCount
|
property int pageNumber:control.pageCount
|
||||||
visible: control.pageCount>0
|
visible: control.pageCount>1
|
||||||
enabled: control.pageCurrent>1
|
|
||||||
selected: pageNumber === control.pageCurrent
|
selected: pageNumber === control.pageCurrent
|
||||||
text:String(pageNumber)
|
text:String(pageNumber)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -88,7 +90,7 @@ Item {
|
||||||
FluToggleButton{
|
FluToggleButton{
|
||||||
visible: control.pageCount>1
|
visible: control.pageCount>1
|
||||||
disabled: control.pageCurrent>=control.pageCount
|
disabled: control.pageCurrent>=control.pageCount
|
||||||
text:"下一页>"
|
text:control.nextText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
control.calcNewPage(control.pageCurrent+1);
|
control.calcNewPage(control.pageCurrent+1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ FluControl {
|
||||||
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3)
|
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 disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||||
property bool textBold: true
|
property bool textBold: true
|
||||||
|
|
||||||
|
@ -36,6 +37,9 @@ FluControl {
|
||||||
if(disabled){
|
if(disabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
|
if(pressed){
|
||||||
|
return pressedColor
|
||||||
|
}
|
||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue