QML - property url question
-
wrote on 5 Oct 2011, 22:59 last edited by
I'm playing around with QML, below is a simple component
@
Rectangle {
id: rectangle1
property string imageOn: "some filepath"
property string imageOff: "some filepath"
property string textMessage: "Submit"BorderImage { id: border_image1 visible: !mouse_area1.pressed anchors.fill: parent source: parent.imageOn } BorderImage { id: border_image2 anchors.fill: parent visible: mouse_area1.pressed source: parent.imageOff }
}
@Using QT Creator, If I drag this component and put it on another QML file in designer view the designer will show all the properties fine. I'd like the imageOn and imageOff properties to be set in the Designer by having the user choose a file, not by typing in a long file path. Is there anyway to do this?
Thanks
[EDIT: code formatting, please wrap in @-tags, Volker]
-
wrote on 6 Oct 2011, 05:57 last edited by
Try with
@
property url imageOn: "some filepath"
@Also as this is a separate component I think it's better to use
@
property alias imageOn: border_image1.source
@ -
wrote on 6 Oct 2011, 16:01 last edited by
Thanks for the reply, but in the designer I was still forced to enter a string using both methods.
I was hoping it would show a file dialog. -
wrote on 7 Oct 2011, 00:17 last edited by
When I set a property in a qml file like property url image: "some filepath" when I go in the designer it doesn't create a file dialog for the property. How can I set a property for a component that asks the user to choose from a file via the file dialog?
Maybe this is not possible yet, but the image component and the border image component has the user choose a file through a dialog box for the source.
-
wrote on 7 Oct 2011, 00:38 last edited by
Merged this topics because they are about the same question.
Please don't double post, but add your procedings or extra questions in the same post. -
wrote on 7 Oct 2011, 05:05 last edited by
Eddy you are a good moderator, but you have no answers for my question. :-)
-
wrote on 7 Oct 2011, 20:15 last edited by
I don't believe this is supported in the designer yet for user-defined components, as far as I know. You can always add a feature request for it.
2/7