View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#1
Hi,

I have a Page, on that page is a rectangle, I can click on the rectangle and it changes colour, I'd like the last colour picked to remain when I reopen the app again. I thought I could do this with settings, but it doesn't work.

It seems as soon as I introduce 'settings' into the code that the app doesn't open. I thought maybe to include 'import com.jolla.settings 1.0' but that doesn't help either, what am I doing wrong?

Code:
    import com.jolla.settings 1.0

        Rectangle {
            id: rect
            anchors.fill: parent
            color: '#000000'
            Settings { //hash this out and the code works but won't save last color created.
                id: settings
                property alias color: rect.color
            }
            MouseArea {
                anchors.fill: parent
                onClicked: rect.color = Qt.hsla(Math.random(), 0.5, 0.5, 1.0);
            }
        }
    }
Thanks,
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 5 Users Say Thank You to Markkyboy For This Useful Post: