Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problem making gadgets when windowFlag is Qt::FramelessWindowHint
So i want to create some gadgets, you know like Windows gadgets
So my code goes somehow like this:
setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnBottomHint);
The problem i encounter, is when the user presses Show Desktop, i don't recieve any minimize signal to show it again immediatly
AFAIK Windows gadgets are small embedded webpages. Using Qt to "fake" them is cumbersome. Why not do it the "official way":http://msdn.microsoft.com/en-us/library/windows/desktop/bb456468.aspx
QWidget(QApplication::desktop()), ui(new Ui::Clock)
I'm not sure what this does. Does it even compile?
What is Show Desktop? Is it like a button in your app or do you mean the OS functionality to hide all windows? If a user wants to "show desktop" why do you want your app to work against his wish?
It is not only for Windows 7 or lower, it is also for Windows 8 and Linux
Yes it compiles great, here is my complete .cpp file:http://paste.ubuntu.com/8708238/
a simple clock lcd widget..
It works great, but i have a problem with the Show Desktop..
Yes Show Desktop is the OS feature that hides everything.. (But remember not also the gadgets)
If i have the windowflag, Qt::FramelessWindowHint, i don't recieve minimize signal when Show Desktop is pressed. But if i don't add this windowflag i recieve it.
Ah, you didn't paste the first line (Clock::Clock(): ). Now it makes sense ;)
I don't think what you want to do is possible. The feature is designed to be transparent for the app so you are working against the user AND the OS.
You might sniff around for certain WM_XXX message combinations in the nativeEvent() method but I doubt there is such that would identify this feature uniquely.
I know you're just looking for an answer but I will re-raise the questionable nature of it. The designers of the mentioned OSes clearly didn't want you to do that and so you really shouldn't. As for Windows Vista/7 Gadgets even Microsoft decided "it was a bad idea":http://windows.microsoft.com/en-us/windows/gadgets so maybe learn from their mistakes.
As Microsoft is saying, they removed it because there existed harmfull gadgets
But i will not allow the user to add gadgets. I will just have my own basic widgets like weather/clock/image slideshow etc.
As i said, gadgets are part of the Desktop, and they should not hide after Show Desktop has been clicked.
From the moment i make the Window frameless, it does not receive minimize event (via change event) neither a native event of WM_SIZE when i click Show Desktop. While if the window is not frameless it receives both messages.
And even if i achieved to receive a message,
I set a timer, to run every 1 second, show().. if i click Show Desktop, and wait 1 second it will not Show.. it also says that is not minimized.. Something strange happening here..
The first answer here says it is a qt thing, (http://stackoverflow.com/questions/19716227/qt-working-windows-8-style-frameless-custom-window)
bq. gadgets are part of the Desktop, and they should not hide
Just because you made up this definition of a gadget for yourself doesn't mean the OS or the rest of the world has to agree ;) There is nothing in Win8 or below Vista called gadget. You chose to call that certain functionality that you want but that doesn't make it real or supported by the OS.
Show Desktop is a "special" feature. From what you 're saying I suspect no window can be show when it's used and it's probably a DWM trick on the OS part. You're out of luck I suppose.