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

Qt-interest Archive, December 2007
Qt 4.3.3 still causes immediate app exit for stay-on-top flag


Message 1 in thread

Windows XP, Qt 4.3.3

Qt::WindowFlags flags = this->windowFlags();

flags |= Qt::WindowStaysOnTopHint;

this->setWindowFlags(flags);     // App exits.






--
 [ signature omitted ] 

Message 2 in thread

On Dec 13, 2007 8:00 PM, John Smith <invalid@xxxxxxxxxxx> wrote:
> Windows XP, Qt 4.3.3
> Qt::WindowFlags flags = this->windowFlags();
> flags |= Qt::WindowStaysOnTopHint;
> this->setWindowFlags(flags);     // App exits.

I remember having the same problem. IIRC, the app does not quit, it
hides instead. So you need to call show().
The following code works for me:

  if( settings->stayAlwaysOnTop )
    setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint );
  else
    setWindowFlags( windowFlags() & (~ Qt::WindowStaysOnTopHint) );
  show();

--
 [ signature omitted ] 

Message 3 in thread

"Helder Correia" <helder.pereira.correia@xxxxxxxxx> wrote in message 
news:ca1ea3780712131116o341dd5cei66f577d4fce91a1@xxxxxxxxxxxxxxxxx
> On Dec 13, 2007 8:00 PM, John Smith <invalid@xxxxxxxxxxx> wrote:
>> Windows XP, Qt 4.3.3
>> Qt::WindowFlags flags = this->windowFlags();
>> flags |= Qt::WindowStaysOnTopHint;
>> this->setWindowFlags(flags);     // App exits.
>
> I remember having the same problem. IIRC, the app does not quit, it
> hides instead. So you need to call show().
> The following code works for me:
>
>  if( settings->stayAlwaysOnTop )
>    setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint );
>  else
>    setWindowFlags( windowFlags() & (~ Qt::WindowStaysOnTopHint) );
>  show();
>

Qt::WindowFlags flags = this->windowFlags();
flags |= Qt::WindowStaysOnTopHint;
this->setWindowFlags(flags);
show();  // App immediately exits. 


--
 [ signature omitted ]