Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgraphicsgridlayoutengine.cpp
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
5
7#include "qgraphicslayout_p.h"
8#include "qgraphicswidget.h"
9
11
12/*
13 returns \c true if the size policy returns \c true for either hasHeightForWidth()
14 or hasWidthForHeight()
15 */
21
23{
24 if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth())
25 return Qt::Vertical;
26 else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight())
27 return Qt::Horizontal;
28}
29
40
42{
43 if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem)) {
44 gridEngineItem->setAlignment(alignment);
45 invalidate();
46 }
47}
48
49Qt::Alignment QGraphicsGridLayoutEngine::alignment(QGraphicsLayoutItem *graphicsLayoutItem) const
50{
51 if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem))
52 return gridEngineItem->alignment();
53 return { };
54}
55
56
58 Qt::Orientation orientation)
59{
60 Q_ASSERT(stretch >= 0);
61
63 item->setStretchFactor(stretch, orientation);
64}
65
67{
69 return item->stretchFactor(orientation);
70 return 0;
71}
72
virtual bool isEmpty() const override
virtual Qt::Orientation dynamicConstraintOrientation() const override
virtual bool hasDynamicConstraint() const override
QGraphicsGridLayoutEngineItem * findLayoutItem(QGraphicsLayoutItem *layoutItem) const
void setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, Qt::Orientation orientation)
int stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const
void setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment)
Qt::Alignment alignment(QGraphicsLayoutItem *graphicsLayoutItem) const
static QGraphicsLayoutItemPrivate * get(QGraphicsLayoutItem *q)
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
virtual bool isEmpty() const
uint alignment
Combined button and popup list for selecting options.
Orientation
Definition qnamespace.h:98
@ Horizontal
Definition qnamespace.h:99
@ Vertical
Definition qnamespace.h:100
static void layoutItem(QQuickItem *item, qreal y, qreal width)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QGraphicsItem * item