Window Get hidden when "Show Desktop" pressed
-
my qtWindow Get hidden when "Show Desktop" pressed (Windows + D)
i tested the
if(isMinimized()) { setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); showNormal(); }
but didn't work, i think show desktop dosn't minimize the windows , it hides them or somthing
i'm making a desktop widget so i need it be shown even when Win+D is pressed.
thanks for helping me!
-
Welcome to the Qt forum!
Could you elaborate a bit more on your use case? What is a desktop widget? Where is the code shown actually located? -
@Axel-Spoerl
hi , thanks for responsethe code shown up is executed every 1 second to check if the qtWindow is minimized and if so , show it, and it doesn't .
anyway please ignore that , what i want is when i press Windows + D "Show Desktop" the window get hidden(or minimize) with other apps
what i want is it to be always in desktop and blow other apps and not hide able by Windows + D
-
@Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:
i'm making a desktop widget so i need it be shown even when Win+D is pressed.
I don't think that this is possible with Qt (or even at all).
TheWin-Key + D
shortcut hides (not minimizes!!) all visible windows and shows the desktop.
Unless I'm wrong, you can't stop the OS from hiding the underlying window in where your widget is rendered.the code shown up is executed every 1 second to check if the qtWindow is minimized and if so , show it, and it doesn't .
You don't block the event loop by doing this, don't you?! You are using
QTimer
instead of some cringeywhile
/sleep
loop stuff, right?!! :)) -
@Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:
it is possible , rainmeter dose it
It seems to be bugged there as well.
Try to catch the Qt hide event for your widget, if this doesn't work either, I have no idea how they do it. -
@Pl45m4 said in Window Get hidden when "Show Desktop" pressed:
catch the Qt hide even
How tho? -
https://doc.qt.io/qt-6/qhideevent.html
You probably won't be able to prevent or intercept the Win+D combination with Qt, but maybe it works to show the widget manually again.
-
void QHideEvent() { DeskPing w; w.hide(); } void DeskPing::hide() { ui->txtIp->setText(QString::fromStdString("Window Got hidden!")); }
why this doesn't work?
-
@Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:
why this doesn't work?
If this is your serious question, then you should improve your C++ knowledge.
Short answer:
Because your code is wrong and will never work this way.Detailed answer:
By "catching the hide event" I meant reimplementing it for your custom widget and then (maybe) force it to show itself again.
(Could be a little "dirty" but I can't think of other options right now. Probably others might know better)