On Jul 13, 2010, at 18:29, Alhola Kate (Nokia-CD/Helsinki) wrote:

On Jul 13, 2010, at 6:33 PM, Menard Alexis (Nokia-MS-Qt/Oslo) wrote:


On Jul 13, 2010, at 17:09, ext 
[email protected]<mailto:[email protected]> wrote:


I have tried to make small example that adds QGraphicsWidget based Graphical 
widget to Qml.
Basically code is very similar than "musician" example but my widget also 
implements paint() function.

I have put qDebug in my code and constructor and set property ( setName() ) get 
called but paint()
won't get called at all.

I tried to find some example of graphic QGraphicsWidget but least i did not 
find any with google.

Option 1 : examples/declarative/cppextensions in the Qt source tree.

grep -ir paint .     in examples/declarative/ does not find any example 
implementing paint()

Well yes...In the base class otherwise you won't see anything on the screen, so 
paint() is called because the widget embedded in the
proxy is displayed.


I am implementing both paint() and boundingRect() as normal QGraphicsView code.

I also find dojo flipmo but it is also using proxywidget and not painting 
itself.

Is there some extra property that need to be set compared traditional c++  
QGraphicsView items
to get it displayed in Qml ? I tested that if I just add my widget to normal 
QGraphicsScene, it
gets displayed and both paint() and boundingRect() get called.


Kate


Option 2 : Plasma-mobile on KDE. 
websvn.kde.org/trunk/playground/base/plasma/shell/plasma-mobile<http://websvn.kde.org/trunk/playground/base/plasma/shell/plasma-mobile>



Qml fragment creating widget is
¨Rectangle {

        x:200

It seems to be the problem. So the children never get painted and boudingRect 
is never called.


        y:20

        border.width:1

        border.color:"black"

        width: 60; height: 100

      GaugeBand {

        anchors.fill: parent

        name: "MiuMau"

        }

    }


The bounding rectangle gets painted with white color inside but painter of my 
Widget gets never called.


Kate
<ATT00001..txt>



_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to