From fd94b2d35457457bdd806a51448c84abff5d9531 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Fri, 12 Sep 2025 00:39:51 +0200 Subject: [PATCH] --- fy --- qml/xqtableview.qml | 65 -------------------------------- qml/xqtreeview.qml | 20 +++++++++- src/application/xqchildmodel.cpp | 5 +++ src/items/xqitemdelegate.cpp | 2 + src/xtree.qrc | 1 - 5 files changed, 25 insertions(+), 68 deletions(-) delete mode 100644 qml/xqtableview.qml diff --git a/qml/xqtableview.qml b/qml/xqtableview.qml deleted file mode 100644 index 01e1d3d..0000000 --- a/qml/xqtableview.qml +++ /dev/null @@ -1,65 +0,0 @@ -import QtQuick -import QtQuick.Controls -import QtQuick.Layouts - -Window -{ - width: 640 - height: 480 - visible: true - title: qsTr("StringListModel") - - TableView - { - id: childTableView - anchors.fill: parent - - model: myChildModel // z. B. QStandardItemModel mit 9 Spalten - - delegate: Rectangle - { - required property string display - - //height: 5 - //width: childTableView.width - color : "blue" - border.color: "#ccc" - width: childTableView.width; - - RowLayout - { - anchors.fill: parent - anchors.margins: 2 - - TextField - { - text : display - font.pixelSize: 10 - Layout.fillWidth: true - - background: Rectangle - { - color : "white" - } - - onEditingFinished: - { - console.log("Editing finished, new text is :"+ text + " at index :" + index) - model.names = text //The roles here are defined in model class - } - } - } - - } - - ScrollBar.horizontal: ScrollBar {} - ScrollBar.vertical: ScrollBar {} - - // // Optional: Spaltenbreiten setzen - // onModelChanged: { - // for (let i = 0; i < model.columns; ++i) - // table.setColumnWidth(i, 100) - // } - } - -} diff --git a/qml/xqtreeview.qml b/qml/xqtreeview.qml index 3d65da9..a4b3be9 100644 --- a/qml/xqtreeview.qml +++ b/qml/xqtreeview.qml @@ -30,14 +30,30 @@ TreeView implicitHeight: 20 border.color: "#cccccc" //color: index % 2 === 0 ? "#f9f9f9" : "#e0e0e0" - color: TreeView.isSelected ? "#d0eaff" : (row % 2 === 0 ? "#f9f9f9" : "#ffffff") + //color: TreeView.isSelected ? "#d0eaff" : (row % 2 === 0 ? "#f9f9f9" : "#ffffff") + //color: TreeView.isSelected ? "#d0eaff" : (row % 2 === 0 ? "#f9f9f9" : "#ffffff") - Text + TextField { + id: entry anchors.centerIn: parent text: display font.pixelSize: 12 + + background: Rectangle + { + //color: entry.enabled ? "transparent" : "#353637" + //border.color: entry.enabled ? "#21be2b" : "transparent" + border.color: "transparent" + } + + onEditingFinished: + { + console.log("Editing finished, new text is :"+ text + " at index :" + index) + model.display = text //The roles here are defined in model class + } } + } ScrollBar.horizontal: ScrollBar {} diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index 0b16fc9..e92127e 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -67,6 +67,11 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot ) // _hinter_ der letzen zeile einfügen insertRow( newRow+1, list); + if( contentEntry->has_children() ) + { + + } + } // for } diff --git a/src/items/xqitemdelegate.cpp b/src/items/xqitemdelegate.cpp index 8d33c11..fb1999f 100644 --- a/src/items/xqitemdelegate.cpp +++ b/src/items/xqitemdelegate.cpp @@ -254,6 +254,8 @@ QSize XQItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelI QWidget* XQItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { + Q_UNUSED(option); + XQItem& item = xqItemFromIndex(index); XQItem::EditorType edType = item.editorType(); if( edType == XQItem::NoEditorType ) diff --git a/src/xtree.qrc b/src/xtree.qrc index 7df0b75..ef4aeec 100644 --- a/src/xtree.qrc +++ b/src/xtree.qrc @@ -4,7 +4,6 @@ ../xml/modeldata2.xtr ../xml/modeldata3.xtr ../xml/modelsheets.xml - ../qml/xqtableview.qml ../qml/xqtreeview.qml