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
5
#
include
"qgraphicsgridlayoutengine_p.h"
6
7
#
include
"qgraphicslayoutitem_p.h"
8
#
include
"qgraphicslayout_p.h"
9
#
include
"qgraphicswidget.h"
10
11
QT_BEGIN_NAMESPACE
12
13
/*
14
returns \c true if the size policy returns \c true for either hasHeightForWidth()
15
or hasWidthForHeight()
16
*/
17
bool
QGraphicsGridLayoutEngineItem
::
hasDynamicConstraint
()
const
18
{
19
return
QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()
20
|| QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight();
21
}
22
23
Qt
::
Orientation
QGraphicsGridLayoutEngineItem
::
dynamicConstraintOrientation
()
const
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
*/
37
bool
QGraphicsGridLayoutEngineItem
::
isEmpty
()
const
38
{
39
return
q_layoutItem->isEmpty();
40
}
41
42
void
QGraphicsGridLayoutEngine
::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment)
43
{
44
if
(
QGraphicsGridLayoutEngineItem
*gridEngineItem = findLayoutItem(graphicsLayoutItem)) {
45
gridEngineItem->setAlignment(alignment);
46
invalidate();
47
}
48
}
49
50
Qt::Alignment
QGraphicsGridLayoutEngine
::alignment(QGraphicsLayoutItem *graphicsLayoutItem)
const
51
{
52
if
(
QGraphicsGridLayoutEngineItem
*gridEngineItem = findLayoutItem(graphicsLayoutItem))
53
return
gridEngineItem->alignment();
54
return
{ };
55
}
56
57
58
void
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
67
int
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
74
QT_END_NAMESPACE
QGraphicsGridLayoutEngineItem
Definition
qgraphicsgridlayoutengine_p.h:33
QGraphicsGridLayoutEngineItem::isEmpty
virtual bool isEmpty() const override
Definition
qgraphicsgridlayoutengine.cpp:37
QGraphicsGridLayoutEngineItem::dynamicConstraintOrientation
virtual Qt::Orientation dynamicConstraintOrientation() const override
Definition
qgraphicsgridlayoutengine.cpp:23
QGraphicsGridLayoutEngineItem::hasDynamicConstraint
virtual bool hasDynamicConstraint() const override
Definition
qgraphicsgridlayoutengine.cpp:17
QGraphicsGridLayoutEngine
Definition
qgraphicsgridlayoutengine_p.h:75
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtbase
src
widgets
graphicsview
qgraphicsgridlayoutengine.cpp
Generated on
for Qt by
1.14.0