Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:33

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QGRAPHICSANCHORLAYOUT_H
0005 #define QGRAPHICSANCHORLAYOUT_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qgraphicsitem.h>
0009 #include <QtWidgets/qgraphicslayout.h>
0010 
0011 QT_REQUIRE_CONFIG(graphicsview);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QGraphicsAnchorPrivate;
0016 class QGraphicsAnchorLayout;
0017 class QGraphicsAnchorLayoutPrivate;
0018 
0019 class Q_WIDGETS_EXPORT QGraphicsAnchor : public QObject
0020 {
0021     Q_OBJECT
0022     Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing)
0023     Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy)
0024 public:
0025     void setSpacing(qreal spacing);
0026     void unsetSpacing();
0027     qreal spacing() const;
0028     void setSizePolicy(QSizePolicy::Policy policy);
0029     QSizePolicy::Policy sizePolicy() const;
0030     ~QGraphicsAnchor();
0031 private:
0032     QGraphicsAnchor(QGraphicsAnchorLayout *parent);
0033 
0034     Q_DECLARE_PRIVATE(QGraphicsAnchor)
0035 
0036     friend class QGraphicsAnchorLayoutPrivate;
0037 };
0038 
0039 class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
0040 {
0041 public:
0042     QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = nullptr);
0043     virtual ~QGraphicsAnchorLayout();
0044 
0045     QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
0046                                QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
0047     QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
0048                             QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
0049 
0050     void addCornerAnchors(QGraphicsLayoutItem *firstItem, Qt::Corner firstCorner,
0051                           QGraphicsLayoutItem *secondItem, Qt::Corner secondCorner);
0052 
0053     void addAnchors(QGraphicsLayoutItem *firstItem,
0054                     QGraphicsLayoutItem *secondItem,
0055                     Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical);
0056 
0057     void setHorizontalSpacing(qreal spacing);
0058     void setVerticalSpacing(qreal spacing);
0059     void setSpacing(qreal spacing);
0060     qreal horizontalSpacing() const;
0061     qreal verticalSpacing() const;
0062 
0063     void removeAt(int index) override;
0064     void setGeometry(const QRectF &rect) override;
0065     int count() const override;
0066     QGraphicsLayoutItem *itemAt(int index) const override;
0067 
0068     void invalidate() override;
0069 protected:
0070     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
0071 
0072 private:
0073     Q_DISABLE_COPY(QGraphicsAnchorLayout)
0074     Q_DECLARE_PRIVATE(QGraphicsAnchorLayout)
0075 
0076     friend class QGraphicsAnchor;
0077 };
0078 
0079 QT_END_NAMESPACE
0080 
0081 #endif