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
5
9
11
12/*
13 returns \c true if the size policy returns \c true for either hasHeightForWidth()
14 or hasWidthForHeight()
15 */
17{
18 return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()
19 || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight();
20}
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
30/*!
31 \internal
32
33 If this returns true, the layout will arrange just as if the item was never added to the layout.
34 (Note that this shouldn't lead to a "double spacing" where the item was hidden)
35*/
37{
38 return q_layoutItem->isEmpty();
39}
40
41void QGraphicsGridLayoutEngine::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment)
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
57void QGraphicsGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch,
58 Qt::Orientation orientation)
59{
60 Q_ASSERT(stretch >= 0);
61
62 if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
63 item->setStretchFactor(stretch, orientation);
64}
65
66int QGraphicsGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const
67{
68 if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
69 return item->stretchFactor(orientation);
70 return 0;
71}
72
73QT_END_NAMESPACE
virtual bool isEmpty() const override
virtual Qt::Orientation dynamicConstraintOrientation() const override
virtual bool hasDynamicConstraint() const override
Combined button and popup list for selecting options.