Skip to content

Commit

Permalink
using from repeater for circular cut components
Browse files Browse the repository at this point in the history
  • Loading branch information
abbasyazdanmehr committed Nov 12, 2023
1 parent b9b40f6 commit 8c31270
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
39 changes: 16 additions & 23 deletions CircularMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,27 @@ Item {
// properties
property double outerRadius: 400
property double innerRadius: 300
property double startAngle: 180

property ListModel listModel: ListModel{}

anchors.fill: parent

CircularCut {
cutText: 'red'
cutOuterRadius: outerRadius
cutInnerRadius: innerRadius
cutStartAngle: 90
cutLen: 90
}

CircularCut {
cutText: 'purple'
cutOuterRadius: outerRadius
cutInnerRadius: innerRadius
cutStartAngle: 0
cutLen: 45
cutColor: 'purple'
}
Repeater {
anchors.fill: parent
model: listModel.count

CircularCut {
cutText: 'blue'
cutOuterRadius: outerRadius
cutInnerRadius: innerRadius
cutStartAngle: 180
cutLen: 90
cutColor: 'blue'
CircularCut {
required property var model

cutText: listModel.get(model.index).name
cutOuterRadius: outerRadius
cutInnerRadius: innerRadius
cutStartAngle: startAngle + model.index * 45
cutLen: 45
cutColor: listModel.get(model.index).color
}
}

RowLayout {
Expand Down Expand Up @@ -67,7 +60,7 @@ Item {
Layout.fillHeight: true

onClicked: {
listModel.append({name: nameField.text, iconSource: 'hand.png'})
listModel.append({name: nameField.text, color: 'purple'})
}
}

Expand Down
4 changes: 2 additions & 2 deletions Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Window {
listModel: ListModel {
ListElement {
name: "Abbas"
icon: "hand.png"
color: 'blue'
}
ListElement {
name: "Akbar"
icon: "hand.png"
color: 'red'
}
}
}
Expand Down

0 comments on commit 8c31270

Please sign in to comment.