Qt event when switching desktops - c++

I am currently using a Mac to test my software, I have a fullscreen Qt window that opens a floating Qt::Tool on top of it. I would love for the Qt::Tool to be linked to the fullscreen window, however when switching between desktops (three-finger swipe), the Qt::Tool is displayed on the other desktops although its parent window is in fullscreen in another desktop.
Is there an event that handles switching desktops so that I know when a window is no longer in focus and hide its child windows/tools?
Thank you very much in advance.

You are probably using some set of window flags that leads to this behaviour. Try to change those and see if you can get it to work like you want. I bet Mac handles one of the window flags you set in a special way such that it carries across virtual desktops.

Related

How to minimize a frameless window which has been set size to fixed by method setFixedSize in Qt?

How to minimize a frameless window which has been set size to fixed by method setFixedSize in Qt?
Hi,
I'm using C++ code to make a Qt application. I set the window to frameless by
this->setWindowFlags(Qt::FramelessWindowHint);
So I can't click the minimize button support by Operating System and I made a customed one. But, when I want to use
this.showMinimized();
I found that it can't work with window which has been set fixed size by
this.setFixedSize(width, height);
So my question is, is there some other ways to make the window minimized which can be used by a window that set fixed size?
This is almost definitely not what you are looking for, but most if not all modern operating systems contain a minimize-all keyboard shortcut or show desktop button. You may have the button on your task bar, if you have one. If not, try windows-key+d or control-alt-d. If you want to learn about how to minimize a qt window from within your code(what I think you probably want), I recommend you check out the surprisingly clear documentation at doc.qt.io.

How to create a borderless window with titlebar in windows c++

I am trying to create a Direct3D app that is operating in windowed mode with a title bar and minimize/quit button. However, I'd really like to be able to axe the border around the window.
I am looking to do this because it looks pretty cheesy on dual monitors when the app is filling the primary monitor horizontally (with room to move the app vertically), but its window border overflows onto the secondary screen. I've tried a bunch of combinations of setwindowlong with GWL_STYLE and GWL_EXSTYLE, but can't seem to make headway unless I disable the title bar.
I've seen a bunch of apps that are borderless however they seem to emulate the title bar rather than using the built in one provided by Microsoft.
Thanks for any suggestions.
You can't remove the border and keep the titlebar AFAIK.
You can reimplement the titlebar by using WM_NCHITTEST but you still need to draw it yourself which would not be a bad idea if you want your D3D app to look its best.
Visual Studio, last time I checked, achieves its border with transparent layered windows standing behind the primary one. They are the shadows you see.

Needed: A popup window without a taskbar icon

I am designing a UI engine that needs to render into popup (WS_POPUP) windows. As these windows cannot be children of other windows, each instance is given its own taskbar icon.
I need a way to prevent the taskbar icons from appearing for certain windows that are created as "dialogs". I cannot use an OS-provided dialog because they all have frames (and I can't figure out how to render into them) or a tool-created custom dialog (which seem to require the CLR).
I am not an expert with the windows API and I feel that I have missed something obvious...
Also: Anything involving CLI/CLR is not an option.
EDIT:
The WS_EX_NOACTIVATE style can be used for this purpose as well, though the activation behavior would need to be emulated by the program.
If you set the WS_EX_TOOLWINDOW extended style for your window, it won't be shown in the task bar or Alt+Tab list. This does cause the window to be rendered slightly differently, however (thinking floating tool palette).

Custom titlebar icons - Vista / Windows7

I'd like to add a custom button to my Window's titlebar. This doesn't need to work on XP - just Vista and later. Searching on the net yields lots of results for doing it the WM_NCPAINT way (eg. http://www.catch22.net/tuts/custom-titlebar). Is there a way to do this using Vista/Windows7 with Aero is enabled?
Thanks for any help,
Dan.
There is no simple way to do this, even on Vista/7. If you don't want to use the WM_NC* method, you can create your window without the WS_CAPTION, WS_SYSMENU, etc. styles, use DwmExtendFrameIntoClientArea to make a portion of your client area into the window frame, and then draw the titlebar yourself. However, this isn't less work than using the MC_NC* method because you will need to implement all of the titlebar features (system menu, close box, maximize box, etc.) yourself.

Creating a custom context menu Window (WinAPI)

I'm wondering how to create windows like these alt text http://img824.imageshack.us/img824/997/this.jpg
I'm refering to the one that says Marquee selection tool... these ones. I'm also not referring to the skin. I know how to do my own drawing and what not, this is not the issue. It's because windows usually need a parent which means it should not be possible for these windows to overlap into the tools. The only windows that can do this are context menus and menus. How can I create this style of window? Thanks
I think you are confusing the concept of owner windows and parent windows. Only dialog controls have parent windows, and these are automatically clipped by the parent's client area. Other windows have owner windows. This is a weaker relationship. There's nothing stopping a window from overlapping its owner.
Also, I wouldn't assume that just because the toolbar launches the context menu that the toolbar window has a relationship with the menu window. It might or might not, depending on how things are coded behind the scenes.
In any case, just try it out. Use the TrackPopupMenu() to create a popup. You can have it overlap the owner window without difficulty. Any window without the WS_CHILD style will exhibit the same behaviour.