Subwindows that ignore the close event will remain open. You may receive subWindowActivated() signals from subwindows before they are closed (if the MDI area activates the subwindow when another is closing). void QMdiArea:: closeAllSubWindows()Ĭloses all subwindows by sending a QCloseEvent to each window. Reimplemented from QObject::childEvent(). void QMdiArea:: childEvent( QChildEvent * childEvent) void QMdiArea:: cascadeSubWindows()Īrranges all the child windows in a cascade pattern. ![]() Returns the QMdiSubWindow that is added to the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow. When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. SubWindow1 - >setAttribute( Qt ::WA_DeleteOnClose) SubWindow1 - >setWidget(internalWidget1) ![]() QMdiSubWindow *subWindow1 = new QMdiSubWindow Note: Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea. The widget can be either a QMdiSubWindow or another QWidget (in which case the MDI area will create a subwindow and set the widget as the internal widget). If windowFlags are non-zero, they will override the flags set on the widget. QMdiSubWindow *QMdiArea:: addSubWindow( QWidget * widget, Qt::WindowFlags windowFlags = Qt::WindowFlags())Īdds widget as a new subwindow to the MDI area. See also setActiveSubWindow() and Qt::WindowState. Note that if a widget in the window in which the MDI area lives gains focus, the window will be activated. Subwindows are treated as top-level windows with respect to window state, i.e., if a widget outside the MDI area is the active window, no subwindow will be active. If no window is currently active, 0 is returned. Returns a pointer to the current active subwindow. QMdiSubWindow *QMdiArea:: activeSubWindow() const See also activateNextSubWindow() and QMdiArea::WindowOrder. The window activated will be the previous one determined by the current activation order. Gives the keyboard focus to another window in the list of child windows. void QMdiArea:: activatePreviousSubWindow() See also activatePreviousSubWindow() and QMdiArea::WindowOrder. The window activated will be the next one determined by the current activation order. QMdiArea:: ~QMdiArea()ĭestroys the MDI area. parent is passed to QWidget's constructor. Member Function Documentation QMdiArea:: QMdiArea( QWidget * parent = Q_NULLPTR)Ĭonstructs an empty mdi area. Both are slots and are easily connected to menu entries. QMdiArea provides two built-in layout strategies for subwindows: cascadeSubWindows() and tileSubWindows(). Also, it is used when cascading or tiling the windows with cascadeSubWindows() and tileSubWindows(). This is used for the subWindowList() and for activateNextSubWindow() and activatePreviousSubWindow(). The subwindows are sorted by the current WindowOrder. This information could be used in a popup menu containing a list of windows, for example. The convenience function subWindowList() returns a list of all subwindows. ![]() The MDI area emits the subWindowActivated() signal when the active window changes, and the activeSubWindow() function returns the active subwindow. The user activates a window by moving focus in the usual ways. ![]() See the QMdiSubWindow class description for more details.Ī subwindow becomes active when it gets the keyboard focus, or when setFocus() is called. QMdiSubWindow also has behavior that is specific to MDI windows. It is common to pass a QWidget, which is set as the internal widget, to this function, but it is also possible to pass a QMdiSubWindow directly.The class inherits QWidget, and you can use the same API as with a normal top-level window when programming. They are added to an MDI area with addSubWindow(). Subwindows in QMdiArea are instances of QMdiSubWindow. If a specific flag is not supported by the style (e.g., the WindowShadeButtonHint), you can still shade the window with showShaded(). Unlike the window managers for top-level windows, all window flags ( Qt::WindowFlags) are supported by QMdiArea as long as the flags are supported by the current widget style. The following code adds an area to a main window: QMainWindow *mainWindow = new QMainWindow QMdiArea is commonly used as the center widget in a QMainWindow to create MDI applications, but can also be placed in any layout. For instance, it draws the windows it manages on itself and arranges them in a cascading or tile pattern. QMdiArea functions, essentially, like a window manager for MDI windows. The QMdiArea widget provides an area in which MDI windows are displayed. SubWindowList(WindowOrder order = CreationOrder) const SetTabPosition(QTabWidget::TabPosition position) SetOption(AreaOption option, bool on = true) AddSubWindow(QWidget * widget, Qt::WindowFlags windowFlags = Qt::WindowFlags())
0 Comments
Leave a Reply. |