PDA

View Full Version : Hide taskbar button



JeanC
10th March 2008, 15:20
I have an app which displays animations. It has a trayicon and it has no show() in main so it starts hidden.

Once in a while (QTimer) this app displays animations, therefore it does a show() on that window. This window has attributes Qt::FramelessWindowHint and Qt::WindowStaysOnTopHint.

Now I would like to get rid of the taskbar button from this window. From googling I tried the trick with QTimer::singleShot(0, this, SLOT(show())) and I tried making the window a dialog but I still have the taksbar while the window is visible.

Is it possible to get rid of it completely?

Thanks again.

pherthyl
10th March 2008, 21:27
You might try setting the window flags to something like Qt::SplashScreen (setWindowFlags)

JeanC
11th March 2008, 14:28
Thank you.

Yes this works. Unfortunately there are some side effects. The window stays centered on the screen and ignores move(), and such a window closes on mousePressEvent() in stead of executing the function.

But it was worth the try!

THRESHE
11th March 2008, 15:07
Try Qt::FramelessWindowHint

aamer4yu
11th March 2008, 15:12
As for closing of window on mousepress event.... u can subclass and catch that event.
Also u can try for tooltip window.
Hope it helps

JeanC
11th March 2008, 15:29
Thanks folks,

Qt::FramelessWindowHint was already in there, I tried several combo's as flags.
And that event was already subclassed, but got ignored on setting the Splashscreen flag.

I'm afraid this one is not so easy.

Greets, Jean.

pherthyl
11th March 2008, 21:48
As aamer4yu mentioned, try using Qt::ToolTip instead of SplashScreen. Basically, some combination of window flags will almost certainly do what you want..

JeanC
11th March 2008, 23:32
Well I couldn't find one.
hide() hides it but show() brings it back.


As aamer4yu mentioned, try using Qt::ToolTip instead of SplashScreen. Basically, some combination of window flags will almost certainly do what you want..

pherthyl
12th March 2008, 00:18
Do you need this window to be focusable by the user? In other words, do they need to interact with it in some way or is it just a window to display animations?

If interaction is not necessary, you can use WS_EX_NOACTIVATE (on Windows at least). I use the following function for my stuff.


/**
* Set the window to never receive the keyboard focus.
*/
void MyQWidget::setNoActivate() {
long exStyle = GetWindowLong(winId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE;
SetWindowLong(winId(), GWL_EXSTYLE, exStyle);
}

You will have to include the windows headers.

JeanC
12th March 2008, 10:59
Hi pherthyl,

Well I am on ubuntu linux since some time, in windows borland cbuilder I have this program working fine. But I seldom use windows anymore, that's why I Qt.

No taksbar would have prioritiy over window interaction though.

Well never mind, I can live with it for the time being.

Thanks,
Jean.