Those eample were pure Qml, not C++. For the auto size, you are on the right track with the childrenRect.
I just don't get your example. but just alias to your Rectangle childrens or data. If you use a delegate (this is normally used for Component property that will be instantiate). if you want dynamic instance, property Component delegate Then you will need something like Loader, Repeater, ObjectLoader to create instance of the Component. On Mon, 1 Oct 2018 at 09:58, Jason H <jh...@gmx.com> wrote: > Hm... All that involves C++. I mean to do it all in QML. > > Let me give a better example > > //MyAutoSizeRectangle.qml > Rectangle { > width: childrenRect.width > height: childrenRect.height > radius: Math.min(width, height) / 2 > } > > // main.qml > MyAutoSizeRectangle { > color:"red" > Text { > text: "Danger Will Robinson!" > color: "white" > } > } > > or alteratively: > // main.qml > MyAutoSizeRectangle { > color:"red" > delgate: Text { > text: "Danger Will Robinson!" > color: "white" > } > } > > In this example, I want the MyAutoSizeRectangle instance to apply > whatever. I am thinking something maybe like a visual item model of size 1? > But then I have to deal with the view management. > > > > > *Sent:* Friday, September 28, 2018 at 2:21 PM > *From:* "Jérôme Godbout" <godbo...@amotus.ca> > *To:* furkanuzu...@gmail.com > *Cc:* "Qt Interest" <interest@qt-project.org>, "Jason H" <jh...@gmx.com> > *Subject:* Re: [Interest] QML: Wrapping an item from outside > Like Furkan said, use the default property alias to chidlren: > > MyUI > { > default property alias childs: container_.childrens // you can also > target .data to have non Item objects > > PrettyContainer { id: container_ } > } > > On Fri, 28 Sep 2018 at 13:31, Furkan Üzümcü <furkanuzu...@gmail.com> > wrote: > >> I think you are looking for the `default` property. >> >> Check out this guide for more information: >> *https://doc.qt.io/qt-5/qtqml-referenceexamples-default-example.html* >> <https://doc.qt.io/qt-5/qtqml-referenceexamples-default-example.html> >> >> Regards, >> Furkan Üzümcü >> On Sep 28, 2018, 13:27 -0400, Jason H <jh...@gmx.com>, wrote: >> >> I have PrettyContainer.qml >> >> I have an item (Item) I want to put into (on top of) PrettyContainer. My >> PrettyContainer visually wraps the pretty item, like parent of a child >> widget >> >> MyUI{ >> >> PrettyContainer { >> >> Item { >> // completely custom 1 >> } >> } >> PrettyContainer { >> >> Item { >> // completely custom 2 >> } >> } >> } >> >> >> How can I get My PrettyContainer to take the item as like, say, a >> contentItem? I thought I did this before, but I can't figure out how I did >> it, and googling s not returning anything relevant. >> >> Thanks! >> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > > > > -- > > > > > RAPPROCHEZ LA DISTANCE > > *Jérôme Godbout* > Senior Software Developer > > *p:* +1 (418) 800-1073 ext.:109 > > *m:* +1 (581) 777-0050 > > amotus.ca <http://www.amotus-solutions.com/> > statum-iot.com > > > -- RAPPROCHEZ LA DISTANCE *Jérôme Godbout*Senior Software Developer *p:* +1 (418) 800-1073 ext.:109 *m:* +1 (581) 777-0050 amotus.ca <http://www.amotus-solutions.com/> statum-iot.com
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest