This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] PopupApplet and paint in the graphicsWidget

Tags: None
(comma "," separated)
User avatar
darkman
Registered Member
Posts
13
Karma
0
OS
Hello everyone.

I implemented a class (let's call Test) that extends PopupApplet.
I also implemented the method QGraphicsWidget *graphicsWidget () witch returs an object (let's call Test2) that extends QGraphicsWidget.

The program compiles correctly but my question is: how can i paint something in my Test2 (so, in the popup menù)?

i've re-implemented this method in Test2:
void paintWindowFrame ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget );

with a stupid instruction like

painter->drawText(10, 10, "Hello america");

As explained in the QT api, i expect to see something written in my widget but, instead, I see absolutely nothing in the popup menu. have i forgot something?

Last edited by darkman on Sun Feb 15, 2009 5:50 pm, edited 1 time in total.


My belly is full of theory but when I play I forget it all - Al di Meola
--------------
darkman, proud to be a member of KDE forums since 2008-Nov.
User avatar
darkman
Registered Member
Posts
13
Karma
0
OS
Ok, i've solved my problem.
I've understand that i don't need to implement the paintWindowFrame but i've to work with layouts.
Everything must be insterted in a layout and, then, the widget must set this layout as default. (method setLayout() )

I understood it while searching in the source code of some standard plasma application.
Why is not written in the tutorial or in the api documentation?
http://api.kde.org/4.x-api/kdelibs-apid ... pplet.html

this information may be helpful to many developers like me who have never had to deal with kdelibs

now i have another question.. but i'm going to open a new thread :thumbs_up: :-D


My belly is full of theory but when I play I forget it all - Al di Meola
--------------
darkman, proud to be a member of KDE forums since 2008-Nov.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell