KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
mdisubwindow.h
1#ifndef MDISUBWINDOW_H
2#define MDISUBWINDOW_H
3#include <Kanoop/gui/libkanoopgui.h>
4#include <QMdiSubWindow>
5
6/**
7 * @brief QMdiSubWindow subclass that persists geometry and emits a closing() signal.
8 *
9 * MdiSubWindow saves and restores its position and size via GuiSettings and emits
10 * closing() before the window is destroyed so that parent windows can clean up.
11 * An integer type() property allows the application to categorize open sub-windows.
12 */
13class LIBKANOOPGUI_EXPORT MdiSubWindow : public QMdiSubWindow
14{
15 Q_OBJECT
16public:
17 /**
18 * @brief Construct with an optional parent.
19 * @param parent Optional QWidget parent
20 */
21 explicit MdiSubWindow(QWidget* parent = nullptr);
22
23 /**
24 * @brief Return the application-defined sub-window type integer.
25 * @return Sub-window type value
26 */
27 int type() const { return _type; }
28
29 /**
30 * @brief Set the application-defined sub-window type integer.
31 * @param value Sub-window type value
32 */
33 void setType(int value) { _type = value; }
34
35private:
36 /** @brief Persist position on move. */
37 virtual void moveEvent(QMoveEvent* event) override;
38 /** @brief Persist size on resize. */
39 virtual void resizeEvent(QResizeEvent* event) override;
40 /** @brief Restore geometry and mark form load complete on first show. */
41 virtual void showEvent(QShowEvent *event) override;
42 /** @brief Emit closing() before the window closes. */
43 virtual void closeEvent(QCloseEvent* event) override;
44
45 bool _formLoadComplete = false;
46 int _type = 0;
47
48signals:
49 /** @brief Emitted just before the sub-window closes. */
50 void closing();
51
52public slots:
53 /** @brief Called when application preferences change; override to react. */
54 virtual void onPreferencesChanged();
55};
56
57#endif // MDISUBWINDOW_H
QMdiSubWindow subclass that persists geometry and emits a closing() signal.
MdiSubWindow(QWidget *parent=nullptr)
Construct with an optional parent.
void setType(int value)
Set the application-defined sub-window type integer.
void closing()
Emitted just before the sub-window closes.
int type() const
Return the application-defined sub-window type integer.
virtual void onPreferencesChanged()
Called when application preferences change; override to react.