Warning, file /include/QtWidgets/qlayout.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QLAYOUT_H
0005 #define QLAYOUT_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtWidgets/qlayoutitem.h>
0010 #include <QtWidgets/qsizepolicy.h>
0011 #include <QtCore/qrect.h>
0012 #include <QtCore/qmargins.h>
0013
0014 #include <limits.h>
0015
0016 QT_BEGIN_NAMESPACE
0017
0018
0019 class QLayout;
0020 class QSize;
0021
0022
0023 class QLayoutPrivate;
0024
0025 class Q_WIDGETS_EXPORT QLayout : public QObject, public QLayoutItem
0026 {
0027 Q_OBJECT
0028 Q_DECLARE_PRIVATE(QLayout)
0029
0030 Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
0031 Q_PROPERTY(QMargins contentsMargins READ contentsMargins WRITE setContentsMargins
0032 RESET unsetContentsMargins)
0033 Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint)
0034 public:
0035 enum SizeConstraint {
0036 SetDefaultConstraint,
0037 SetNoConstraint,
0038 SetMinimumSize,
0039 SetFixedSize,
0040 SetMaximumSize,
0041 SetMinAndMaxSize
0042 };
0043 Q_ENUM(SizeConstraint)
0044
0045 explicit QLayout(QWidget *parent = nullptr);
0046 ~QLayout();
0047
0048 virtual int spacing() const;
0049 virtual void setSpacing(int);
0050
0051 void setContentsMargins(int left, int top, int right, int bottom);
0052 void setContentsMargins(const QMargins &margins);
0053 void unsetContentsMargins();
0054 void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
0055 QMargins contentsMargins() const;
0056 QRect contentsRect() const;
0057
0058 bool setAlignment(QWidget *w, Qt::Alignment alignment);
0059 bool setAlignment(QLayout *l, Qt::Alignment alignment);
0060 using QLayoutItem::setAlignment;
0061
0062 void setSizeConstraint(SizeConstraint);
0063 SizeConstraint sizeConstraint() const;
0064 void setMenuBar(QWidget *w);
0065 QWidget *menuBar() const;
0066
0067 QWidget *parentWidget() const;
0068
0069 void invalidate() override;
0070 QRect geometry() const override;
0071 bool activate();
0072 void update();
0073
0074 void addWidget(QWidget *w);
0075 virtual void addItem(QLayoutItem *) = 0;
0076
0077 void removeWidget(QWidget *w);
0078 void removeItem(QLayoutItem *);
0079
0080 Qt::Orientations expandingDirections() const override;
0081 QSize minimumSize() const override;
0082 QSize maximumSize() const override;
0083 virtual void setGeometry(const QRect&) override;
0084 virtual QLayoutItem *itemAt(int index) const = 0;
0085 virtual QLayoutItem *takeAt(int index) = 0;
0086 virtual int indexOf(const QWidget *) const;
0087 virtual int indexOf(const QLayoutItem *) const;
0088 virtual int count() const = 0;
0089 bool isEmpty() const override;
0090 QSizePolicy::ControlTypes controlTypes() const override;
0091
0092 virtual QLayoutItem *replaceWidget(QWidget *from, QWidget *to,
0093 Qt::FindChildOptions options = Qt::FindChildrenRecursively);
0094
0095 int totalMinimumHeightForWidth(int w) const;
0096 int totalHeightForWidth(int w) const;
0097 QSize totalMinimumSize() const;
0098 QSize totalMaximumSize() const;
0099 QSize totalSizeHint() const;
0100 QLayout *layout() override;
0101
0102 void setEnabled(bool);
0103 bool isEnabled() const;
0104
0105
0106 static QSize closestAcceptableSize(const QWidget *w, const QSize &s);
0107
0108 protected:
0109 void widgetEvent(QEvent *);
0110 void childEvent(QChildEvent *e) override;
0111 void addChildLayout(QLayout *l);
0112 void addChildWidget(QWidget *w);
0113 bool adoptLayout(QLayout *layout);
0114
0115 QRect alignmentRect(const QRect&) const;
0116 protected:
0117 QLayout(QLayoutPrivate &d, QLayout*, QWidget*);
0118
0119 private:
0120 Q_DISABLE_COPY(QLayout)
0121
0122 static void activateRecursiveHelper(QLayoutItem *item);
0123
0124 friend class QApplicationPrivate;
0125 friend class QWidget;
0126
0127 };
0128
0129 QT_END_NAMESPACE
0130
0131
0132 #include <QtWidgets/qboxlayout.h>
0133 #include <QtWidgets/qgridlayout.h>
0134
0135 #endif