1 | /* |
2 | * SPDX-FileCopyrightText: 2023 Marco Martin <mart@kde.org> |
3 | * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> |
4 | * |
5 | * SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | #ifndef HEADERFOOTERLAYOUT_H |
8 | #define |
9 | |
10 | #include <QQuickItem> |
11 | #include <qtmetamacros.h> |
12 | |
13 | /** |
14 | * replicates a little part of what Page does, |
15 | * It's a container with 3 properties, header, contentItem and footer |
16 | * which will be laid out oone on top of each other. It works better than a |
17 | * ColumnLayout when the elements are to be defined by properties by the |
18 | * user, which would require ugly reparenting dances and container items to |
19 | * maintain the layout well behaving. |
20 | */ |
21 | class : public QQuickItem |
22 | { |
23 | Q_OBJECT |
24 | QML_ELEMENT |
25 | /** |
26 | * @brief This property holds the page header item. |
27 | * |
28 | * The header item is positioned to the top, |
29 | * and resized to the width of the page. The default value is null. |
30 | */ |
31 | Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) |
32 | |
33 | /** |
34 | * @brief This property holds the visual content Item. |
35 | * |
36 | * It will be resized both in width and height with the layout resizing. |
37 | * Its height will be resized to still have room for the heder and footer |
38 | */ |
39 | Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL) |
40 | |
41 | /** |
42 | * @brief This property holds the page footer item. |
43 | * |
44 | * The footer item is positioned to the bottom, |
45 | * and resized to the width of the page. The default value is null. |
46 | */ |
47 | Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) |
48 | |
49 | public: |
50 | (QQuickItem *parent = nullptr); |
51 | () override; |
52 | |
53 | void (QQuickItem *item); |
54 | QQuickItem *(); |
55 | |
56 | void (QQuickItem *item); |
57 | QQuickItem *(); |
58 | |
59 | void (QQuickItem *item); |
60 | QQuickItem *(); |
61 | |
62 | /** |
63 | * @brief HeaderFooterLayout normally positions its header, footer and |
64 | * contentItem once per frame (at polish event). This method forces the it |
65 | * to recalculate the layout immediately. |
66 | */ |
67 | Q_INVOKABLE void (); |
68 | |
69 | Q_SIGNALS: |
70 | void (); |
71 | void (); |
72 | void (); |
73 | |
74 | protected: |
75 | void (const QRectF &newGeometry, const QRectF &oldGeometry) override; |
76 | void () override; |
77 | void () override; |
78 | |
79 | private: |
80 | void (); |
81 | void (); |
82 | void (); |
83 | void (QQuickItem *item); |
84 | |
85 | QPointer<QQuickItem> ; |
86 | QPointer<QQuickItem> ; |
87 | QPointer<QQuickItem> ; |
88 | |
89 | bool : 1; |
90 | bool : 1; |
91 | }; |
92 | |
93 | #endif |
94 | |