Merge branch 'experimental/qml-edit' into experimental/add-tree-children
# Conflicts: # src/application/xqchildmodel.cpp
This commit is contained in:
@@ -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)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -30,14 +30,30 @@ TreeView
|
|||||||
implicitHeight: 20
|
implicitHeight: 20
|
||||||
border.color: "#cccccc"
|
border.color: "#cccccc"
|
||||||
//color: index % 2 === 0 ? "#f9f9f9" : "#e0e0e0"
|
//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
|
anchors.centerIn: parent
|
||||||
text: display
|
text: display
|
||||||
font.pixelSize: 12
|
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 {}
|
ScrollBar.horizontal: ScrollBar {}
|
||||||
|
@@ -112,7 +112,7 @@ void XQMainWindow::initMainWindow()
|
|||||||
|
|
||||||
// #2. load demo data
|
// #2. load demo data
|
||||||
loadDocument( c_DocumentFileName1 );
|
loadDocument( c_DocumentFileName1 );
|
||||||
//loadDocumentQML( c_DocumentFileName2 );
|
loadDocumentQML( c_DocumentFileName2 );
|
||||||
//loadDocument( c_DocumentFileName2 );
|
//loadDocument( c_DocumentFileName2 );
|
||||||
//loadDocument( c_DocumentFileName3 );
|
//loadDocument( c_DocumentFileName3 );
|
||||||
|
|
||||||
|
@@ -119,6 +119,29 @@ void XQItemDelegate::drawHeaderStyle(QPainter* painter, const QStyleOptionViewIt
|
|||||||
{
|
{
|
||||||
QStyleOptionHeader headerOption;
|
QStyleOptionHeader headerOption;
|
||||||
|
|
||||||
|
/*
|
||||||
|
QWidget* srcWidget = nullptr;
|
||||||
|
const QTreeView* treeView = qobject_cast<const QTreeView*>(option.widget);
|
||||||
|
if (treeView != nullptr)
|
||||||
|
{
|
||||||
|
srcWidget = (QWidget*)treeView;
|
||||||
|
// is never nullptr !?
|
||||||
|
if (treeView->header() != nullptr)
|
||||||
|
{
|
||||||
|
// use the header as "parent" for style init
|
||||||
|
srcWidget = treeView->header();
|
||||||
|
}
|
||||||
|
headerOption.initFrom(srcWidget);
|
||||||
|
headerOption.text = "FIRZ";//index.data(Qt::DisplayRole).toString();
|
||||||
|
headerOption.rect = option.rect;
|
||||||
|
headerOption.styleObject = option.styleObject;
|
||||||
|
// __ch: reduce inner offset when painting
|
||||||
|
headerOption.textAlignment |= Qt::AlignVCenter;
|
||||||
|
|
||||||
|
// --
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// use the header as "parent" for style init
|
// use the header as "parent" for style init
|
||||||
QWidget* srcWidget = treeTable();//->header();
|
QWidget* srcWidget = treeTable();//->header();
|
||||||
headerOption.initFrom(srcWidget);
|
headerOption.initFrom(srcWidget);
|
||||||
@@ -129,11 +152,13 @@ void XQItemDelegate::drawHeaderStyle(QPainter* painter, const QStyleOptionViewIt
|
|||||||
headerOption.textAlignment |= Qt::AlignVCenter;
|
headerOption.textAlignment |= Qt::AlignVCenter;
|
||||||
headerOption.icon = item.icon();
|
headerOption.icon = item.icon();
|
||||||
|
|
||||||
|
|
||||||
// save painter
|
// save painter
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
|
|
||||||
QStyle* widgetStyle = srcWidget->style();
|
QStyle* widgetStyle = srcWidget->style();
|
||||||
widgetStyle->drawControl(QStyle::CE_Header, &headerOption, painter, srcWidget);
|
QApplication::style()->drawControl(QStyle::CE_Header, &headerOption, painter, srcWidget);
|
||||||
// restore painter
|
// restore painter
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
@@ -254,6 +279,8 @@ QSize XQItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelI
|
|||||||
|
|
||||||
QWidget* XQItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
QWidget* XQItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
|
||||||
XQItem& item = xqItemFromIndex(index);
|
XQItem& item = xqItemFromIndex(index);
|
||||||
XQItem::EditorType edType = item.editorType();
|
XQItem::EditorType edType = item.editorType();
|
||||||
if( edType == XQItem::NoEditorType )
|
if( edType == XQItem::NoEditorType )
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
<file alias="modeldata2.xtr">../xml/modeldata2.xtr</file>
|
<file alias="modeldata2.xtr">../xml/modeldata2.xtr</file>
|
||||||
<file alias="modeldata3.xtr">../xml/modeldata3.xtr</file>
|
<file alias="modeldata3.xtr">../xml/modeldata3.xtr</file>
|
||||||
<file alias="modelsheet.xml">../xml/modelsheets.xml</file>
|
<file alias="modelsheet.xml">../xml/modelsheets.xml</file>
|
||||||
<file alias="xqtableview.qml">../qml/xqtableview.qml</file>
|
|
||||||
<file alias="xqtreeview.qml">../qml/xqtreeview.qml</file>
|
<file alias="xqtreeview.qml">../qml/xqtreeview.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -15,9 +15,8 @@
|
|||||||
<Inverter InverterID="#3 HM1600 03" FriendlyName="@InverterName" InverterName="03 HM1600 S4 TMax" Manufacturer="HoyMiles" MaxPowerInput="9000,00" MaxPowerInputChoice="6000;8000;10000" MaxPowerOutput="1600" NumStrings="4" Weight="32"/>
|
<Inverter InverterID="#3 HM1600 03" FriendlyName="@InverterName" InverterName="03 HM1600 S4 TMax" Manufacturer="HoyMiles" MaxPowerInput="9000,00" MaxPowerInputChoice="6000;8000;10000" MaxPowerOutput="1600" NumStrings="4" Weight="32"/>
|
||||||
<Inverter InverterID="#4 D12K 04" FriendlyName="@InverterName" InverterName="04 HM600 S2 TMax" Manufacturer="Deye" MaxPowerInput="8000" MaxPowerInputChoice="6000;8000;12000" MaxPowerOutput="600" NumStrings="2" Weight="28"/>
|
<Inverter InverterID="#4 D12K 04" FriendlyName="@InverterName" InverterName="04 HM600 S2 TMax" Manufacturer="Deye" MaxPowerInput="8000" MaxPowerInputChoice="6000;8000;12000" MaxPowerOutput="600" NumStrings="2" Weight="28"/>
|
||||||
<Battery BatteryID="#1 BYD 01" FriendlyName="@BatteryName" BatteryName="01 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="90" MaxCurrent="120" MaxVolt="48">
|
<Battery BatteryID="#1 BYD 01" FriendlyName="@BatteryName" BatteryName="01 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="90" MaxCurrent="120" MaxVolt="48">
|
||||||
<Image DataItem="Image" DataValue="image.png"/>
|
<Images FrontView="image.png" PackageView="package.png" InstalledView="installed.png"/>
|
||||||
<Manual DataItem="Manual" DataValue="manual.docx"/>
|
<Documents Manual="manual.docx" Certificate="certificate.pdf"/>
|
||||||
<Certificate DataItem="Certificate" DataValue="certificate.pdf"/>
|
|
||||||
</Battery>
|
</Battery>
|
||||||
<Battery BatteryID="#2 BYD 02" FriendlyName="@BatteryName" BatteryName="02 BYD T02 Stackable" Manufacturer="BYD" Capacity="9000" Yield="94" MaxCurrent="120" MaxVolt="48"/>
|
<Battery BatteryID="#2 BYD 02" FriendlyName="@BatteryName" BatteryName="02 BYD T02 Stackable" Manufacturer="BYD" Capacity="9000" Yield="94" MaxCurrent="120" MaxVolt="48"/>
|
||||||
<Battery BatteryID="#3 BYD 03" FriendlyName="@BatteryName" BatteryName="03 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="86" MaxCurrent="120" MaxVolt="48"/>
|
<Battery BatteryID="#3 BYD 03" FriendlyName="@BatteryName" BatteryName="03 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="86" MaxCurrent="120" MaxVolt="48"/>
|
||||||
|
@@ -129,7 +129,12 @@
|
|||||||
</MaxCurrent>
|
</MaxCurrent>
|
||||||
<MaxVolt ItemType="ValueType" UnitType="V"/>
|
<MaxVolt ItemType="ValueType" UnitType="V"/>
|
||||||
|
|
||||||
<firz ItemType="PlainType"/>
|
<firz ItemType="PlainType"/>
|
||||||
|
|
||||||
|
<Image DataValue="image.png" ItemType="PlainType"/>
|
||||||
|
<Manual DataValue="manual.docx" ItemType="PlainType"/>
|
||||||
|
<Certificate DataValue="certificate.pdf" ItemType="PlainType"/>
|
||||||
|
|
||||||
|
|
||||||
</ModelSheet>
|
</ModelSheet>
|
||||||
</Section>
|
</Section>
|
||||||
|
Reference in New Issue
Block a user