mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
Compare commits
No commits in common. "2d4e61445e28c4f428d487b6d8438f025f2a1e2e" and "24fdff7e3591ff4b380d75e8d1d7163c39420234" have entirely different histories.
2d4e61445e
...
24fdff7e35
@ -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="513"/>
|
<location filename="qml/page/T_TableView.qml" line="499"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1998,47 +1998,37 @@ Some contents...</source>
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="470"/>
|
<location filename="qml/page/T_TableView.qml" line="494"/>
|
||||||
<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="526"/>
|
<location filename="qml/page/T_TableView.qml" line="512"/>
|
||||||
<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="534"/>
|
<location filename="qml/page/T_TableView.qml" line="520"/>
|
||||||
<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="541"/>
|
<location filename="qml/page/T_TableView.qml" line="527"/>
|
||||||
<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="549"/>
|
<location filename="qml/page/T_TableView.qml" line="535"/>
|
||||||
<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="568"/>
|
<location filename="qml/page/T_TableView.qml" line="554"/>
|
||||||
<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="569"/>
|
<location filename="qml/page/T_TableView.qml" line="555"/>
|
||||||
<source>Next></source>
|
<source>Next></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="513"/>
|
<location filename="qml/page/T_TableView.qml" line="499"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished">名称</translation>
|
<translation type="unfinished">名称</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2140,47 +2140,37 @@ Some contents...</source>
|
|||||||
<translation type="unfinished">清除所有</translation>
|
<translation type="unfinished">清除所有</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="470"/>
|
<location filename="qml/page/T_TableView.qml" line="494"/>
|
||||||
<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="526"/>
|
<location filename="qml/page/T_TableView.qml" line="512"/>
|
||||||
<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="534"/>
|
<location filename="qml/page/T_TableView.qml" line="520"/>
|
||||||
<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="541"/>
|
<location filename="qml/page/T_TableView.qml" line="527"/>
|
||||||
<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="549"/>
|
<location filename="qml/page/T_TableView.qml" line="535"/>
|
||||||
<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="568"/>
|
<location filename="qml/page/T_TableView.qml" line="554"/>
|
||||||
<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="569"/>
|
<location filename="qml/page/T_TableView.qml" line="555"/>
|
||||||
<source>Next></source>
|
<source>Next></source>
|
||||||
<translation type="unfinished">下一页></translation>
|
<translation type="unfinished">下一页></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -13,7 +13,7 @@ FluContentPage{
|
|||||||
|
|
||||||
property var dataSource : []
|
property var dataSource : []
|
||||||
property int sortType: 0
|
property int sortType: 0
|
||||||
property bool selectedAll: true
|
property bool seletedAll: 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.selectedAll = false
|
root.seletedAll = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.selectedAll = true
|
root.seletedAll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onSortTypeChanged: {
|
onSortTypeChanged: {
|
||||||
@ -238,12 +238,12 @@ FluContentPage{
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
checked: true === root.selectedAll
|
checked: true === root.seletedAll
|
||||||
animationEnabled: false
|
animationEnabled: false
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
clickListener: function(){
|
clickListener: function(){
|
||||||
root.selectedAll = !root.selectedAll
|
root.seletedAll = !root.seletedAll
|
||||||
var checked = root.selectedAll
|
var checked = root.seletedAll
|
||||||
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)
|
||||||
@ -466,20 +466,6 @@ 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!"))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,7 +588,7 @@ FluContentPage{
|
|||||||
return avatars[randomIndex];
|
return avatars[randomIndex];
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
checkbox: table_view.customItem(com_checbox,{checked:root.selectedAll}),
|
checkbox: table_view.customItem(com_checbox,{checked:root.seletedAll}),
|
||||||
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
@ -615,7 +601,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
root.selectedAll = true
|
root.seletedAll = 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())
|
||||||
|
@ -3,110 +3,98 @@ import QtQuick.Controls 2.15
|
|||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import FluentUI 1.0
|
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 previousText: qsTr("<Previous")
|
||||||
property string nextText: qsTr("Next>")
|
property string nextText: qsTr("Next>")
|
||||||
property int pageCurrent: 0
|
property int pageCurrent: 0
|
||||||
property int itemCount: 0
|
property int itemCount: 0
|
||||||
property int pageButtonCount: 5
|
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 __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
|
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
||||||
property Component header: null
|
|
||||||
property Component footer: null
|
|
||||||
id: control
|
id: control
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
implicitWidth: content.width
|
implicitWidth: content.width
|
||||||
Row {
|
Row{
|
||||||
id: content
|
id: content
|
||||||
height: control.height
|
height: control.height
|
||||||
spacing: 10
|
spacing: 10
|
||||||
padding: 10
|
padding: 10
|
||||||
Loader {
|
FluToggleButton{
|
||||||
sourceComponent: header
|
visible: control.pageCount>1
|
||||||
}
|
disabled: control.pageCurrent<=1
|
||||||
FluToggleButton {
|
text:control.previousText
|
||||||
visible: control.pageCount > 1
|
clickListener:function() {
|
||||||
disabled: control.pageCurrent <= 1
|
control.calcNewPage(control.pageCurrent-1);
|
||||||
text: control.previousText
|
|
||||||
clickListener: function () {
|
|
||||||
control.calcNewPage(control.pageCurrent - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
Row{
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
FluToggleButton{
|
||||||
FluToggleButton {
|
property int pageNumber:1
|
||||||
property int pageNumber: 1
|
visible: control.pageCount>0
|
||||||
visible: control.pageCount > 0
|
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener: function () {
|
clickListener:function() {
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText {
|
FluText{
|
||||||
visible: (control.pageCount > control.pageButtonCount &&
|
visible: (control.pageCount>control.pageButtonCount&&
|
||||||
control.pageCurrent > control.__pageButtonHalf)
|
control.pageCurrent>control.__pageButtonHalf)
|
||||||
text: "..."
|
text: "..."
|
||||||
}
|
}
|
||||||
Repeater {
|
Repeater{
|
||||||
id: button_repeator
|
id: button_repeator
|
||||||
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
|
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
|
||||||
delegate: FluToggleButton {
|
delegate:FluToggleButton{
|
||||||
property int pageNumber: {
|
property int pageNumber: {
|
||||||
return (control.pageCurrent <= control.__pageButtonHalf)
|
return (control.pageCurrent<=control.__pageButtonHalf)
|
||||||
? (2 + index)
|
?(2+index)
|
||||||
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
|
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
|
||||||
? (control.pageCount - button_repeator.count + index)
|
?(control.pageCount-button_repeator.count+index)
|
||||||
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
|
:(control.pageCurrent+2+index-control.__pageButtonHalf)
|
||||||
}
|
}
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
clickListener: function () {
|
clickListener:function(){
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText {
|
FluText{
|
||||||
visible: (control.pageCount > control.pageButtonCount &&
|
visible: (control.pageCount>control.pageButtonCount&&
|
||||||
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
|
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
|
||||||
text: "..."
|
text: "..."
|
||||||
}
|
}
|
||||||
FluToggleButton {
|
FluToggleButton{
|
||||||
property int pageNumber: control.pageCount
|
property int pageNumber:control.pageCount
|
||||||
visible: control.pageCount > 1
|
visible: control.pageCount>1
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener: function () {
|
clickListener:function(){
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleButton {
|
FluToggleButton{
|
||||||
visible: control.pageCount > 1
|
visible: control.pageCount>1
|
||||||
disabled: control.pageCurrent >= control.pageCount
|
disabled: control.pageCurrent>=control.pageCount
|
||||||
text: control.nextText
|
text:control.nextText
|
||||||
clickListener: function () {
|
clickListener:function() {
|
||||||
control.calcNewPage(control.pageCurrent + 1);
|
control.calcNewPage(control.pageCurrent+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loader {
|
|
||||||
sourceComponent: footer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
function calcNewPage(page)
|
||||||
function calcNewPage(page) {
|
{
|
||||||
if (!page)
|
if(!page)
|
||||||
return
|
return
|
||||||
let page_num = Number(page)
|
let page_num=Number(page)
|
||||||
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
|
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
|
||||||
return
|
return
|
||||||
control.pageCurrent = page_num
|
control.pageCurrent=page_num
|
||||||
control.requestPage(page_num, control.__itemPerPage)
|
control.requestPage(page_num,control.__itemPerPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,111 +1,100 @@
|
|||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts
|
||||||
import FluentUI 1.0
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
signal requestPage(int page, int count)
|
signal requestPage(int page,int count)
|
||||||
|
|
||||||
property string previousText: qsTr("<Previous")
|
property string previousText: qsTr("<Previous")
|
||||||
property string nextText: qsTr("Next>")
|
property string nextText: qsTr("Next>")
|
||||||
property int pageCurrent: 0
|
property int pageCurrent: 0
|
||||||
property int itemCount: 0
|
property int itemCount: 0
|
||||||
property int pageButtonCount: 5
|
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 __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
|
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
||||||
property Component header: null
|
|
||||||
property Component footer: null
|
|
||||||
id: control
|
id: control
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
implicitWidth: content.width
|
implicitWidth: content.width
|
||||||
Row {
|
Row{
|
||||||
id: content
|
id: content
|
||||||
height: control.height
|
height: control.height
|
||||||
spacing: 10
|
spacing: 10
|
||||||
padding: 10
|
padding: 10
|
||||||
Loader {
|
FluToggleButton{
|
||||||
sourceComponent: header
|
visible: control.pageCount>1
|
||||||
}
|
disabled: control.pageCurrent<=1
|
||||||
FluToggleButton {
|
text:control.previousText
|
||||||
visible: control.pageCount > 1
|
clickListener:function() {
|
||||||
disabled: control.pageCurrent <= 1
|
control.calcNewPage(control.pageCurrent-1);
|
||||||
text: control.previousText
|
|
||||||
clickListener: function () {
|
|
||||||
control.calcNewPage(control.pageCurrent - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
Row{
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
FluToggleButton{
|
||||||
FluToggleButton {
|
property int pageNumber:1
|
||||||
property int pageNumber: 1
|
visible: control.pageCount>0
|
||||||
visible: control.pageCount > 0
|
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener: function () {
|
clickListener:function() {
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText {
|
FluText{
|
||||||
visible: (control.pageCount > control.pageButtonCount &&
|
visible: (control.pageCount>control.pageButtonCount&&
|
||||||
control.pageCurrent > control.__pageButtonHalf)
|
control.pageCurrent>control.__pageButtonHalf)
|
||||||
text: "..."
|
text: "..."
|
||||||
}
|
}
|
||||||
Repeater {
|
Repeater{
|
||||||
id: button_repeator
|
id: button_repeator
|
||||||
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
|
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
|
||||||
delegate: FluToggleButton {
|
delegate:FluToggleButton{
|
||||||
property int pageNumber: {
|
property int pageNumber: {
|
||||||
return (control.pageCurrent <= control.__pageButtonHalf)
|
return (control.pageCurrent<=control.__pageButtonHalf)
|
||||||
? (2 + index)
|
?(2+index)
|
||||||
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
|
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
|
||||||
? (control.pageCount - button_repeator.count + index)
|
?(control.pageCount-button_repeator.count+index)
|
||||||
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
|
:(control.pageCurrent+2+index-control.__pageButtonHalf)
|
||||||
}
|
}
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
clickListener: function () {
|
clickListener:function(){
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText {
|
FluText{
|
||||||
visible: (control.pageCount > control.pageButtonCount &&
|
visible: (control.pageCount>control.pageButtonCount&&
|
||||||
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
|
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
|
||||||
text: "..."
|
text: "..."
|
||||||
}
|
}
|
||||||
FluToggleButton {
|
FluToggleButton{
|
||||||
property int pageNumber: control.pageCount
|
property int pageNumber:control.pageCount
|
||||||
visible: control.pageCount > 1
|
visible: control.pageCount>1
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text: String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener: function () {
|
clickListener:function(){
|
||||||
control.calcNewPage(pageNumber);
|
control.calcNewPage(pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleButton {
|
FluToggleButton{
|
||||||
visible: control.pageCount > 1
|
visible: control.pageCount>1
|
||||||
disabled: control.pageCurrent >= control.pageCount
|
disabled: control.pageCurrent>=control.pageCount
|
||||||
text: control.nextText
|
text:control.nextText
|
||||||
clickListener: function () {
|
clickListener:function() {
|
||||||
control.calcNewPage(control.pageCurrent + 1);
|
control.calcNewPage(control.pageCurrent+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loader {
|
|
||||||
sourceComponent: footer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
function calcNewPage(page)
|
||||||
function calcNewPage(page) {
|
{
|
||||||
if (!page)
|
if(!page)
|
||||||
return
|
return
|
||||||
let page_num = Number(page)
|
let page_num=Number(page)
|
||||||
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
|
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
|
||||||
return
|
return
|
||||||
control.pageCurrent = page_num
|
control.pageCurrent=page_num
|
||||||
control.requestPage(page_num, control.__itemPerPage)
|
control.requestPage(page_num,control.__itemPerPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user