1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QLAYOUT_P_H |
5 | #define QLAYOUT_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of qlayout*.cpp, and qabstractlayout.cpp. This header |
13 | // file may change from version to version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
19 | #include "private/qobject_p.h" |
20 | #include "qstyle.h" |
21 | #include "qsizepolicy.h" |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QWidgetItem; |
26 | class QSpacerItem; |
27 | class QLayoutItem; |
28 | |
29 | class Q_WIDGETS_EXPORT QLayoutPrivate : public QObjectPrivate |
30 | { |
31 | Q_DECLARE_PUBLIC(QLayout) |
32 | |
33 | public: |
34 | typedef QWidgetItem * (*QWidgetItemFactoryMethod)(const QLayout *layout, QWidget *widget); |
35 | typedef QSpacerItem * (*QSpacerItemFactoryMethod)(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy); |
36 | |
37 | QLayoutPrivate(); |
38 | |
39 | void getMargin(int *result, int userMargin, QStyle::PixelMetric pm) const; |
40 | void doResize(); |
41 | void reparentChildWidgets(QWidget *mw); |
42 | bool checkWidget(QWidget *widget) const; |
43 | bool checkLayout(QLayout *otherLayout) const; |
44 | |
45 | static QWidgetItem *createWidgetItem(const QLayout *layout, QWidget *widget); |
46 | static QSpacerItem *createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum); |
47 | virtual QLayoutItem* replaceAt(int, QLayoutItem *) { return nullptr; } |
48 | |
49 | static QWidgetItemFactoryMethod widgetItemFactoryMethod; |
50 | static QSpacerItemFactoryMethod spacerItemFactoryMethod; |
51 | |
52 | int insideSpacing; |
53 | int userLeftMargin; |
54 | int userTopMargin; |
55 | int userRightMargin; |
56 | int userBottomMargin; |
57 | uint topLevel : 1; |
58 | uint enabled : 1; |
59 | uint activated : 1; |
60 | uint autoNewChild : 1; |
61 | QLayout::SizeConstraint constraint; |
62 | QRect rect; |
63 | QWidget *; |
64 | }; |
65 | |
66 | QT_END_NAMESPACE |
67 | |
68 | #endif // QLAYOUT_P_H |
69 | |