Delete icon, visibility checkbox for type!

This commit is contained in:
Adsooi 2020-12-24 16:32:01 +01:00
parent 0dec00c87b
commit c6f79ac0c5
2 changed files with 136 additions and 8 deletions

View file

@ -37,30 +37,54 @@ ListView {
delegate: ListView { delegate: ListView {
id: objTypeList id: objTypeList
property string objType: objectListList.model[index] property string objType: objectListList.model[index]
property var editingRows: []
model: Objects.currentObjects[objType] model: Objects.currentObjects[objType]
width: objectListList.width width: objectListList.width
implicitHeight: contentItem.childrenRect.height implicitHeight: contentItem.childrenRect.height
visible: model != undefined && model.length > 0 visible: model != undefined && model.length > 0
interactive: false
Component.onCompleted: objectListList.listViews[objType] = objTypeList // Listing in order to be refreshed Component.onCompleted: objectListList.listViews[objType] = objTypeList // Listing in order to be refreshed
header: Text { header: Row {
width: typeHeaderText.width + typeVisibilityCheckBox.visible
height: visible ? 20 : 0
visible: objTypeList.visible
CheckBox {
id: typeVisibilityCheckBox
checked: Objects.currentObjects[objType] != undefined ? Objects.currentObjects[objType].every(obj => obj.visible) : true
onClicked: {
console.log(Objects.currentObjects[objType].every(obj => obj.visible))
Objects.currentObjects[objType].forEach(obj => obj.visible = this.checked)
objTypeList.editingRows.forEach(obj => obj.objVisible = this.checked)
objectListList.changed()
}
ToolTip.visible: hovered
ToolTip.text: checked ? `Hide all ${Objects.types[objType].typeMultiple()}` : `Show all ${Objects.types[objType].typeMultiple()}`
}
Text {
id: typeHeaderText
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
color: sysPalette.windowText color: sysPalette.windowText
text: Objects.types[objType].typeMultiple() + ":" text: Objects.types[objType].typeMultiple() + ":"
font.pixelSize: 20 font.pixelSize: 20
visible: objTypeList.visible }
height: visible ? 20 : 0
} }
delegate: Item { delegate: Item {
id: controlRow id: controlRow
property var obj: Objects.currentObjects[objType][index] property var obj: Objects.currentObjects[objType][index]
property alias objVisible: objVisibilityCheckBox.checked
height: 40 height: 40
width: objTypeList.width width: objTypeList.width
Component.onCompleted: objTypeList.editingRows.push(controlRow)
CheckBox { CheckBox {
id: visibilityCheckBox id: objVisibilityCheckBox
checked: Objects.currentObjects[objType][index].visible checked: Objects.currentObjects[objType][index].visible
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
@ -75,7 +99,7 @@ ListView {
Text { Text {
id: objDescription id: objDescription
anchors.left: visibilityCheckBox.right anchors.left: objVisibilityCheckBox.right
anchors.right: deleteButton.left anchors.right: deleteButton.left
height: parent.height height: parent.height
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter

104
qml/icons/delete.svg Normal file
View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24.0px"
height="24.0px"
viewBox="0 0 24.0 24.0"
version="1.1"
id="SVGRoot"
sodipodi:docname="delete.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs10" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.4"
inkscape:cx="34.185532"
inkscape:cy="11.508793"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true">
<inkscape:grid
type="xygrid"
id="grid19" />
</sodipodi:namedview>
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#000000;stroke:none;stroke-width:1.55662"
id="rect26"
width="1"
height="14"
x="5"
y="8" />
<rect
style="fill:#000000;stroke:none;stroke-width:2.73862"
id="rect869"
width="20"
height="1"
x="2"
y="-7"
transform="scale(1,-1)" />
<rect
style="fill:#000000;stroke:none;stroke-width:0.474342"
id="rect871"
width="1"
height="2"
x="8"
y="3" />
<rect
style="fill:#000000;stroke:none;stroke-width:1.34164"
id="rect873"
width="8"
height="1"
x="8"
y="2" />
<rect
style="fill:#000000;stroke:none;stroke-width:0.500005"
id="rect875"
width="1"
height="2"
x="15"
y="3" />
<rect
style="fill:#000000;stroke:none;stroke-width:1.55662"
id="rect26-3"
width="1"
height="14"
x="18"
y="8" />
<rect
style="fill:#000000;stroke:none;stroke-width:0.981983"
id="rect894"
width="12"
height="1"
x="6"
y="21" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB