Implementing Simple Window System
-
I'm trying to implement a system of windows in which there are two windows. When each of the respective windows is active, it can be displayed over the other window. However, only a single window should be shown in the task manager (when the user presses alt-tab only one window should be shown for my application).
I have tried to approach this from a few different angles:
I have tried having two parentless windows and giving one of them the Qt::Tool flag. This approach works until alt-tab is pressed. Once this happens, the tool window disappears, although it is still considered "visible" by the API (when the isVisible() method is called, it returns true even though the window is not visible).
I have also tried parenting one window (call it window B) to the other window (call it window A) and then switched the parenting by invoking the setParent() method whenever the current parent window becomes active. This allows the active window to be rendered over the inactive window. This approach causes both windows to momentarily close each time another window becomes active, causing the windows to "blink."
Is there any simpler/better way to approach this problem?
-
QStackedWidget?
-
I've looked into QStackedWidget, but I'd like to have the two windows be separate, so that the user can see things in both windows at the same time.
-
Maybe a MDI approach ?
-
I guess I could have the two windows contained within an MDI main window. I was hoping to tackle this with SDI though.
-
You mean GIMP or Delphi kind UI?
In this case you any way should have one parent window . Then create other window:
@QMainWindow *windB = new QMainWindow(this/or parent window pointer/);
...
winB->show();@in taskmanager you get only one window. App closes when close main parent window.
-
Using this method, the intended effect of having either window be rendered over the other one (depending upon which one is active) is not achieved.
-
How about having two separate processes sending messages to each other and behaving accordingly?
-
Sorry forgot to ask what operating system are you using in particular or are you trying to do it with only Qt dependencies. I dumb question on my part maybe :-(
-
The target OS for my application is Windows. I'm not sure how this approach would help, especially with regards to having only a single window be displayed when the user presses alt-tab.