Search code examples
c++qtc++11qwidget

The order of arrangement of windows in QT


Sorry for my English. I need to implement the order of the QWidget. I have a stack of objects QWidget. And I need to place the window in the order they appear in a stack.

For example:

Stack: window1 -> window2 -> window3

From this example window2 always closes window3, but it, in turn, closes window1

typedef std::shared_ptr<Window> window_ptr;
std::stack<window_ptr> m_windowsStack;

Class window:

class Window
{
public:
    ...
private:
    ...
    std::shared_ptr<QWidget> m_window;
};

As it can be implemented with the help of QWidget. Maybe the QWidget has a feature that is responsible for the priority?


Solution

  • Have you tried using QStackedWidget to switch between windows? I believe it provides a means to swap between your windows.