View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#131
My application shows a dial with compass bearings (numbers) and tickmarks (asterisks).

I cannot use QML CircularGauge for my purpose because 'Controls.Styles' is not available in SFOS.

Currently, I am using this method for placing my text/numbers in a circular fashion;

Code:
    Rectangle {
            color: "#00000000"; width: 520; height: 520; radius: 260; anchors.centerIn: parent
            Repeater {
                id: tickmarks
                model: {
                    [
                     ' ', '*', '*', ' ', '*', '*', ' ', '*', '*', ' ', '*', '*',
                     ' ', '*', '*', ' ', '*', '*', ' ', '*', '*', ' ', '*', '*',
                     ' ', '*', '*', ' ', '*', '*', ' ', '*', '*', ' ', '*', '*'
                    ]
                }
                delegate: Rectangle {
                    height: 260
                    anchors.horizontalCenter: parent.horizontalCenter
                    transformOrigin: Rectangle.Bottom
                    rotation: 360 / tickmarks.model.length * index
                    Text {
                        text: modelData
                        color: Theme.secondaryHighlightColor
                        font {
                            bold: Font.Bold
                            pixelSize: 28
                        }
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                }
            }
        }
The above code is messy and clunky, among other things. How can I refine this code or is there a better way to achieve what is shown in the image?

thanks,
Attached Images
 
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post: