Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, March 2007
how to change the order of childwidget drawing in a parent?


Message 1 in thread

hello,

i am writing a little application where one can customize a ui. one 
feature is to drag buttons arround in the parent widget. at the moment i 
do the button selection and translation by hand in void 
mouseMoveEvent(QMouseEvent*) and void mousePressEvent(QMouseEvent *) in 
a subclass of QPushButton. basically i remember the old button position 
and when one selects a button with a click and moves the mouse i 
calculate the difference between the new and the previous mouse position 
and move the button accordingly.

my problem is now that when i move a button near another button so they 
both overlap the one that was created earlier than the other button gets 
covered by the "newer" one. but i want the button i am currently moving 
to be on top of all the other ones.

so question one: is the way i move my childwidgets in the window ok or 
is there any cleaner way to implement it? maybe direct drag and drop 
support?

question two: how can i "move up" the selected button so its drawn in 
front of all teh others?

best regards
johannes

--
 [ signature omitted ] 

Message 2 in thread

indeed! thanks a lot :)

best regards
johannes

Tom Panning schrieb:
> On 3/26/07, *Johannes Diemke* 
> <johannes.diemke@xxxxxxxxxxxxxxxxxxxxxxxxxxx 
> <mailto:johannes.diemke@xxxxxxxxxxxxxxxxxxxxxxxxxxx>> wrote:
> <snip>
>
>     question two: how can i "move up" the selected button so its drawn in
>     front of all teh others? 
>
>
> I believe QWidget::raise() is what you're looking for:
>  http://doc.trolltech.com/4.2/qwidget.html#raise
>
> Tom
>
>

--
 [ signature omitted ]