44 #ifndef QT_NO_GRAPHICSVIEW 61 #define COMBINE_SIZE(result, size) \ 63 if ((result).width() < 0 || (result).height() < 0) \ 64 combineSize((result), (size)); \ 69 if (result.
width() < 0)
93 if (minimum >= 0 && maximum >= 0 && minimum > maximum)
97 if (minimum >= 0 && preferred < minimum) {
99 }
else if (maximum >= 0 && preferred > maximum) {
104 if (minimum >= 0 && descent > minimum)
112 : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0)
192 const bool hasConstraint = constraint.
width() >= 0 || constraint.
height() >= 0;
193 QSizeF adjustedConstraint = constraint;
200 if (adjustedConstraint.
width() >= 0)
202 adjustedConstraint.
width(),
204 if (adjustedConstraint.
height() >= 0)
206 adjustedConstraint.
height(),
219 sizeHintCache[i] = adjustedConstraint;
259 return sizeHintCache;
287 while (parent && parent->
isLayout()) {
323 }
else if (size.
width() < 0 && size.
height() < 0) {
348 if (value == userValue)
360 for (
int i = l->
count() - 1; i >= 0; --i) {
365 if (item->isWidget()) {
372 return q->sizePolicy().hasHeightForWidth();
380 for (
int i = l->
count() - 1; i >= 0; --i) {
385 if (item->isWidget()) {
392 return q->sizePolicy().hasWidthForHeight();
499 if (parentLI && parentLI->
isLayout()) {
502 for (
int i = lay->
count() - 1; i >= 0; --i) {
503 if (lay->
itemAt(i) ==
this) {
542 if (
d->sizePolicy == policy)
544 d->sizePolicy = policy;
574 return d->sizePolicy;
929 if (!
d->userSizeHints && constraint.
isValid())
947 d->sizeHintCacheDirty =
true;
948 d->sizeHintWithConstraintCacheDirty =
true;
961 return d_func()->parent;
971 d_func()->parent = parent;
983 return d_func()->isLayout;
1015 return d_func()->ownedByLayout;
1029 d_func()->ownedByLayout = ownership;
1041 return d_func()->graphicsItem;
1056 d_func()->graphicsItem = item;
1061 #endif //QT_NO_GRAPHICSVIEW virtual void removeAt(int index)=0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to remove the item ...
virtual ~QGraphicsLayoutItem()
Destroys the QGraphicsLayoutItem object.
QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
Returns the effective size hint for this QGraphicsLayoutItem.
void setPreferredHeight(qreal height)
Sets the preferred height to height.
virtual void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
static QGraphicsLayoutItemPrivate * get(QGraphicsLayoutItem *q)
QSizeF cachedSizeHints[Qt::NSizeHints]
#define COMBINE_SIZE(result, size)
#define QT_END_NAMESPACE
This macro expands to.
QScopedPointer< QGraphicsLayoutItemPrivate > d_ptr
virtual ~QGraphicsLayoutItemPrivate()
void setMaximumHeight(qreal height)
Sets the maximum height to height.
QSizeF * effectiveSizeHints(const QSizeF &constraint) const
QGraphicsItem * graphicsItem() const
Returns the QGraphicsItem that this layout item represents.
qreal width() const
Returns the width.
QRectF contentsRect() const
Returns the contents rect in local coordinates.
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
qreal height() const
Returns the height.
bool hasHeightForWidth() const
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
void setParentLayoutItem(QGraphicsLayoutItem *parent)
Sets the parent of this QGraphicsLayoutItem to parent.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
void setWidth(qreal w)
Sets the width to the given width.
static void normalizeHints(qreal &minimum, qreal &preferred, qreal &maximum, qreal &descent)
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
QRectF geometry() const
Returns the item's geometry (e.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const
This virtual function provides the left, top, right and bottom contents margins for this QGraphicsLay...
void setMaximumWidth(qreal width)
Sets the maximum width to width.
virtual void updateGeometry()
This virtual function discards any cached size hint information.
QSizeF preferredSize() const
Returns the preferred size.
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts...
void setPreferredSize(const QSizeF &size)
Sets the preferred size to size.
static qreal component(const QPointF &point, unsigned int i)
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
bool ownedByLayout() const
Returns whether a layout should delete this item in its destructor.
QGraphicsItem * parentItem() const
Returns the parent item of this layout, or 0 if this layout is not installed on any widget...
QSizeF maximumSize() const
Returns the maximum size.
QSizeF minimumSize() const
Returns the minimum size.
bool isLayout() const
Returns true if this QGraphicsLayoutItem is a layout (e.g., is inherited by an object that arranges o...
virtual int count() const =0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to return the numbe...
void setOwnedByLayout(bool ownedByLayout)
Sets whether a layout should delete this item in its destructor or not.
QGraphicsLayoutItem(QGraphicsLayoutItem *parent=0, bool isLayout=false)
Constructs the QGraphicsLayoutItem object.
static void expandSize(QSizeF &result, const QSizeF &size)
bool hasWidthForHeight() const
QSizeF boundedTo(const QSizeF &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
QSizeF expandedTo(const QSizeF &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
void setMinimumHeight(qreal height)
Sets the minimum height to height.
QGraphicsLayoutItem * parentLayoutItem() const
Returns the parent of this QGraphicsLayoutItem, or 0 if there is no parent, or if the parent does not...
QSizePolicy sizePolicy() const
Returns the current size policy.
void setMinimumWidth(qreal width)
Sets the minimum width to width.
void setPreferredWidth(qreal width)
Sets the preferred width to width.
static void boundSize(QSizeF &result, const QSizeF &size)
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
QSizeF cachedSizeHintsWithConstraints[Qt::NSizeHints]
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value)
Sets the width of the user size hint which to width.
QSizeF size() const
Returns the size of the rectangle.
void setSizePolicy(const QSizePolicy &policy)
Sets the size policy to policy.
static void combineSize(QSizeF &result, const QSizeF &size)
void setHeight(qreal h)
Sets the height to the given height.
void setGraphicsItem(QGraphicsItem *item)
If the QGraphicsLayoutItem represents a QGraphicsItem, and it wants to take advantage of the automati...
virtual QGraphicsLayoutItem * itemAt(int i) const =0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to return a pointer...
void ensureUserSizeHints()
Ensures that userSizeHints is allocated.
qreal & rheight()
Returns a reference to the height.
void setMinimumSize(const QSizeF &size)
Sets the minimum size to size.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
qreal & rwidth()
Returns a reference to the width.
QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout)
quint32 sizeHintWithConstraintCacheDirty
void setSize(Qt::SizeHint which, const QSizeF &size)
Sets the user size hint which to size.
void setMaximumSize(const QSizeF &size)
Sets the maximum size to size.
QGraphicsLayoutItem * parent
quint32 sizeHintCacheDirty