PDA

View Full Version : Draw on top of other Widgets



BlackFoXX
12th July 2009, 19:24
Hi,
i want to draw a line on top of another widget, but it's drawn below.
Is it possible to draw over an other widget?
Thanks in advance,

Jones

wysota
12th July 2009, 19:32
See Widget Overlay.

BlackFoXX
12th July 2009, 21:32
Great. It does exactly, what i want.
Thanks allot.

IRON_MAN
22nd July 2010, 11:39
i think that i have the same problem!
two widgets, one inside another one, and i want to draw a line in the widget that is inside the big one.

QPen pen(Qt::yellow,2,Qt::SolidLine);
QPainter painter(ui.the_widget_that_is_inside);
painter.setPen(pen);
painter.drawLine(200,300,400,150);



this code it doesn't work! anybody can help me,please?

thanks in advance!

aamer4yu
22nd July 2010, 11:57
QPainter painter(ui.the_widget_that_is_inside);
You cannot paint like that !!
You will need to subclass ui.the_widget_that_is_inside and do the painting in paintEvent() function.

IRON_MAN
23rd July 2010, 11:43
what do you mean when you say to subclass?

i have edit inside the main widget a simple class(without .ui) and it doesn't work!

i think that i didn't understand you!