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

Qt-interest Archive, March 2002
Making a widget staysOnTop on-the-fly ?


Message 1 in thread

Hello,

I am trying to get StaysOnTop tear-off menus. After some discussion with
TT support and a couple of more-or-less weird hacks, I can now get a
pointer on the QPopupMenu created when the tear-off handle in a menu is
clicked.

With a _really_ ugly hack, I manage to call setWFlags on this widget to
set WStyle_Customize and WStyle_StaysOnTop, but the popup menu still does
not stay on top. Am I missing something else ?

-- 
 [ signature omitted ] 

Message 2 in thread

Am Thursday 28 March 2002 17:46 schrieb Matthieu Dazy:
> Hello,
>
> I am trying to get StaysOnTop tear-off menus. After some discussion with
> TT support and a couple of more-or-less weird hacks, I can now get a
> pointer on the QPopupMenu created when the tear-off handle in a menu is
> clicked.
>
> With a _really_ ugly hack,
Something along the lines of #define protected public? :-)

> I manage to call setWFlags on this widget to
> set WStyle_Customize and WStyle_StaysOnTop, but the popup menu still does
> not stay on top. Am I missing something else ?
Did you try to call reparent() instead of setWFlags() ? It's public and 
changing flags like WStyle_StaysOnTop works only when reparenting AFAIK - no 
need to actually change the parent, just call this method.

-- 
 [ signature omitted ] 

Message 3 in thread

On Thu, 28 Mar 2002 20:20:39 +0100
Malte Starostik <malte@kde.org> wrote:

> > With a _really_ ugly hack,
> 
> Something along the lines of #define protected public? :-)

Nooo, much, much worse than that : subclassing QWidget to add two public
calls encapsulating setWFlags and getWFlags and then static-casting my
widget to that... Ahem :)


> > I manage to call setWFlags on this widget to
> > set WStyle_Customize and WStyle_StaysOnTop, but the popup menu still
> > does not stay on top. Am I missing something else ?
> 
> Did you try to call reparent() instead of setWFlags() ? It's public and 
> changing flags like WStyle_StaysOnTop works only when reparenting AFAIK
> - no need to actually change the parent, just call this method.

OK, this is what I was missing. I also eventually used WStyle_Dialog
instead of StaysOnTop.

Thanks.

-- 
 [ signature omitted ] 

Message 4 in thread

I had a similar problem trying to set WFlags not to erase widget before
painting ( to reduce flick ).

I did that using reparent:

MyQLabel.reparent( MyQLabel.parentWidget, NewWFlags, MyQLabel.pos(), false);



----- Original Message -----
From: "Matthieu Dazy" <dazy@t-surf.com>
To: "Malte Starostik" <malte@kde.org>
Cc: <qt-interest@trolltech.com>
Sent: Friday, March 29, 2002 7:08 AM
Subject: Re: Making a widget staysOnTop on-the-fly ?


> On Thu, 28 Mar 2002 20:20:39 +0100
> Malte Starostik <malte@kde.org> wrote:
>
> > > With a _really_ ugly hack,
> >
> > Something along the lines of #define protected public? :-)
>
> Nooo, much, much worse than that : subclassing QWidget to add two public
> calls encapsulating setWFlags and getWFlags and then static-casting my
> widget to that... Ahem :)
>
>
> > > I manage to call setWFlags on this widget to
> > > set WStyle_Customize and WStyle_StaysOnTop, but the popup menu still
> > > does not stay on top. Am I missing something else ?
> >
> > Did you try to call reparent() instead of setWFlags() ? It's public and
> > changing flags like WStyle_StaysOnTop works only when reparenting AFAIK
> > - no need to actually change the parent, just call this method.
>
> OK, this is what I was missing. I also eventually used WStyle_Dialog
> instead of StaysOnTop.
>
> Thanks.
>
> --
> Matthieu Dazy (dazy@t-surf.com) -- tel. +33 (0)3 83 67 66 19
> T-Surf S.A., Nancy              -- http://www.t-surf.com
>
> --
> List archive and information: http://lists.trolltech.com/qt-interest/
>