I add a property cond in Row element,so when cond is true, it will draw 3 picture,otherwise only one will be drawed
but qml report “Unexpected token `if'” ,any ideas? Thanks
import QtQuick 1.1
Rectangle{
id:rect
property bool cond:true;
Row{
Image{ source:"good.png" }
if(cond) {
Image{ source:"good.png" }
Image{ source:"good.png" }
}
}
}
Your code is syntactically wrong: QML structure description statements cannot be wrapped in javascript code.
But the solution is simple:
Alternatively you can create the image elements dynamically, but this is more complex.