Back to home page

EIC code displayed by LXR

 
 

    


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

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 QGRAPHICSLAYOUTITEM_H
0005 #define QGRAPHICSLAYOUTITEM_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qscopedpointer.h>
0009 #include <QtWidgets/qsizepolicy.h>
0010 #include <QtGui/qevent.h>
0011 
0012 QT_REQUIRE_CONFIG(graphicsview);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QGraphicsLayoutItemPrivate;
0017 class QGraphicsItem;
0018 class Q_WIDGETS_EXPORT QGraphicsLayoutItem
0019 {
0020 public:
0021     QGraphicsLayoutItem(QGraphicsLayoutItem *parent = nullptr, bool isLayout = false);
0022     virtual ~QGraphicsLayoutItem();
0023 
0024     void setSizePolicy(const QSizePolicy &policy);
0025     void setSizePolicy(QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy, QSizePolicy::ControlType controlType = QSizePolicy::DefaultType);
0026     QSizePolicy sizePolicy() const;
0027 
0028     void setMinimumSize(const QSizeF &size);
0029     inline void setMinimumSize(qreal w, qreal h);
0030     QSizeF minimumSize() const;
0031     void setMinimumWidth(qreal width);
0032     inline qreal minimumWidth() const;
0033     void setMinimumHeight(qreal height);
0034     inline qreal minimumHeight() const;
0035 
0036     void setPreferredSize(const QSizeF &size);
0037     inline void setPreferredSize(qreal w, qreal h);
0038     QSizeF preferredSize() const;
0039     void setPreferredWidth(qreal width);
0040     inline qreal preferredWidth() const;
0041     void setPreferredHeight(qreal height);
0042     inline qreal preferredHeight() const;
0043 
0044     void setMaximumSize(const QSizeF &size);
0045     inline void setMaximumSize(qreal w, qreal h);
0046     QSizeF maximumSize() const;
0047     void setMaximumWidth(qreal width);
0048     inline qreal maximumWidth() const;
0049     void setMaximumHeight(qreal height);
0050     inline qreal maximumHeight() const;
0051 
0052     virtual void setGeometry(const QRectF &rect);
0053     QRectF geometry() const;
0054     virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
0055     QRectF contentsRect() const;
0056 
0057     QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
0058 
0059     virtual void updateGeometry();
0060 
0061     virtual bool isEmpty() const;
0062     QGraphicsLayoutItem *parentLayoutItem() const;
0063     void setParentLayoutItem(QGraphicsLayoutItem *parent);
0064 
0065     bool isLayout() const;
0066     QGraphicsItem *graphicsItem() const;
0067     bool ownedByLayout() const;
0068 
0069 protected:
0070     void setGraphicsItem(QGraphicsItem *item);
0071     void setOwnedByLayout(bool ownedByLayout);
0072     QGraphicsLayoutItem(QGraphicsLayoutItemPrivate &dd);
0073 
0074     virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const = 0;
0075     QScopedPointer<QGraphicsLayoutItemPrivate> d_ptr;
0076 
0077 private:
0078     QSizeF *effectiveSizeHints(const QSizeF &constraint) const;
0079     Q_DECLARE_PRIVATE(QGraphicsLayoutItem)
0080 
0081     friend class QGraphicsLayout;
0082 };
0083 
0084 #ifndef Q_QDOC
0085 Q_DECLARE_INTERFACE(QGraphicsLayoutItem, "org.qt-project.Qt.QGraphicsLayoutItem")
0086 #endif
0087 
0088 inline void QGraphicsLayoutItem::setMinimumSize(qreal aw, qreal ah)
0089 { setMinimumSize(QSizeF(aw, ah)); }
0090 inline void QGraphicsLayoutItem::setPreferredSize(qreal aw, qreal ah)
0091 { setPreferredSize(QSizeF(aw, ah)); }
0092 inline void QGraphicsLayoutItem::setMaximumSize(qreal aw, qreal ah)
0093 { setMaximumSize(QSizeF(aw, ah)); }
0094 
0095 inline qreal QGraphicsLayoutItem::minimumWidth() const
0096 { return effectiveSizeHint(Qt::MinimumSize).width(); }
0097 inline qreal QGraphicsLayoutItem::minimumHeight() const
0098 { return effectiveSizeHint(Qt::MinimumSize).height(); }
0099 
0100 inline qreal QGraphicsLayoutItem::preferredWidth() const
0101 { return effectiveSizeHint(Qt::PreferredSize).width(); }
0102 inline qreal QGraphicsLayoutItem::preferredHeight() const
0103 { return effectiveSizeHint(Qt::PreferredSize).height(); }
0104 
0105 inline qreal QGraphicsLayoutItem::maximumWidth() const
0106 { return effectiveSizeHint(Qt::MaximumSize).width(); }
0107 inline qreal QGraphicsLayoutItem::maximumHeight() const
0108 { return effectiveSizeHint(Qt::MaximumSize).height(); }
0109 
0110 QT_END_NAMESPACE
0111 
0112 #endif