Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgraphicsanchorlayout.h
Go to the documentation of this file.
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 QGRAPHICSANCHORLAYOUT_H
5#define QGRAPHICSANCHORLAYOUT_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qgraphicsitem.h>
9#include <QtWidgets/qgraphicslayout.h>
10
11QT_REQUIRE_CONFIG(graphicsview);
12
14
18
19class Q_WIDGETS_EXPORT QGraphicsAnchor : public QObject
20{
22 Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing)
23 Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy)
24public:
25 void setSpacing(qreal spacing);
26 void unsetSpacing();
27 qreal spacing() const;
28 void setSizePolicy(QSizePolicy::Policy policy);
29 QSizePolicy::Policy sizePolicy() const;
33
34 Q_DECLARE_PRIVATE(QGraphicsAnchor)
35
37};
38
39class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
40{
41public:
43 virtual ~QGraphicsAnchorLayout();
44
45 QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
46 QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
47 QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
48 QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
49
50 void addCornerAnchors(QGraphicsLayoutItem *firstItem, Qt::Corner firstCorner,
51 QGraphicsLayoutItem *secondItem, Qt::Corner secondCorner);
52
53 void addAnchors(QGraphicsLayoutItem *firstItem,
54 QGraphicsLayoutItem *secondItem,
55 Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical);
56
57 void setHorizontalSpacing(qreal spacing);
58 void setVerticalSpacing(qreal spacing);
59 void setSpacing(qreal spacing);
60 qreal horizontalSpacing() const;
61 qreal verticalSpacing() const;
62
63 void removeAt(int index) override;
64 void setGeometry(const QRectF &rect) override;
65 int count() const override;
66 QGraphicsLayoutItem *itemAt(int index) const override;
67
68 void invalidate() override;
69protected:
70 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
71
72private:
73 Q_DISABLE_COPY(QGraphicsAnchorLayout)
74 Q_DECLARE_PRIVATE(QGraphicsAnchorLayout)
75
76 friend class QGraphicsAnchor;
77};
78
80
81#endif
The QGraphicsAnchorLayout class provides a layout where one can anchor widgets together in Graphics V...
The QGraphicsAnchor class represents an anchor between two items in a QGraphicsAnchorLayout.
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qsize.h:208
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Definition qsizepolicy.h:18
qreal spacing
rect
[4]
Combined button and popup list for selecting options.
@ Horizontal
Definition qnamespace.h:99
@ Vertical
Definition qnamespace.h:100
AnchorPoint
GLuint index
[2]
GLenum GLenum GLsizei count
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
double qreal
Definition qtypes.h:187
QSizePolicy policy
widget setSizePolicy(policy)