Reply
Thread Tools
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:
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#132
found this https://github.com/RSATom/Qt/blob/ma...GaugeStyle.qml
i think its easy to copy and implement as standalone item
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#133
Originally Posted by coderus View Post
found this https://github.com/RSATom/Qt/blob/ma...GaugeStyle.qml
i think its easy to copy and implement as standalone item
But that shows Controls.Styles as an import statement. I had already tried stripping down CircularGauge QML, but Controls.Styles is required.

/* I'll play anyway, its a huge file for what it does, amazing.*/
EDIT, I decided against playing with this file, it requires 4 import modules that are not available in SFOS.

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

Last edited by Markkyboy; 2020-09-08 at 13:53.
 

The Following User Says Thank You to Markkyboy For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#134
Grab minimal code, then go to styles if you really need it. For bare minimal code inside CircularGaugeStyle is enough to be copied to standalone item
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#135
Originally Posted by coderus View Post
Grab minimal code, then go to styles if you really need it. For bare minimal code inside CircularGaugeStyle is enough to be copied to standalone item
Okay, but I'm sure 'Styles' is also not available in SFOS. I have tried many import statements that are not available. I've looked through '/usr/lib/qt5/qml' on my device and didn't see 'controls' or 'styles'......?
__________________
..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:
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#136
you can't just copy and paste, you have to code the code! you can take idea from existing qtquick item and adapt to your project.
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Maemish's Avatar
Posts: 1,702 | Thanked: 4,752 times | Joined on Apr 2018 @ Helsinki, Finland.
#137
Is this anyway related even though there is no ready answer?

https://talk.maemo.org/showthread.php?t=96839
__________________
"I don't know how but I can try!" (active)

Master of not knowing (active)

For me it is possible to get lost in any case (active)

Learning to fall from high (DONE)

Learning to code with BASIC (WIP)
 

The Following User Says Thank You to Maemish For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#138
Originally Posted by Maemish View Post
Is this anyway related even though there is no ready answer?

https://talk.maemo.org/showthread.php?t=96839
dont miss %install step to actually copy files-to-be-packaged to %{buildroot}, then %files section can package it. files outside %{buildroot} can't be packaged.
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Maemish's Avatar
Posts: 1,702 | Thanked: 4,752 times | Joined on Apr 2018 @ Helsinki, Finland.
#139
Would rinigus know answer to this? It seems he has done some stuff which may include something related.
__________________
"I don't know how but I can try!" (active)

Master of not knowing (active)

For me it is possible to get lost in any case (active)

Learning to fall from high (DONE)

Learning to code with BASIC (WIP)

Last edited by Maemish; 2020-09-08 at 19:41.
 

The Following User Says Thank You to Maemish For This Useful Post:
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#140
Originally Posted by coderus View Post
i dont know a way to do this in pure qml without c++ code
So, the question was:
- There is a page with a ListView, with a model from database contents
- Tapping on an item opens a new Dialog, where the database item could change
- popping the dialog leaves an old listview that needs refreshing

Now, I found your GitHub page on callbacks: https://gist.github.com/CODeRUS/5235...bfaf0bafbeb7cd

Could I push the dialog with a callback to a function that would update the listview? Or is that not what the callback is for? Something like:
pageStack.push(Qt.resolvedUrl("DialogPage.qml"), {callback: updateListViewAfterDialog })

Update: yes, this seems to work!
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it

Last edited by rob_kouw; 2020-09-09 at 20:59.
 

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


 
Forum Jump


All times are GMT. The time now is 23:16.