OpenCoverage

qquicktableview_p_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktableview_p_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5extern const QLoggingCategory &lcTableViewDelegateLifecycle();-
6-
7static const int kDefaultCacheBuffer = 300;-
8static const qreal kDefaultRowHeight = 50;-
9static const qreal kDefaultColumnWidth = 50;-
10-
11class FxTableItem;-
12-
13class __attribute__((visibility("default"))) QQuickTableViewPrivate : public QQuickFlickablePrivate-
14{-
15 inline QQuickTableView* q_func() { return static_cast<QQuickTableView *>(q_ptr); } inline const QQuickTableView* q_func() const { return static_cast<const QQuickTableView *>(q_ptr); } friend class QQuickTableView;-
16-
17public:-
18 class TableEdgeLoadRequest-
19 {-
20-
21-
22-
23-
24-
25-
26-
27 public:-
28 void begin(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode)-
29 {-
30 ((!active) ? static_cast<void>(0) : qt_assert("!active", __FILE__, 89));-
31 active = true;-
32 tableEdge = Qt::Edge(0);-
33 tableCells = QLine(cell, cell);-
34 mode = incubationMode;-
35 cellCount = 1;-
36 currentIndex = 0;-
37 for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 96, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "begin top-left:" << toString();
never executed: QMessageLogger(__FILE__, 96, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "begin top-left:" << toString();
0
38 }
never executed: end of block
0
39-
40 void begin(const QLine cellsToLoad, Qt::Edge edgeToLoad, QQmlIncubator::IncubationMode incubationMode)-
41 {-
42 ((!active) ? static_cast<void>(0) : qt_assert("!active", __FILE__, 101));-
43 active = true;-
44 tableEdge = edgeToLoad;-
45 tableCells = cellsToLoad;-
46 mode = incubationMode;-
47 cellCount = tableCells.x2() - tableCells.x1() + tableCells.y2() - tableCells.y1() + 1;-
48 currentIndex = 0;-
49 for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 108, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "begin:" << toString();
never executed: QMessageLogger(__FILE__, 108, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "begin:" << toString();
0
50 }
never executed: end of block
0
51-
52 inline void markAsDone() { active = false; }
never executed: end of block
0
53 inline bool isActive() { return
executed 816 times by 1 test: return active;
Executed by:
  • tst_qquicktableview
active;
executed 816 times by 1 test: return active;
Executed by:
  • tst_qquicktableview
}
816
54-
55 inline QPoint firstCell() { return
never executed: return tableCells.p1();
tableCells.p1();
never executed: return tableCells.p1();
}
0
56 inline QPoint lastCell() { return
never executed: return tableCells.p2();
tableCells.p2();
never executed: return tableCells.p2();
}
0
57 inline QPoint currentCell() { return
never executed: return cellAt(currentIndex);
cellAt(currentIndex);
never executed: return cellAt(currentIndex);
}
0
58 inline QPoint previousCell() { return
never executed: return cellAt(currentIndex - 1);
cellAt(currentIndex - 1);
never executed: return cellAt(currentIndex - 1);
}
0
59-
60 inline bool atBeginning() { return
never executed: return currentIndex == 0;
currentIndex == 0;
never executed: return currentIndex == 0;
}
0
61 inline bool hasCurrentCell() { return
never executed: return currentIndex < cellCount;
currentIndex < cellCount;
never executed: return currentIndex < cellCount;
}
0
62 inline void moveToNextCell() { ++currentIndex; }
never executed: end of block
0
63-
64 inline Qt::Edge edge() { return
never executed: return tableEdge;
tableEdge;
never executed: return tableEdge;
}
0
65 inline QQmlIncubator::IncubationMode incubationMode() { return
never executed: return mode;
mode;
never executed: return mode;
}
0
66-
67 QString toString()-
68 {-
69 QString str;-
70 QDebug dbg(&str);-
71 dbg.nospace() << "TableSectionLoadRequest(" << "edge:"-
72 << tableEdge << " cells:" << tableCells << " incubation:";-
73-
74 switch (mode) {-
75 case
never executed: case QQmlIncubator::Asynchronous:
QQmlIncubator::Asynchronous:
never executed: case QQmlIncubator::Asynchronous:
0
76 dbg << "Asynchronous";-
77 break;
never executed: break;
0
78 case
never executed: case QQmlIncubator::AsynchronousIfNested:
QQmlIncubator::AsynchronousIfNested:
never executed: case QQmlIncubator::AsynchronousIfNested:
0
79 dbg << "AsynchronousIfNested";-
80 break;
never executed: break;
0
81 case
never executed: case QQmlIncubator::Synchronous:
QQmlIncubator::Synchronous:
never executed: case QQmlIncubator::Synchronous:
0
82 dbg << "Synchronous";-
83 break;
never executed: break;
0
84 }-
85-
86 return
never executed: return str;
str;
never executed: return str;
0
87 }-
88-
89 private:-
90 Qt::Edge tableEdge = Qt::Edge(0);-
91 QLine tableCells;-
92 int currentIndex = 0;-
93 int cellCount = 0;-
94 bool active = false;-
95 QQmlIncubator::IncubationMode mode = QQmlIncubator::AsynchronousIfNested;-
96-
97 QPoint cellAt(int index)-
98 {-
99 int x = tableCells.p1().x() + (tableCells.dx()
tableCells.dx()Description
TRUEnever evaluated
FALSEnever evaluated
? index : 0);
0
100 int y = tableCells.p1().y() + (tableCells.dy()
tableCells.dy()Description
TRUEnever evaluated
FALSEnever evaluated
? index : 0);
0
101 return
never executed: return QPoint(x, y);
QPoint(x, y);
never executed: return QPoint(x, y);
0
102 }-
103 };-
104-
105 struct ColumnRowSize-
106 {-
107 int index;-
108 qreal size;-
109-
110 static bool lessThan(const ColumnRowSize& a, const ColumnRowSize& b)-
111 {-
112 return
never executed: return a.index < b.index;
a.index < b.index;
never executed: return a.index < b.index;
0
113 }-
114 };-
115-
116public:-
117 QQuickTableViewPrivate();-
118 ~QQuickTableViewPrivate() override;-
119-
120 static inline QQuickTableViewPrivate *get(QQuickTableView *q) { return
never executed: return q->d_func();
q->d_func();
never executed: return q->d_func();
}
0
121-
122 void updatePolish() override;-
123-
124public:-
125 QHash<int, FxTableItem *> loadedItems;-
126-
127-
128-
129-
130-
131 QQmlInstanceModel* model = nullptr;-
132 QPointer<QQmlDelegateModel> delegateModel = nullptr;-
133 QVariant modelVariant;-
134-
135-
136-
137-
138-
139-
140-
141 QRect loadedTable;-
142 QRectF loadedTableOuterRect;-
143 QRectF loadedTableInnerRect;-
144-
145 QRectF viewportRect = QRectF(0, 0, -1, -1);-
146-
147 QSize tableSize;-
148-
149 TableEdgeLoadRequest loadRequest;-
150-
151 QPoint contentSizeBenchMarkPoint = QPoint(-1, -1);-
152 QSizeF cellSpacing;-
153 QMarginsF tableMargins;-
154-
155 int cacheBuffer = kDefaultCacheBuffer;-
156 QTimer cacheBufferDelayTimer;-
157 bool hasBufferedItems = false;-
158-
159 bool blockItemCreatedCallback = false;-
160 bool tableInvalid = false;-
161 bool tableRebuilding = false;-
162 bool columnRowPositionsInvalid = false;-
163-
164 QVector<ColumnRowSize> columnWidths;-
165 QVector<ColumnRowSize> rowHeights;-
166-
167 const static QPoint kLeft;-
168 const static QPoint kRight;-
169 const static QPoint kUp;-
170 const static QPoint kDown;-
171-
172-
173 QString forcedIncubationMode = qEnvironmentVariable("QT_TABLEVIEW_INCUBATION_MODE");-
174-
175-
176public:-
177 QQuickTableViewAttached *getAttachedObject(const QObject *object) const;-
178-
179 int modelIndexAtCell(const QPoint &cell) const;-
180 QPoint cellAtModelIndex(int modelIndex) const;-
181-
182 void calculateColumnWidthsAfterRebuilding();-
183 void calculateRowHeightsAfterRebuilding();-
184 void calculateColumnWidth(int column);-
185 void calculateRowHeight(int row);-
186 void calculateEdgeSizeFromLoadRequest();-
187 void calculateTableSize();-
188-
189 qreal columnWidth(int column);-
190 qreal rowHeight(int row);-
191-
192 void relayoutTable();-
193 void relayoutTableItems();-
194-
195 void layoutVerticalEdge(Qt::Edge tableEdge);-
196 void layoutHorizontalEdge(Qt::Edge tableEdge);-
197 void layoutTopLeftItem();-
198 void layoutTableEdgeFromLoadRequest();-
199-
200 void updateContentWidth();-
201 void updateContentHeight();-
202-
203 void enforceFirstRowColumnAtOrigo();-
204 void syncLoadedTableRectFromLoadedTable();-
205 void syncLoadedTableFromLoadRequest();-
206-
207 bool canLoadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const;-
208 bool canUnloadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const;-
209 Qt::Edge nextEdgeToLoad(const QRectF rect);-
210 Qt::Edge nextEdgeToUnload(const QRectF rect);-
211-
212 qreal cellWidth(const QPoint &cell);-
213 qreal cellHeight(const QPoint &cell);-
214-
215 FxTableItem *loadedTableItem(const QPoint &cell) const;-
216 FxTableItem *itemNextTo(const FxTableItem *fxTableItem, const QPoint &direction) const;-
217 FxTableItem *createFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode);-
218 FxTableItem *loadFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode);-
219-
220 void releaseItem(FxTableItem *fxTableItem);-
221 void releaseLoadedItems();-
222 void clear();-
223-
224 void unloadItem(const QPoint &cell);-
225 void unloadItems(const QLine &items);-
226-
227 void loadInitialTopLeftItem();-
228 void loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMode incubationMode);-
229 void unloadEdge(Qt::Edge edge);-
230 void loadAndUnloadVisibleEdges();-
231 void cancelLoadRequest();-
232 void processLoadRequest();-
233 void beginRebuildTable();-
234 void endRebuildTable();-
235-
236 void loadBuffer();-
237 void unloadBuffer();-
238 QRectF bufferRect();-
239-
240 void invalidateTable();-
241 void invalidateColumnRowPositions();-
242-
243 void createWrapperModel();-
244-
245 void initItemCallback(int modelIndex, QObject *item);-
246 void itemCreatedCallback(int modelIndex, QObject *object);-
247 void modelUpdated(const QQmlChangeSet &changeSet, bool reset);-
248-
249 inline QString tableLayoutToString() const;-
250 void dumpTable() const;-
251};-
252-
253class FxTableItem : public QQuickItemViewFxItem-
254{-
255public:-
256 FxTableItem(QQuickItem *item, QQuickTableView *table, bool own)-
257 : QQuickItemViewFxItem(item, own, QQuickTableViewPrivate::get(table))-
258 {-
259 }
never executed: end of block
0
260-
261 qreal position() const override { return
never executed: return 0;
0;
never executed: return 0;
}
0
262 qreal endPosition() const override { return
never executed: return 0;
0;
never executed: return 0;
}
0
263 qreal size() const override { return
never executed: return 0;
0;
never executed: return 0;
}
0
264 qreal sectionSize() const override { return
never executed: return 0;
0;
never executed: return 0;
}
0
265 bool contains(qreal, qreal) const override { return
never executed: return false;
false;
never executed: return false;
}
0
266-
267 QPoint cell;-
268};-
269-
270template<> class QTypeInfo<QQuickTableViewPrivate::ColumnRowSize > { public: enum { isSpecialized = true, isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_PRIMITIVE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QQuickTableViewPrivate::ColumnRowSize)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QQuickTableViewPrivate::ColumnRowSize >::value, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QQuickTableViewPrivate::ColumnRowSize) }; static inline const char *name() { return "QQuickTableViewPrivate::ColumnRowSize"; } };-
271-
272-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0