Skip to content

Commit

Permalink
WIP. Add src/dst shape configuration in curved.qml test.
Browse files Browse the repository at this point in the history
TODO: Add full binding from EdgeStyle to EdgeItem for both shapeLength
and srcShape/dstShape...
#65

Signed-off-by: cneben <[email protected]>
  • Loading branch information
cneben committed Sep 18, 2018
1 parent 4cf8b9c commit ee6529e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
27 changes: 27 additions & 0 deletions samples/edges/curved.qml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,33 @@ Item {
}
}
} // RowLayout: edgeType
RowLayout {
Layout.margins: 2
Label { text:"Src Shape:" }
Item { Layout.fillWidth: true }
ComboBox {
model: ["None", "Arrow", "Open Arrow", "Rect", "Open Rect", "Circle", "Open Circle"]
currentIndex: defaultEdgeStyle.lineType === Qan.EdgeStyle.Straight ? 0 : 1
onActivated: {
var shape = [Qan.EdgeItem.None, Qan.EdgeItem.Arrow, Qan.EdgeItem.ArrowOpen, Qan.EdgeItem.Circle, Qan.EdgeItem.CircleOpen, Qan.EdgeItem.Rect, Qan.EdgeItem.RectOpen]
console.warn("shape=" + shape[index])
defaultEdgeStyle.srcShape = shape[index]
}
}
} // RowLayout: srcShape
RowLayout {
Layout.margins: 2
Label { text:"Dst shape:" }
Item { Layout.fillWidth: true }
ComboBox {
model: ["None", "Arrow", "Open Arrow", "Rect", "Open Rect", "Circle", "Open Circle"]
currentIndex: 1
onActivated: {
var shape = [Qan.EdgeItem.None, Qan.EdgeItem.Arrow, Qan.EdgeItem.ArrowOpen, Qan.EdgeItem.Circle, Qan.EdgeItem.CircleOpen, Qan.EdgeItem.Rect, Qan.EdgeItem.RectOpen]
defaultEdgeStyle.dstShape = shape[index]
}
}
} // RowLayout: dstShape
RowLayout {
Layout.margins: 2
Label { text:"Line color:" }
Expand Down
12 changes: 6 additions & 6 deletions src/EdgeTemplate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.ArrowOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.ArrowOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: edgeItem.dstA1.x; startY: edgeItem.dstA1.y
PathLine { x: edgeItem.dstA3.x; y: edgeItem.dstA3.y }
Expand All @@ -70,7 +70,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.CircleOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.CircleOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: 0; startY: 0
PathArc {
Expand All @@ -92,7 +92,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.RectOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.dstShape === Qan.EdgeItem.RectOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: edgeItem.dstA1.x; startY: edgeItem.dstA1.y
PathLine { x: 0.; y: 0. }
Expand All @@ -110,7 +110,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.ArrowOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.ArrowOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: edgeItem.srcA1.x; startY: edgeItem.srcA1.y
PathLine { x: edgeItem.srcA3.x; y: edgeItem.srcA3.y }
Expand All @@ -127,7 +127,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.CircleOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.CircleOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: 0; startY: 0
PathArc {
Expand All @@ -149,7 +149,7 @@ Item {
&& edgeItem.visible && !edgeItem.hidden
ShapePath {
strokeColor: edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.RectOpen ? "transparent" : edgeTemplate.color
fillColor: edgeItem.srcShape === Qan.EdgeItem.RectOpen ? Qt.rgba(0.,0.,0.,0.) : edgeTemplate.color
strokeWidth: 2
startX: edgeItem.srcA1.x; startY: edgeItem.srcA1.y
PathLine { x: 0.; y: 0. }
Expand Down
2 changes: 2 additions & 0 deletions src/qanEdgeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ auto EdgeItem::setSrcShape(ArrowShape srcShape) noexcept -> void
if ( _srcShape != srcShape ) {
_srcShape = srcShape;
emit srcShapeChanged();
updateItem();
}
}

Expand All @@ -201,6 +202,7 @@ auto EdgeItem::setDstShape(ArrowShape dstShape) noexcept -> void
if ( _dstShape != dstShape ) {
_dstShape = dstShape;
emit dstShapeChanged();
updateItem();
}
}

Expand Down

0 comments on commit ee6529e

Please sign in to comment.