Skip to content

Commit

Permalink
#214 Add custom delegate for insertGroup().
Browse files Browse the repository at this point in the history
Signed-off-by: cneben <benoit@destrat.io>
  • Loading branch information
cneben committed Nov 17, 2023
1 parent 2f69b48 commit 6ef1f05
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 38 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# CHANGELOG

## 20231116 2.3.0:
## 20231116 2.4.0:
- Rewrite the Qt5/6 CMake configuration.
- Remove all QUICKQANAVA_QT_MAJOR_VERSION and all compilation options, compilation is now always "static".
- Fix bugs in multiple selection dragging.
- Update https://github.com/oysteinmyrmo/bezier to `0.2.1`.
- Add dragging of nodes / groups by keyboard arrow keys.
- Features:
- Add dragging of nodes / groups by keyboard arrow keys.
- Add custom QML group delegate support in `qan::Graph::insertGroup()`.

## 20230406 prev2.3.0:
- Fix a serious bug on multiple selection dragging and snap to grid.
Expand Down
79 changes: 49 additions & 30 deletions samples/advanced/AdvancedGroup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,59 @@ import QtQuick.Layouts 1.3
import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan

Qan.Group {
Qan.GroupItem {
id: advancedGroup
//width: 110; height: 60

anchors.fil: parent
RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.top
anchors.bottomMargin: 4
minimumSize: Qt.size(150., 100.)
width: 200
height: 150

ToolButton {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
icon.source: 'qrc:/collapse-parents.png'
visible: advancedGroup.node && advancedGroup.node.inNodes.length > 0
property bool collapsed: false
checked: collapsed
checkable: true
onClicked: {
advancedGroup.collapseAncestors(collapsed)
collapsed = !collapsed
default property alias children : template
container: template.content // See qan::GroupItem::container property documentation

//! Show or hide group top left label editor (default to visible).
property alias labelEditorVisible : template.labelEditorVisible

//! Show or hide group top left expand button (default to visible).
property alias expandButtonVisible : template.expandButtonVisible

Qan.RectGroupTemplate {
id: template
anchors.fill: parent
groupItem: parent
z: 1

RowLayout {
anchors.bottom: parent.top
anchors.bottomMargin: 2
anchors.right: parent.right
anchors.rightMargin: 4

ToolButton {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
icon.source: 'qrc:/collapse-parents.png'
//visible: advancedGroup.node && advancedGroup.node.inNodes.length > 0
property bool collapsed: false
checked: collapsed
checkable: true
onClicked: {
advancedGroup.collapseAncestors(collapsed)
collapsed = !collapsed
}
}
}
ToolButton {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
icon.source: 'qrc:/collapse-childs.png'
visible: advancedGroup.node && advancedGroup.node.outNodes.length > 0
property bool collapsed: false
checked: collapsed
checkable: true
onClicked: {
advancedGroup.collapseChilds(collapsed)
collapsed = !collapsed
ToolButton {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
icon.source: 'qrc:/collapse-childs.png'
//visible: advancedGroup.node && advancedGroup.node.outNodes.length > 0
property bool collapsed: false
checked: collapsed
checkable: true
onClicked: {
advancedGroup.collapseChilds(collapsed)
collapsed = !collapsed
}
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions samples/advanced/AdvancedNode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ Qan.NodeItem {
id: customNode
width: 110; height: 60

/*Qan.RectGlowEffect {
anchors.fill: parent
style: customNode.style
}*/

RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.top
anchors.bottomMargin: 4
anchors.bottomMargin: 2

ToolButton {
Layout.preferredWidth: 32
Expand Down

0 comments on commit 6ef1f05

Please sign in to comment.