| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickpositioners_p_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
| 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 https://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at https://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 3 as published by the Free Software | - | ||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
| 24 | ** | - | ||||||
| 25 | ** GNU General Public License Usage | - | ||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
| 35 | ** | - | ||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||
| 37 | ** | - | ||||||
| 38 | ****************************************************************************/ | - | ||||||
| 39 | - | |||||||
| 40 | #ifndef QQUICKPOSITIONERS_P_P_H | - | ||||||
| 41 | #define QQUICKPOSITIONERS_P_P_H | - | ||||||
| 42 | - | |||||||
| 43 | // | - | ||||||
| 44 | // W A R N I N G | - | ||||||
| 45 | // ------------- | - | ||||||
| 46 | // | - | ||||||
| 47 | // This file is not part of the Qt API. It exists purely as an | - | ||||||
| 48 | // implementation detail. This header file may change from version to | - | ||||||
| 49 | // version without notice, or even be removed. | - | ||||||
| 50 | // | - | ||||||
| 51 | // We mean it. | - | ||||||
| 52 | // | - | ||||||
| 53 | - | |||||||
| 54 | #include <QtQuick/private/qtquickglobal_p.h> | - | ||||||
| 55 | - | |||||||
| 56 | QT_REQUIRE_CONFIG(quick_positioners); | - | ||||||
| 57 | - | |||||||
| 58 | #include "qquickpositioners_p.h" | - | ||||||
| 59 | #include "qquickimplicitsizeitem_p_p.h" | - | ||||||
| 60 | - | |||||||
| 61 | #include <private/qlazilyallocated_p.h> | - | ||||||
| 62 | - | |||||||
| 63 | #include <QtCore/qobject.h> | - | ||||||
| 64 | #include <QtCore/qstring.h> | - | ||||||
| 65 | #include <QtCore/qtimer.h> | - | ||||||
| 66 | - | |||||||
| 67 | QT_BEGIN_NAMESPACE | - | ||||||
| 68 | - | |||||||
| 69 | class QQuickItemViewTransitioner; | - | ||||||
| 70 | - | |||||||
| 71 | class QQuickBasePositionerPrivate : public QQuickImplicitSizeItemPrivate, public QQuickItemChangeListener | - | ||||||
| 72 | { | - | ||||||
| 73 | Q_DECLARE_PUBLIC(QQuickBasePositioner) | - | ||||||
| 74 | - | |||||||
| 75 | public: | - | ||||||
| 76 | struct ExtraData { | - | ||||||
| 77 | ExtraData(); | - | ||||||
| 78 | - | |||||||
| 79 | qreal padding; | - | ||||||
| 80 | qreal topPadding; | - | ||||||
| 81 | qreal leftPadding; | - | ||||||
| 82 | qreal rightPadding; | - | ||||||
| 83 | qreal bottomPadding; | - | ||||||
| 84 | bool explicitTopPadding : 1; | - | ||||||
| 85 | bool explicitLeftPadding : 1; | - | ||||||
| 86 | bool explicitRightPadding : 1; | - | ||||||
| 87 | bool explicitBottomPadding : 1; | - | ||||||
| 88 | }; | - | ||||||
| 89 | QLazilyAllocated<ExtraData> extra; | - | ||||||
| 90 | - | |||||||
| 91 | QQuickBasePositionerPrivate() | - | ||||||
| 92 | : spacing(0), type(QQuickBasePositioner::None) | - | ||||||
| 93 | , transitioner(0), positioningDirty(false) | - | ||||||
| 94 | , doingPositioning(false), anchorConflict(false), layoutDirection(Qt::LeftToRight) | - | ||||||
| 95 | - | |||||||
| 96 | { | - | ||||||
| 97 | } executed 12396 times by 23 tests: end of blockExecuted by:
| 12396 | ||||||
| 98 | - | |||||||
| 99 | void init(QQuickBasePositioner::PositionerType at) | - | ||||||
| 100 | { | - | ||||||
| 101 | type = at; | - | ||||||
| 102 | } executed 12396 times by 23 tests: end of blockExecuted by:
| 12396 | ||||||
| 103 | - | |||||||
| 104 | qreal spacing; | - | ||||||
| 105 | - | |||||||
| 106 | QQuickBasePositioner::PositionerType type; | - | ||||||
| 107 | QQuickItemViewTransitioner *transitioner; | - | ||||||
| 108 | - | |||||||
| 109 | void watchChanges(QQuickItem *other); | - | ||||||
| 110 | void unwatchChanges(QQuickItem* other); | - | ||||||
| 111 | void setPositioningDirty() { | - | ||||||
| 112 | Q_Q(QQuickBasePositioner); | - | ||||||
| 113 | if (!positioningDirty) {
| 42608-51391 | ||||||
| 114 | positioningDirty = true; | - | ||||||
| 115 | q->polish(); | - | ||||||
| 116 | } executed 42608 times by 23 tests: end of blockExecuted by:
| 42608 | ||||||
| 117 | } executed 93999 times by 23 tests: end of blockExecuted by:
| 93999 | ||||||
| 118 | - | |||||||
| 119 | bool positioningDirty : 1; | - | ||||||
| 120 | bool doingPositioning : 1; | - | ||||||
| 121 | bool anchorConflict : 1; | - | ||||||
| 122 | - | |||||||
| 123 | Qt::LayoutDirection layoutDirection; | - | ||||||
| 124 | - | |||||||
| 125 | void mirrorChange() override { | - | ||||||
| 126 | effectiveLayoutDirectionChange(); | - | ||||||
| 127 | } executed 18 times by 2 tests: end of blockExecuted by:
| 18 | ||||||
| 128 | bool isLeftToRight() const { | - | ||||||
| 129 | if (type == QQuickBasePositioner::Vertical)
| 0-17426 | ||||||
| 130 | return true; never executed: return true; | 0 | ||||||
| 131 | else | - | ||||||
| 132 | return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight; executed 17426 times by 15 tests: return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight;Executed by:
| 17426 | ||||||
| 133 | } | - | ||||||
| 134 | - | |||||||
| 135 | void itemSiblingOrderChanged(QQuickItem* other) override | - | ||||||
| 136 | { | - | ||||||
| 137 | Q_UNUSED(other); | - | ||||||
| 138 | setPositioningDirty(); | - | ||||||
| 139 | } executed 2922 times by 2 tests: end of blockExecuted by:
| 2922 | ||||||
| 140 | - | |||||||
| 141 | void itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &) override | - | ||||||
| 142 | { | - | ||||||
| 143 | if (change.sizeChange())
| 48187-81357 | ||||||
| 144 | setPositioningDirty(); executed 48187 times by 8 tests: setPositioningDirty();Executed by:
| 48187 | ||||||
| 145 | } executed 129544 times by 20 tests: end of blockExecuted by:
| 129544 | ||||||
| 146 | - | |||||||
| 147 | void itemVisibilityChanged(QQuickItem *) override | - | ||||||
| 148 | { | - | ||||||
| 149 | setPositioningDirty(); | - | ||||||
| 150 | } executed 108 times by 6 tests: end of blockExecuted by:
| 108 | ||||||
| 151 | - | |||||||
| 152 | void itemDestroyed(QQuickItem *item) override | - | ||||||
| 153 | { | - | ||||||
| 154 | Q_Q(QQuickBasePositioner); | - | ||||||
| 155 | int index = q->positionedItems.find(QQuickBasePositioner::PositionedItem(item)); | - | ||||||
| 156 | if (index >= 0)
| 0 | ||||||
| 157 | q->removePositionedItem(&q->positionedItems, index); never executed: q->removePositionedItem(&q->positionedItems, index); | 0 | ||||||
| 158 | } never executed: end of block | 0 | ||||||
| 159 | - | |||||||
| 160 | static Qt::LayoutDirection getLayoutDirection(const QQuickBasePositioner *positioner) | - | ||||||
| 161 | { | - | ||||||
| 162 | return positioner->d_func()->layoutDirection; executed 2 times by 1 test: return positioner->d_func()->layoutDirection;Executed by:
| 2 | ||||||
| 163 | } | - | ||||||
| 164 | - | |||||||
| 165 | static Qt::LayoutDirection getEffectiveLayoutDirection(const QQuickBasePositioner *positioner) | - | ||||||
| 166 | { | - | ||||||
| 167 | if (positioner->d_func()->effectiveLayoutMirror)
| 170-3630 | ||||||
| 168 | return positioner->d_func()->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft; executed 170 times by 2 tests: return positioner->d_func()->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;Executed by:
| 170 | ||||||
| 169 | else | - | ||||||
| 170 | return positioner->d_func()->layoutDirection; executed 3630 times by 7 tests: return positioner->d_func()->layoutDirection;Executed by:
| 3630 | ||||||
| 171 | } | - | ||||||
| 172 | - | |||||||
| 173 | virtual void effectiveLayoutDirectionChange() | - | ||||||
| 174 | { | - | ||||||
| 175 | } | - | ||||||
| 176 | - | |||||||
| 177 | inline qreal padding() const { return extra.isAllocated() ? extra->padding : 0.0; } executed 774374 times by 23 tests: return extra.isAllocated() ? extra->padding : 0.0;Executed by:
| 774374 | ||||||
| 178 | void setTopPadding(qreal value, bool reset = false); | - | ||||||
| 179 | void setLeftPadding(qreal value, bool reset = false); | - | ||||||
| 180 | void setRightPadding(qreal value, bool reset = false); | - | ||||||
| 181 | void setBottomPadding(qreal value, bool reset = false); | - | ||||||
| 182 | }; | - | ||||||
| 183 | - | |||||||
| 184 | QT_END_NAMESPACE | - | ||||||
| 185 | - | |||||||
| 186 | #endif // QQUICKPOSITIONERS_P_P_H | - | ||||||
| Source code | Switch to Preprocessed file |