[Qt-qml] How get informations from a qml-object ?

Thomas PABST thomas.pabst at gmail.com
Mon Nov 8 16:33:22 CET 2010


Hi,

I recently discover the new QML language. I try to find the better way to
make modular software. I currently trying to find how to get  value of
variables without entering the same value twice in another item, for example
the size of the main screen. I would like to get the value of variables by
calling a method. Using parent object isn't always possible (ie QML
Component Element) and it is very heavy to call the parents' variables when
we have a multi-level tree.

main.qml

> Item {
>   height: 480;
>   width: 800;
>   HomeFrame{
>   }
> }
>

HomeFrame.qml

> HomeFrame{
>   Rectangle{
>     ... some info...
>
   Widget{
>

>
   }
>
  }
> }
>

Widget.qml

> Widget{

  property int width;
>
  width:  //How call the main.qml => item=>width ??
>
}
>

I wonder if it's possible only using QML or if we need to use qt/c++  !

Something like that :

Widget.qml

> Widget{

  property int width;
>
  width:  screen.getwidth();
>
}

Thanks


-----------------------------------------------------
Thomas PABST
thomas.pabst at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101108/8654763c/attachment.html 


More information about the Qt-qml mailing list