KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
mdiarea.h
1#ifndef MDIAREA_H
2#define MDIAREA_H
3#include <QMdiArea>
4#include <Kanoop/gui/libkanoopgui.h>
5
6/**
7 * @brief QMdiArea subclass that adds keyboard-driven sub-window cycling.
8 *
9 * MdiArea intercepts keyboard events to cycle through sub-windows and emits
10 * signals at the start and end of each paging operation so the application can
11 * update its UI accordingly.
12 */
13class LIBKANOOPGUI_EXPORT MdiArea : public QMdiArea
14{
15 Q_OBJECT
16public:
17 /**
18 * @brief Construct with an optional parent.
19 * @param parent Optional QWidget parent
20 */
21 explicit MdiArea(QWidget* parent = nullptr);
22
23signals:
24 /**
25 * @brief Emitted when a sub-window paging cycle begins for the given window.
26 * @param subWindow The sub-window being paged to
27 */
28 void subWindowPaging(QMdiSubWindow* subWindow);
29
30 /** @brief Emitted when the paging cycle has completed. */
32
33protected:
34 /** @brief Intercept keyboard events to drive sub-window cycling. */
35 virtual bool eventFilter(QObject* watched, QEvent* event) override;
36
37private:
38 /**
39 * @brief Return the next sub-window in the cycle order.
40 * @param forward true to cycle forward, false to cycle backward
41 * @return Pointer to the next sub-window
42 */
43 QMdiSubWindow *getNextSubWindowInCycle(bool forward = true);
44
45 int _pagingIndex = -1;
46};
47
48#endif // MDIAREA_H
QMdiArea subclass that adds keyboard-driven sub-window cycling.
Definition mdiarea.h:14
virtual bool eventFilter(QObject *watched, QEvent *event) override
Intercept keyboard events to drive sub-window cycling.
MdiArea(QWidget *parent=nullptr)
Construct with an optional parent.
void subWindowPaging(QMdiSubWindow *subWindow)
Emitted when a sub-window paging cycle begins for the given window.
void pagingComplete()
Emitted when the paging cycle has completed.