[Interest] window alway on top

97 views
Skip to first unread message

Tibo W

unread,
Apr 2, 2012, 2:06:26 PM4/2/12
to inte...@qt-project.org
Hi,

I have a Qt application displayed full screen, and small semi-transparent windows (QGraphicsView + QML) on top on the main app.
When I click on the main app, the small windows disappear behind...
I set the modality, windows flags etc, but I can't find how to make the small windows not disappear (unless I call hide() then show() but that looks ugly).

I'm using Qt 471 X11 with Ubuntu 10.04 x86. I tried with metacity, openbox and xfwm4 but the behavior is the same.

Any suggestion ? Thanks  in advance !

Tibold Kandrai

unread,
Apr 2, 2012, 2:55:37 PM4/2/12
to inte...@qt-project.org
Hi!

I'm not sure what you try to achieve here, but if I understood it right setting the windowModality to ApplicationModal might help. :)
_______________________________________________
Interest mailing list
Inte...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


-- 
Tibold Kandrai
CEO @ Dotz Team

Till Oliver Knoll

unread,
Apr 2, 2012, 4:25:48 PM4/2/12
to Qt Interest


Am 02.04.2012 um 20:06 schrieb Tibo W <tibo...@yahoo.com>:

I set the modality, windows flags etc, but I can't find how to make the small windows not disappear

The "window modality" doesn't control the appearance, it sets the *behaviour* of a window (dialog).

However as you want your window to be always on top, you also want to set it "non-modal", such that the other windows in the background can still aquire user input (or "modal" - I always confuse which is which).

What you are looking after are the "Window Manager hints" which are controlled with "Window Flags".

Did you try this example yet?


The flag you want to set (possibly in combination with others) is

  Qt::WindowStaysOnTopHint

But remember: "The hints are more what you'd call "guidelines" than actual rules."


Aye, mate!
  Oliver

Till Oliver Knoll

unread,
Apr 2, 2012, 4:33:57 PM4/2/12
to Qt Interest


Am 02.04.2012 um 20:06 schrieb Tibo W <tibo...@yahoo.com>:

I have a Qt application displayed full screen, and small semi-transparent windows (QGraphicsView + QML) on top on the main app.

Oh, by the way, I strongly do believe that the "Windows Hints" only have an effect on either QDialog or QMainWindow based widgets (probably QToolBar as well, maybe others which usually have a window title etc.).

So if your top-level widget is a QGraphicsView itself, place it inside a (borderless) QDialog and set the flags on that one. Just in case...

Cheers,
  Oliver


Tony Rietwyk

unread,
Apr 2, 2012, 7:09:18 PM4/2/12
to inte...@qt-project.org

Hi Tibo,

 

I have the same thing and it works fairly well:

 

- My sub window is just a QWidget with a designed ui.

 

- In its constructor, I pass the Qt::Dialog flag (with others to customize the title bar).  

 

TCourseTree::TCourseTree(QWidget *parent)

                : QWidget(parent,

                Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)

{

                ui.setupUi( this );

}

 

- create the sub window with the main window as parent.  (I think this is the thing you have missed).

 

- show and hide the window as appropriate (using animation on the transparency in my case).

 

Hope that helps,

 

Tony.

 

 

 

Sent: Tuesday, 3 April 2012 4:06 AM

Tibo W

unread,
Apr 2, 2012, 8:08:29 PM4/2/12
to inte...@qt-project.org
Hi guys,

thanks a lot for your help !

I forgot to mention one thing: on Ubuntu 10.04 X11 x86 running with gnome and matacity, it's working.

But setting the windows flags to QDialog, and adding the main window as parent worked for the openbox environment .
I also had to change the focus policy so I can still click on the background (main app) window.

cheers

Till Oliver Knoll

unread,
Apr 3, 2012, 2:42:48 AM4/3/12
to Qt Interest


Am 03.04.2012 um 02:08 schrieb Tibo W <tibo...@yahoo.com>:

Hi guys,

thanks a lot for your help !

I forgot to mention one thing: on Ubuntu 10.04 X11 x86 running with gnome and matacity, it's working.

Yes, what I said: More like guidelines for the actual window manager... ;)

I also had to change the focus policy so I can still click on the background (main app) window.

That sounds wrong to me: how exactly did you change the focus policy, and of what widget?

What you really want is setting the *modality* of your QDialog to non-modal. Look it up in the Qt docs:


Hint: it's the first property described.

Cheers, Oliver
Reply all
Reply to author
Forward
0 new messages