[Interest] Why wrap Rectangle/Image with Item

Sadika Sumanapala sadikahs at gmail.com
Sun Jan 18 14:21:24 CET 2015


Thank you very much for resolving my problem.


On Sun, Jan 18, 2015 at 5:41 PM, Sean Harmer <sean.harmer at kdab.com> wrote:

> On Sunday 18 January 2015 13:22:28 Sadika Sumanapala wrote:
> > Hi,
> >
> > What is the advantage of wrapping Rectangle/Image QML types with Item
> type.
> > I came across several wrapping when following  QML Advanced Tutorial (
> > http://doc.qt.io/qt-5/qtquick-tutorials-samegame-samegame1-example.html)
> >
> > For example:
> >
> > Item {
> >     id: block
> >     Image {
> >         id: img
> >         anchors.fill: parent
> >         source: "../shared/pics/redStone.png"
> >     }
> > }
> >
>
> In that case, one advantage is that it stops users of your custom QML
> element
> from changing properties that are internal. The source property, for
> example,
> in this case makes little sense to expose to the outside world.
>
> Cheers,
>
> Sean
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> Klarälvdalens Datakonsult AB, a KDAB Group company
> Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
> KDAB - Qt Experts - Platform-independent software solutions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150118/3d00de33/attachment.html>


More information about the Interest mailing list