This commit is contained in:
朱子楚\zhuzi 2023-06-26 19:59:28 +08:00
parent d741b3eb4f
commit 0610f63f26
4 changed files with 40 additions and 5 deletions

View File

@ -19,7 +19,7 @@ endif()
file(TO_CMAKE_PATH "/" PATH_SEPARATOR) file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
# #
add_definitions(-DVERSION=1,3,6,1) add_definitions(-DVERSION=1,3,6,2)
find_package(Qt6 REQUIRED COMPONENTS Quick) find_package(Qt6 REQUIRED COMPONENTS Quick)

View File

@ -75,7 +75,12 @@ FluContentPage{
FluTableView{ FluTableView{
id:table_view id:table_view
anchors.fill: parent anchors{
left: parent.left
right: parent.right
top: parent.top
bottom: gagination.top
}
anchors.topMargin: 20 anchors.topMargin: 20
columnSource:[ columnSource:[
{ {
@ -83,7 +88,8 @@ FluContentPage{
dataIndex: 'name', dataIndex: 'name',
width:100, width:100,
minimumWidth:80, minimumWidth:80,
maximumWidth:200 maximumWidth:200,
readOnly:true
}, },
{ {
title: '年龄', title: '年龄',
@ -109,4 +115,25 @@ FluContentPage{
} }
] ]
} }
FluPagination{
id:gagination
anchors{
bottom: parent.bottom
left: parent.left
}
pageCurrent: 1
itemCount: 100000
pageButtonCount: 7
__itemPerPage: 1000
onRequestPage:
(page,count)=> {
table_view.closeEditor()
loadData(page,count)
table_view.resetPosition()
}
}
} }

View File

@ -12,7 +12,7 @@ endif()
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI) set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
# #
add_definitions(-DVERSION=1,3,6,1) add_definitions(-DVERSION=1,3,6,2)
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml) find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)

View File

@ -23,7 +23,6 @@ Rectangle {
}) })
table_model.columns = columns table_model.columns = columns
header_model.columns = columns header_model.columns = columns
console.debug(JSON.stringify(header_rows))
d.header_rows = [header_rows] d.header_rows = [header_rows]
} }
} }
@ -110,11 +109,16 @@ Rectangle {
delegate: Rectangle { delegate: Rectangle {
required property bool selected required property bool selected
required property bool current required property bool current
property var readOnly: columnSource[column].readOnly
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)) color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
implicitHeight: 40 implicitHeight: 40
implicitWidth: columnSource[column].width implicitWidth: columnSource[column].width
TapHandler{ TapHandler{
acceptedButtons: Qt.LeftButton
onDoubleTapped: { onDoubleTapped: {
if(readOnly){
return
}
item_loader.sourceComponent = obtEditDelegate(column,row) item_loader.sourceComponent = obtEditDelegate(column,row)
var index = table_view.index(row,column) var index = table_view.index(row,column)
} }
@ -354,4 +358,8 @@ Rectangle {
item_loader.sourceComponent = null item_loader.sourceComponent = null
} }
function resetPosition(){
table_view.positionViewAtCell(Qt.point(0, 0),TableView.AlignTop|TableView.AlignLeft)
}
} }