KanoopGuiQt
1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
mdiwindow.h
1
#ifndef MDIWINDOW_H
2
#define MDIWINDOW_H
3
#include <Kanoop/gui/mainwindowbase.h>
4
#include <Kanoop/gui/libkanoopgui.h>
5
6
class
QMdiSubWindow;
7
class
MdiSubWindow
;
8
9
/**
10
* @brief MainWindowBase subclass that manages an embedded QMdiArea.
11
*
12
* MdiWindow provides helpers for opening, closing, and finding MdiSubWindow
13
* instances by type, and receives a subWindowClosing() callback when any
14
* sub-window signals that it is about to close.
15
*/
16
class
LIBKANOOPGUI_EXPORT
MdiWindow
:
public
MainWindowBase
17
{
18
Q_OBJECT
19
public
:
20
/**
21
* @brief Construct with a log prefix and optional parent.
22
* @param logPrefix Category name used for log output
23
* @param parent Optional QWidget parent
24
*/
25
MdiWindow
(
const
QString& logPrefix, QWidget* parent =
nullptr
);
26
27
protected
:
28
/**
29
* @brief Return the currently active sub-window's MainWindowBase.
30
* @return Pointer to the active sub-window's base, or nullptr
31
*/
32
MainWindowBase
*
activeSubWindow
();
33
34
/**
35
* @brief Open a new MdiSubWindow wrapping the given MainWindowBase.
36
* @param window Content window to host
37
* @param type Application-defined sub-window type integer
38
* @return Pointer to the created MdiSubWindow
39
*/
40
virtual
MdiSubWindow
*
openSubWindow
(
MainWindowBase
* window,
int
type);
41
42
/**
43
* @brief Close all open sub-windows of the given type.
44
* @param type Application-defined sub-window type integer
45
*/
46
virtual
void
closeSubWindows
(
int
type);
47
48
/**
49
* @brief Return the first open sub-window of the given type.
50
* @param type Application-defined sub-window type integer
51
* @return Pointer to the first matching MdiSubWindow, or nullptr
52
*/
53
MdiSubWindow
*
findFirstMdiSubWindow
(
int
type)
const
;
54
55
/**
56
* @brief Return all open sub-windows of the given type.
57
* @param type Application-defined sub-window type integer
58
* @return List of matching MdiSubWindow pointers
59
*/
60
QList<MdiSubWindow*>
findMdiSubWindows
(
int
type)
const
;
61
62
/**
63
* @brief Return the embedded QMdiArea.
64
* @return Pointer to the QMdiArea
65
*/
66
QMdiArea*
mdiArea
();
67
68
/**
69
* @brief Called just before a sub-window closes (no-op by default).
70
* @param window The sub-window that is closing
71
*/
72
virtual
void
subWindowClosing
(
MdiSubWindow
* window) { Q_UNUSED(window) }
73
74
private
:
75
QMdiArea* _mdiArea =
nullptr
;
76
77
private
slots:
78
/** @brief Internal handler forwarding sub-window close events to subWindowClosing(). */
79
void
onSubWindowClosing();
80
};
81
82
#endif
// MDIWINDOW_H
MainWindowBase
QMainWindow subclass providing logging, status bar helpers, and geometry persistence.
Definition
mainwindowbase.h:32
MdiSubWindow
QMdiSubWindow subclass that persists geometry and emits a closing() signal.
Definition
mdisubwindow.h:14
MdiWindow
MainWindowBase subclass that manages an embedded QMdiArea.
Definition
mdiwindow.h:17
MdiWindow::mdiArea
QMdiArea * mdiArea()
Return the embedded QMdiArea.
MdiWindow::subWindowClosing
virtual void subWindowClosing(MdiSubWindow *window)
Called just before a sub-window closes (no-op by default).
Definition
mdiwindow.h:72
MdiWindow::activeSubWindow
MainWindowBase * activeSubWindow()
Return the currently active sub-window's MainWindowBase.
MdiWindow::findFirstMdiSubWindow
MdiSubWindow * findFirstMdiSubWindow(int type) const
Return the first open sub-window of the given type.
MdiWindow::openSubWindow
virtual MdiSubWindow * openSubWindow(MainWindowBase *window, int type)
Open a new MdiSubWindow wrapping the given MainWindowBase.
MdiWindow::closeSubWindows
virtual void closeSubWindows(int type)
Close all open sub-windows of the given type.
MdiWindow::MdiWindow
MdiWindow(const QString &logPrefix, QWidget *parent=nullptr)
Construct with a log prefix and optional parent.
MdiWindow::findMdiSubWindows
QList< MdiSubWindow * > findMdiSubWindows(int type) const
Return all open sub-windows of the given type.
include
Kanoop
gui
mdiwindow.h
Generated by
1.9.8