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

Qt-jambi-interest Archive, July 2007
passing WindowsFlags to QWidget constructor


Message 1 in thread

First, thanks to Trolltech for an amazing product.

Why doesn't the following line work in the widget constructor?
      super(parent, new Qt.WindowFlags(Qt.WindowType.FramelessWindowHint |  
Qt.WindowType.WindowStaysOnTopHint ) );

I've created a work-around in the caller:
    	Qt.WindowFlags flags = new 
Qt.WindowFlags(Qt.WindowType.FramelessWindowHint);
    	flags.set( Qt.WindowType.WindowStaysOnTopHint );
        ShapedClock shapedClock = new ShapedClock(null, flags);

But I don't want the widget creator to know the internals of widget 
creation, and I suspect I'm missing something obvious.

Another question - the created widget stays on the screen after the creater 
widget closes.
Do I have to call widget.dispose() when the first widget quits?

Thanks for any tips.
Andy

_________________________________________________________________
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507


Message 2 in thread

On Tuesday 03 July 2007 23:57, Andres Walsh wrote:
> First, thanks to Trolltech for an amazing product.

Thanks :-)
>
> Why doesn't the following line work in the widget constructor?
>       super(parent, new Qt.WindowFlags(Qt.WindowType.FramelessWindowHint |
> Qt.WindowType.WindowStaysOnTopHint ) );

This won't work because the | operator does not work on Enums. What you have 
to do is this:

super(parent, new WindowFlags(Qt.WindowType.FramelessWindowHint, 
Qt.WindowType.WindowStaysOnTopHint));

or if you want to use the | operator, then you have to do this:

super(parent, new WindowFlags(Qt.WindowType.FramelessWindowHint.value() | 
Qt.WindowType.WindowStaysOnTopHint.value()));

>
> I've created a work-around in the caller:
>     	Qt.WindowFlags flags = new
> Qt.WindowFlags(Qt.WindowType.FramelessWindowHint);
>     	flags.set( Qt.WindowType.WindowStaysOnTopHint );
>         ShapedClock shapedClock = new ShapedClock(null, flags);
>
> But I don't want the widget creator to know the internals of widget
> creation, and I suspect I'm missing something obvious.
>
> Another question - the created widget stays on the screen after the creater
> widget closes.
> Do I have to call widget.dispose() when the first widget quits?

You could implement the closeEvent(QCloseEvent) in the creator, and simply 
call QApplication.quit();

Hope this helped :-)

Best regards
	HÃvard FrÃiland
>
> Thanks for any tips.
> Andy
>
> _________________________________________________________________
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migrati
>on_HM_mini_2G_0507


Message 3 in thread

>
>Hope this helped :-)
>

perfectly, many thanks.

_________________________________________________________________
http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07