| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktext_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 QQUICKTEXT_P_P_H | - |
| 41 | #define QQUICKTEXT_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 "qquicktext_p.h" | - |
| 55 | #include "qquickimplicitsizeitem_p_p.h" | - |
| 56 | - | |
| 57 | #include <QtQml/qqml.h> | - |
| 58 | #include <QtGui/qabstracttextdocumentlayout.h> | - |
| 59 | #include <QtGui/qtextlayout.h> | - |
| 60 | #include <private/qquickstyledtext_p.h> | - |
| 61 | #include <private/qlazilyallocated_p.h> | - |
| 62 | - | |
| 63 | QT_BEGIN_NAMESPACE | - |
| 64 | - | |
| 65 | class QTextLayout; | - |
| 66 | class QQuickTextDocumentWithImageResources; | - |
| 67 | - | |
| 68 | class Q_QUICK_PRIVATE_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate | - |
| 69 | { | - |
| 70 | Q_DECLARE_PUBLIC(QQuickText) | - |
| 71 | public: | - |
| 72 | QQuickTextPrivate(); | - |
| 73 | ~QQuickTextPrivate(); | - |
| 74 | void init(); | - |
| 75 | - | |
| 76 | void updateBaseline(qreal baseline, qreal dy); | - |
| 77 | void updateSize(); | - |
| 78 | void updateLayout(); | - |
| 79 | bool determineHorizontalAlignment(); | - |
| 80 | bool setHAlign(QQuickText::HAlignment, bool forceAlign = false); | - |
| 81 | void mirrorChange() override; | - |
| 82 | bool isLineLaidOutConnected(); | - |
| 83 | void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); | - |
| 84 | - | |
| 85 | int lineHeightOffset() const; | - |
| 86 | QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = nullptr) const; | - |
| 87 | void elideFormats(int start, int length, int offset, QVector<QTextLayout::FormatRange> *elidedFormats); | - |
| 88 | void clearFormats(); | - |
| 89 | - | |
| 90 | void processHoverEvent(QHoverEvent *event); | - |
| 91 | - | |
| 92 | QRectF layedOutTextRect; | - |
| 93 | QSizeF advance; | - |
| 94 | - | |
| 95 | struct ExtraData { | - |
| 96 | ExtraData(); | - |
| 97 | - | |
| 98 | qreal padding; | - |
| 99 | qreal topPadding; | - |
| 100 | qreal leftPadding; | - |
| 101 | qreal rightPadding; | - |
| 102 | qreal bottomPadding; | - |
| 103 | bool explicitTopPadding : 1; | - |
| 104 | bool explicitLeftPadding : 1; | - |
| 105 | bool explicitRightPadding : 1; | - |
| 106 | bool explicitBottomPadding : 1; | - |
| 107 | qreal lineHeight; | - |
| 108 | QQuickTextDocumentWithImageResources *doc; | - |
| 109 | QString activeLink; | - |
| 110 | QString hoveredLink; | - |
| 111 | int minimumPixelSize; | - |
| 112 | int minimumPointSize; | - |
| 113 | int nbActiveDownloads; | - |
| 114 | int maximumLineCount; | - |
| 115 | bool lineHeightValid : 1; | - |
| 116 | QQuickText::LineHeightMode lineHeightMode; | - |
| 117 | QQuickText::FontSizeMode fontSizeMode; | - |
| 118 | QList<QQuickStyledTextImgTag*> imgTags; | - |
| 119 | QList<QQuickStyledTextImgTag*> visibleImgTags; | - |
| 120 | QUrl baseUrl; | - |
| 121 | }; | - |
| 122 | QLazilyAllocated<ExtraData> extra; | - |
| 123 | - | |
| 124 | QString text; | - |
| 125 | QFont font; | - |
| 126 | QFont sourceFont; | - |
| 127 | QFontInfo fontInfo; | - |
| 128 | - | |
| 129 | QTextLayout layout; | - |
| 130 | QTextLayout *elideLayout; | - |
| 131 | QQuickTextLine *textLine; | - |
| 132 | - | |
| 133 | qreal lineWidth; | - |
| 134 | - | |
| 135 | QRgb color; | - |
| 136 | QRgb linkColor; | - |
| 137 | QRgb styleColor; | - |
| 138 | - | |
| 139 | int lineCount; | - |
| 140 | int multilengthEos; | - |
| 141 | - | |
| 142 | enum UpdateType { | - |
| 143 | UpdateNone, | - |
| 144 | UpdatePreprocess, | - |
| 145 | UpdatePaintNode | - |
| 146 | }; | - |
| 147 | - | |
| 148 | QQuickText::TextElideMode elideMode; | - |
| 149 | QQuickText::HAlignment hAlign; | - |
| 150 | QQuickText::VAlignment vAlign; | - |
| 151 | QQuickText::TextFormat format; | - |
| 152 | QQuickText::WrapMode wrapMode; | - |
| 153 | QQuickText::TextStyle style; | - |
| 154 | QQuickText::RenderType renderType; | - |
| 155 | UpdateType updateType; | - |
| 156 | - | |
| 157 | QString assignedFont; | - |
| 158 | - | |
| 159 | bool maximumLineCountValid:1; | - |
| 160 | bool updateOnComponentComplete:1; | - |
| 161 | bool richText:1; | - |
| 162 | bool styledText:1; | - |
| 163 | bool widthExceeded:1; | - |
| 164 | bool heightExceeded:1; | - |
| 165 | bool internalWidthUpdate:1; | - |
| 166 | bool requireImplicitSize:1; | - |
| 167 | bool implicitWidthValid:1; | - |
| 168 | bool implicitHeightValid:1; | - |
| 169 | bool truncated:1; | - |
| 170 | bool hAlignImplicit:1; | - |
| 171 | bool rightToLeftText:1; | - |
| 172 | bool layoutTextElided:1; | - |
| 173 | bool textHasChanged:1; | - |
| 174 | bool needToUpdateLayout:1; | - |
| 175 | bool formatModifiesFontSize:1; | - |
| 176 | bool polishSize:1; // Workaround for problem with polish called after updateSize (QTBUG-42636) | - |
| 177 | bool updateSizeRecursionGuard:1; | - |
| 178 | - | |
| 179 | static const QChar elideChar; | - |
| 180 | - | |
| 181 | qreal getImplicitWidth() const override; | - |
| 182 | qreal getImplicitHeight() const override; | - |
| 183 | - | |
| 184 | qreal availableWidth() const; | - |
| 185 | qreal availableHeight() const; | - |
| 186 | - | |
| 187 | inline qreal padding() const { return extra.isAllocated() ? extra->padding : 0.0; } executed 8953785 times by 35 tests: return extra.isAllocated() ? extra->padding : 0.0;Executed by:
| 8953785 |
| 188 | void setTopPadding(qreal value, bool reset = false); | - |
| 189 | void setLeftPadding(qreal value, bool reset = false); | - |
| 190 | void setRightPadding(qreal value, bool reset = false); | - |
| 191 | void setBottomPadding(qreal value, bool reset = false); | - |
| 192 | - | |
| 193 | void ensureDoc(); | - |
| 194 | - | |
| 195 | QRectF setupTextLayout(qreal * const baseline); | - |
| 196 | void setupCustomLineGeometry(QTextLine &line, qreal &height, int lineOffset = 0); | - |
| 197 | bool isLinkActivatedConnected(); | - |
| 198 | bool isLinkHoveredConnected(); | - |
| 199 | static QString anchorAt(const QTextLayout *layout, const QPointF &mousePos); | - |
| 200 | QString anchorAt(const QPointF &pos) const; | - |
| 201 | - | |
| 202 | inline qreal lineHeight() const { return extra.isAllocated() ? extra->lineHeight : 1.0; } executed 731283 times by 35 tests: return extra.isAllocated() ? extra->lineHeight : 1.0;Executed by:
| 731283 |
| 203 | inline int maximumLineCount() const { return extra.isAllocated() ? extra->maximumLineCount : INT_MAX; } executed 426216 times by 33 tests: return extra.isAllocated() ? extra->maximumLineCount : 0x7fffffff;Executed by:
| 426216 |
| 204 | inline QQuickText::LineHeightMode lineHeightMode() const { return extra.isAllocated() ? extra->lineHeightMode : QQuickText::ProportionalHeight; } executed 730939 times by 35 tests: return extra.isAllocated() ? extra->lineHeightMode : QQuickText::ProportionalHeight;Executed by:
| 730939 |
| 205 | inline QQuickText::FontSizeMode fontSizeMode() const { return extra.isAllocated() ? extra->fontSizeMode : QQuickText::FixedSize; } executed 2941837 times by 35 tests: return extra.isAllocated() ? extra->fontSizeMode : QQuickText::FixedSize;Executed by:
| 2941837 |
| 206 | inline int minimumPixelSize() const { return extra.isAllocated() ? extra->minimumPixelSize : 12; } executed 290 times by 2 tests: return extra.isAllocated() ? extra->minimumPixelSize : 12;Executed by:
| 290 |
| 207 | inline int minimumPointSize() const { return extra.isAllocated() ? extra->minimumPointSize : 12; } executed 48 times by 2 tests: return extra.isAllocated() ? extra->minimumPointSize : 12;Executed by:
| 48 |
| 208 | static inline QQuickTextPrivate *get(QQuickText *t) { return t->d_func(); } executed 66 times by 1 test: return t->d_func();Executed by:
| 66 |
| 209 | }; | - |
| 210 | - | |
| 211 | QT_END_NAMESPACE | - |
| 212 | - | |
| 213 | #endif // QQUICKTEXT_P_P_H | - |
| Source code | Switch to Preprocessed file |