Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
25 | ** | - | ||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
29 | ** | - | ||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||
31 | ** | - | ||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||
33 | - | |||||||||||||
34 | #include "qgraphicsgridlayoutengine_p.h" | - | ||||||||||||
35 | - | |||||||||||||
36 | #ifndef QT_NO_GRAPHICSVIEW | - | ||||||||||||
37 | - | |||||||||||||
38 | #include "qgraphicslayoutitem_p.h" | - | ||||||||||||
39 | #include "qgraphicslayout_p.h" | - | ||||||||||||
40 | #include "qgraphicswidget.h" | - | ||||||||||||
41 | #include <private/qgraphicswidget_p.h> | - | ||||||||||||
42 | - | |||||||||||||
43 | QT_BEGIN_NAMESPACE | - | ||||||||||||
44 | - | |||||||||||||
45 | bool QGraphicsGridLayoutEngineItem::isHidden() const | - | ||||||||||||
46 | { | - | ||||||||||||
47 | if (QGraphicsItem *item = q_layoutItem->graphicsItem())
| 0 | ||||||||||||
48 | return QGraphicsItemPrivate::get(item)->explicitlyHidden; never executed: return QGraphicsItemPrivate::get(item)->explicitlyHidden; | 0 | ||||||||||||
49 | return false; never executed: return false; | 0 | ||||||||||||
50 | } | - | ||||||||||||
51 | - | |||||||||||||
52 | /*! | - | ||||||||||||
53 | \internal | - | ||||||||||||
54 | - | |||||||||||||
55 | If this returns true, the layout will arrange just as if the item was never added to the layout. | - | ||||||||||||
56 | (Note that this shouldn't lead to a "double spacing" where the item was hidden) | - | ||||||||||||
57 | ### Qt6: Move to QGraphicsLayoutItem and make virtual | - | ||||||||||||
58 | */ | - | ||||||||||||
59 | bool QGraphicsGridLayoutEngineItem::isIgnored() const | - | ||||||||||||
60 | { | - | ||||||||||||
61 | return isHidden() && !q_layoutItem->sizePolicy().retainSizeWhenHidden(); never executed: return isHidden() && !q_layoutItem->sizePolicy().retainSizeWhenHidden();
| 0 | ||||||||||||
62 | } | - | ||||||||||||
63 | - | |||||||||||||
64 | /* | - | ||||||||||||
65 | returns \c true if the size policy returns \c true for either hasHeightForWidth() | - | ||||||||||||
66 | or hasWidthForHeight() | - | ||||||||||||
67 | */ | - | ||||||||||||
68 | bool QGraphicsGridLayoutEngineItem::hasDynamicConstraint() const | - | ||||||||||||
69 | { | - | ||||||||||||
70 | return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() never executed: return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight();
| 0 | ||||||||||||
71 | || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); never executed: return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight();
| 0 | ||||||||||||
72 | } | - | ||||||||||||
73 | - | |||||||||||||
74 | Qt::Orientation QGraphicsGridLayoutEngineItem::dynamicConstraintOrientation() const | - | ||||||||||||
75 | { | - | ||||||||||||
76 | if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth())
| 0 | ||||||||||||
77 | return Qt::Vertical; never executed: return Qt::Vertical; | 0 | ||||||||||||
78 | else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) | - | ||||||||||||
79 | return Qt::Horizontal; never executed: return Qt::Horizontal; | 0 | ||||||||||||
80 | } | - | ||||||||||||
81 | - | |||||||||||||
82 | - | |||||||||||||
83 | void QGraphicsGridLayoutEngine::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment) | - | ||||||||||||
84 | { | - | ||||||||||||
85 | if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem)) {
| 0 | ||||||||||||
86 | gridEngineItem->setAlignment(alignment); | - | ||||||||||||
87 | invalidate(); | - | ||||||||||||
88 | } never executed: end of block | 0 | ||||||||||||
89 | } never executed: end of block | 0 | ||||||||||||
90 | - | |||||||||||||
91 | Qt::Alignment QGraphicsGridLayoutEngine::alignment(QGraphicsLayoutItem *graphicsLayoutItem) const | - | ||||||||||||
92 | { | - | ||||||||||||
93 | if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem))
| 0 | ||||||||||||
94 | return gridEngineItem->alignment(); never executed: return gridEngineItem->alignment(); | 0 | ||||||||||||
95 | return 0; never executed: return 0; | 0 | ||||||||||||
96 | } | - | ||||||||||||
97 | - | |||||||||||||
98 | - | |||||||||||||
99 | void QGraphicsGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, | - | ||||||||||||
100 | Qt::Orientation orientation) | - | ||||||||||||
101 | { | - | ||||||||||||
102 | Q_ASSERT(stretch >= 0); | - | ||||||||||||
103 | - | |||||||||||||
104 | if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
| 0 | ||||||||||||
105 | item->setStretchFactor(stretch, orientation); never executed: item->setStretchFactor(stretch, orientation); | 0 | ||||||||||||
106 | } never executed: end of block | 0 | ||||||||||||
107 | - | |||||||||||||
108 | int QGraphicsGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const | - | ||||||||||||
109 | { | - | ||||||||||||
110 | if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem))
| 0 | ||||||||||||
111 | return item->stretchFactor(orientation); never executed: return item->stretchFactor(orientation); | 0 | ||||||||||||
112 | return 0; never executed: return 0; | 0 | ||||||||||||
113 | } | - | ||||||||||||
114 | - | |||||||||||||
115 | - | |||||||||||||
116 | QT_END_NAMESPACE | - | ||||||||||||
117 | - | |||||||||||||
118 | #endif // QT_NO_GRAPHICSVIEW | - | ||||||||||||
Source code | Switch to Preprocessed file |