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
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
12
13QT_BEGIN_NAMESPACE
14
15class QGraphicsAnchorPrivate;
16class QGraphicsAnchorLayout;
17class QGraphicsAnchorLayoutPrivate;
18
19class Q_WIDGETS_EXPORT QGraphicsAnchor : public QObject
20{
21 Q_OBJECT
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;
30 ~QGraphicsAnchor();
31private:
32 QGraphicsAnchor(QGraphicsAnchorLayout *parent);
33
34 Q_DECLARE_PRIVATE(QGraphicsAnchor)
35
36 friend class QGraphicsAnchorLayoutPrivate;
37};
38
39class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
40{
41public:
42 QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = nullptr);
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
79QT_END_NAMESPACE
80
81#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
Combined button and popup list for selecting options.
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)