Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QGRAPHICSANCHORLAYOUT_H
6#define QGRAPHICSANCHORLAYOUT_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qgraphicsitem.h>
10#include <QtWidgets/qgraphicslayout.h>
11
13
14QT_BEGIN_NAMESPACE
15
16class QGraphicsAnchorPrivate;
17class QGraphicsAnchorLayout;
18class QGraphicsAnchorLayoutPrivate;
19
20class Q_WIDGETS_EXPORT QGraphicsAnchor : public QObject
21{
22 Q_OBJECT
23 Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing)
24 Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy)
25public:
26 void setSpacing(qreal spacing);
27 void unsetSpacing();
28 qreal spacing() const;
29 void setSizePolicy(QSizePolicy::Policy policy);
30 QSizePolicy::Policy sizePolicy() const;
31 ~QGraphicsAnchor();
32private:
33 QGraphicsAnchor(QGraphicsAnchorLayout *parent);
34
35 Q_DECLARE_PRIVATE(QGraphicsAnchor)
36
37 friend class QGraphicsAnchorLayoutPrivate;
38};
39
40class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
41{
42public:
43 QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = nullptr);
44 virtual ~QGraphicsAnchorLayout();
45
46 QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
47 QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
48 QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
49 QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
50
51 void addCornerAnchors(QGraphicsLayoutItem *firstItem, Qt::Corner firstCorner,
52 QGraphicsLayoutItem *secondItem, Qt::Corner secondCorner);
53
54 void addAnchors(QGraphicsLayoutItem *firstItem,
55 QGraphicsLayoutItem *secondItem,
56 Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical);
57
58 void setHorizontalSpacing(qreal spacing);
59 void setVerticalSpacing(qreal spacing);
60 void setSpacing(qreal spacing);
61 qreal horizontalSpacing() const;
62 qreal verticalSpacing() const;
63
64 void removeAt(int index) override;
65 void setGeometry(const QRectF &rect) override;
66 int count() const override;
67 QGraphicsLayoutItem *itemAt(int index) const override;
68
69 void invalidate() override;
70protected:
71 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
72
73private:
74 Q_DISABLE_COPY(QGraphicsAnchorLayout)
75 Q_DECLARE_PRIVATE(QGraphicsAnchorLayout)
76
77 friend class QGraphicsAnchor;
78};
79
80QT_END_NAMESPACE
81
82#endif
The QGraphicsAnchorLayout class provides a layout where one can anchor widgets together in Graphics V...
void setSizePolicy(QSizePolicy::Policy policy)
static QGraphicsAnchorPrivate * get(QGraphicsAnchor *q)
QGraphicsAnchorLayoutPrivate * layoutPrivate
The QGraphicsAnchor class represents an anchor between two items in a QGraphicsAnchorLayout.
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
void setDefaultSpacing(Qt::Orientation o, qreal spacing)
bool operator==(const QLayoutStyleInfo &other) const
bool operator!=(const QLayoutStyleInfo &other) const
qreal perItemSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation) const
qreal defaultSpacing(Qt::Orientation o) const
QWidget * widget() const
QStyle * style() const
QLayoutStyleInfo(QStyle *style, QWidget *widget)
QSimplexConstraint * constraint(const GraphPath &path) const
QT_REQUIRE_CONFIG(animation)
Q_DECLARE_TYPEINFO(GraphPath, Q_RELOCATABLE_TYPE)
QT_REQUIRE_CONFIG(graphicsview)
Q_DECLARE_INTERFACE(QNetworkAccessBackendFactory, QNetworkAccessBackendFactory_iid)
void refreshSizeHints(const QLayoutStyleInfo *styleInfo=nullptr)
AnchorVertexPair(AnchorVertex *v1, AnchorVertex *v2, AnchorData *data)
AnchorVertex(QGraphicsLayoutItem *item, Qt::AnchorPoint edge)
ParallelAnchorData(AnchorData *first, AnchorData *second)
SequentialAnchorData(const QList< AnchorVertex * > &vertices, const QList< AnchorData * > &edges)