Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-12-09 Thread michael.brasser
On 25/11/2010, at 7:25 AM, ext Charley Bay wrote: > This does raise the next question (or two): > > (1) The QML implies an "instantiation tree" of items in a parent-child > relationship. That's great, and part of what makes QML so easy to use. Is > this tree "special" in any way? For example,

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-27 Thread Charley Bay
Ummm... sorry to add confusion, but it is possible (seems likely to me) that I observed an "order of operations on initialization" problem ... I've re-structured my code, and now *both* the boundingRect() and width/height properties work properly. In the previous implementation, I had "instanti

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-26 Thread Charley Bay
Girish spaketh: > boundingRect() works as I would expect. Can you provide some sample code? > QDeclarativeItem::boundingRect()> > Was your C++ code inside an application-derived QDeclarativeItem::itemChange()? I'm Qt4.7.0, Win7-64bit, MSVC++2008. I tried it again to make sure there was no dif

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-24 Thread Girish Ramakrishnan
Hi, On Thu, Nov 25, 2010 at 2:55 AM, Charley Bay wrote: > I confirmed that these *do not* work for me: > > ...with a "Text { width: 50; height: 20 }" on the QML side, > > QGraphicsItem::boundingRect() // ALWAYS RETURNS QRectF(0,0,-1,-1) > QGraphicsItem::opaqueArea().boundingRect() // ALWAYS RETUR

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-24 Thread Charley Bay
Ok, update, I couldn't wait to try this out (results below): charley spaketh: >> >> > Related question: Now that I'm in the QGraphicsItem world, which is >> *not* a >> > QObject with properties, how does QML expose attributes (since those are >> > *all* properties based)? >> > > Giresh respondeth

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-24 Thread Charley Bay
> > charley spaketh: > > Related question: Now that I'm in the QGraphicsItem world, which is > *not* a > > QObject with properties, how does QML expose attributes (since those are > > *all* properties based)? > Giresh respondeth: > QML works with properties exposed through the metaobject system

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-24 Thread Girish Ramakrishnan
Hi Charley, On Wed, Nov 24, 2010 at 7:42 PM, Charley Bay wrote: > > > Martin spaketh: >> >> QGraphicsItem::itemChange() may do what you want: >> >> >> >> http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#itemChange > > Works great!  Thanks! > > Related question:  Now that I'm in the QGraph

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-24 Thread Charley Bay
Martin spaketh: > QGraphicsItem::itemChange() may do what you want: > > > > http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#itemChange > Works great! Thanks! Related question: Now that I'm in the QGraphicsItem world, which is *not* a QObject with properties, how does QML expose attr

Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-22 Thread martin.jones
Subject: [Qt-qml] C++ MyClass to detect child added/removed from QML I'm sure the answer is simple, but I can't find it: I want my C++ implemented QML object to be notified when children are added: //FILE: MyFile.qml import Qt 4.7 import MyCppClass 1.0 Rectangle { MyCppClas

[Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-22 Thread Charley Bay
I'm sure the answer is simple, but I can't find it: I want my C++ implemented QML object to be notified when children are added: //FILE: MyFile.qml import Qt 4.7 import MyCppClass 1.0 Rectangle { MyCppClass { id: myCppClass Text { text: "some text" } // CHILD NOT DETECTED AS ADDED