PDA

View Full Version : Not show the progress bars under another window



SkripT
13th March 2006, 16:35
Hi all, I'm programming an application and in some cases I need to show QProgressBars when some lengthy process is running. This process can be started from another window that stays on the top of the window where the progress bars really have to be shown. The problem is that the progress bars are always shown even if I start the process from the other window, and in this case I want that the progress bars not appear under the current window because it's a bit annoying. I thougth setting the current window Qt::WindowStaysOnTopHint but it only works for top level windows. Another solution could be not showing the progress bars if the window is totally hidden by another window but I don't know how to make it. Any suggestions please?

Thanks a lot.

guilugi
13th March 2006, 16:42
You can use widget.isVisible(), to check if it is hidden by another one !

And if the widget is hidden, you can hide also the progressbars.

Guilugi.

SkripT
13th March 2006, 16:56
You can use widget.isVisible(), to check if it is hidden by another one !

Sorry guiluigi, that's not truth. Look what the docs says in the QWidget::visible() method:


A widget that happens to be obscured by other windows on the screen is considered to be visible.

I also had thought in this solution...

Moreover, I'd like that the progress bar continues appearing but behind the current window

wysota
13th March 2006, 17:07
Could you explain the situation a bit more? Is QProgressBar you want a part of another widget or a standalone one (like QProgressDialog)? You could probably use QApplication::activeWindow() to see if a widget of your choice is currently active.

SkripT
13th March 2006, 17:11
Thanks wysota, You're right: when I said progress bars I really want to say progress dialog, sorry ;) I will try it with QApplication::activeWindow () i think it will work to show or not the progress dialog. But do you know any other way to show the progress dialog but behind the current/active window? In this way if the current window is not at full screen may be some parts or the totality of the progress dialog is shown if it's not obscured by the current window

wysota
13th March 2006, 17:17
The only hint I can give you is that a child dialog is always shown on top of its parent. So a way to decide where a dialog should be shown is to give it a proper parent (and they say one doesn't choose his parents ;)). You could also use raise() and lower() to manipulate the order of dialogs in the stack.

SkripT
13th March 2006, 17:22
Ok thanks again, I think that with all this hints I will find a solution.