[Interest] how QQmlProperty works ?

Nikita Krupenko krnekit at gmail.com
Wed Mar 2 10:20:56 CET 2016


2. Why are you write string values? It's not "Image.Stretch", it's an
enum value of QQuickImage.
3. Remove the .ui suffix, like "MainForm.qml".
4. QML id is not the same as objectName. If you use
QObject::findChild(), you should set objectName.

Also, creating two QQmlEngine's for different QML files looks weird...

2016-03-02 5:50 GMT+02:00 Nicolas Jäger <jagernicolas at legtux.org>:
> Hi,
>
> I dont understand how QQmlProperty works, consider this example :
>
> main.cpp : http://pastebin.com/B17uY2Av [1]
>
> MainForm.ui.qml : http://pastebin.com/N3JKnU2h [2]
>
> output :
>
> Property value: QVariant(int, 3)
> Property value: QVariant(int, 3)
> Property value: QVariant(double, 10)
> Property value: QVariant(double, 500)
>
> first, in the window the image isn't resized, it still has 10px.
>
> second, how can set and display with qDebug values like :
>
> fillMode: Image.Tile
>
> third, when using qcreator everytime I clicked on MainForm.ui.qml I got
> the window of design opened, if I click on edit there is a message that
> this file should only be edited trough the designer, ok but to be able
> to use findchild I have to set objectName. I haven't found how to do
> that in the designer. Personnaly I don't like to have the designer
> opened by default, I would like to get the edit mode opened by default.
>
> four, instead of using objectName, could we use id ?
>
> Regards,
>
> Nicolas
>
>
> Links:
> ------
> [1] http://pastebin.com/B17uY2Av
> [2] http://pastebin.com/N3JKnU2h
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list