This commit is contained in:
zhuzichu
2023-06-28 13:13:39 +08:00
parent 90943674b3
commit 192c65a510
7 changed files with 140 additions and 84 deletions

View File

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

View File

@ -111,6 +111,9 @@ void FluApp::closeApp(){
}
void FluApp::deleteWindow(QQuickWindow* window){
wnds.remove(window->winId());
window->deleteLater();
if(window){
wnds.remove(window->winId());
window->deleteLater();
window = nullptr;
}
}

View File

@ -89,5 +89,8 @@ void FluTools::restoreOverrideCursor(){
}
void FluTools::deleteItem(QObject *p){
p->deleteLater();
if(p){
delete p;
p = nullptr;
}
}

View File

@ -59,6 +59,16 @@ Rectangle {
}
}
}
Component{
id:com_text
FluText {
text: itemData
anchors.fill: parent
anchors.margins: 10
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
ScrollView{
id:scroll_table
anchors.left: header_vertical.right
@ -110,6 +120,8 @@ Rectangle {
model: table_model
clip: true
delegate: Rectangle {
id:item_table
property var position: Qt.point(column,row)
required property bool selected
property bool current: selection_model.currentIndex === table_model.index(row,column)
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))
@ -118,6 +130,9 @@ Rectangle {
TapHandler{
acceptedButtons: Qt.LeftButton
onDoubleTapped: {
if(display instanceof Component){
return
}
selection_model.setCurrentIndex(table_model.index(row,column), ItemSelectionModel.Current)
item_loader.sourceComponent = obtEditDelegate(column,row)
var index = table_model.index(row,column)
@ -128,12 +143,20 @@ Rectangle {
}
}
}
FluText {
text: display
Loader{
property var itemData: display
property var tableView: table_view
property var tableModel: table_model
property var position: item_table.position
property int row: position.y
property int column: position.x
anchors.fill: parent
anchors.margins: 10
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
sourceComponent: {
if(itemData instanceof Component){
return itemData
}
return com_text
}
}
}
}
@ -353,13 +376,10 @@ Rectangle {
}
}
}
function closeEditor(){
item_loader.sourceComponent = null
}
function resetPosition(){
table_view.positionViewAtCell(Qt.point(0, 0),Qt.AlignTop|Qt.AlignLeft)
}
}