1
Popey {
working: visible ? 100
}

What does that "?" indicate in this example?

1 Answer 1

2

The snippet of code in your question does not work for me. I wrote a minimal example:

import QtQuick 2.0
import Ubuntu.Components 0.1

MainView {
    width: units.gu(48)
    height: units.gu(60)
    id: mainView

    Rectangle {
        height: visible ? 20;
        width: 20;
    }

}  

And qmlscene reports the following error:

qmlscene ./foo.qml 
file:///home/sylvain/foo.qml:10 Expected token `:'

The correct syntax for the javascript ternary operator is as follow:

height: visible ? 20 : 10;
4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .