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
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// Qt-Security score:significant reason:default
4
6
10
12
13/*
14 returns \c true if the size policy returns \c true for either hasHeightForWidth()
15 or hasWidthForHeight()
16 */
18{
19 return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()
20 || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight();
21}
22
24{
25 if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth())
26 return Qt::Vertical;
27 else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight())
28 return Qt::Horizontal;
29}
30
31/*!
32 \internal
33
34 If this returns true, the layout will arrange just as if the item was never added to the layout.
35 (Note that this shouldn't lead to a "double spacing" where the item was hidden)
36*/
38{
39 return q_layoutItem->isEmpty();
40}
41
42void QGraphicsGridLayoutEngine::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment)
43{
44 if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem)) {
45 gridEngineItem->setAlignment(alignment);
46 invalidate();
47 }
48}
49
50Qt::Alignment QGraphicsGridLayoutEngine::alignment(QGraphicsLayoutItem *graphicsLayoutItem) const
51{
52 if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem))
53 return gridEngineItem->alignment();
54 return { };
55}
56
57
58void QGraphicsGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch,
59 Qt::Orientation orientation)
60{
61 Q_ASSERT(stretch >= 0);
62
63 if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
64 item->setStretchFactor(stretch, orientation);
65}
66
67int QGraphicsGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const
68{
69 if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
70 return item->stretchFactor(orientation);
71 return 0;
72}
73
74QT_END_NAMESPACE
virtual bool isEmpty() const override
virtual Qt::Orientation dynamicConstraintOrientation() const override
virtual bool hasDynamicConstraint() const override