| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktableview.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | const QLoggingCategory &lcTableViewDelegateLifecycle() { static const QLoggingCategory category("qt.quick.tableview.lifecycle"); return executed 306 times by 1 test: category;return category;Executed by:
executed 306 times by 1 test: }return category;Executed by:
| 306 | ||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | static const Qt::Edge allTableEdges[] = { Qt::LeftEdge, Qt::RightEdge, Qt::TopEdge, Qt::BottomEdge }; | - | ||||||||||||||||||
| 12 | static const int kBufferTimerInterval = 300; | - | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | static QLine rectangleEdge(const QRect &rect, Qt::Edge tableEdge) | - | ||||||||||||||||||
| 15 | { | - | ||||||||||||||||||
| 16 | switch (tableEdge) { | - | ||||||||||||||||||
| 17 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 18 | return never executed: QLine(rect.topLeft(), rect.bottomLeft());return QLine(rect.topLeft(), rect.bottomLeft());never executed: return QLine(rect.topLeft(), rect.bottomLeft()); | 0 | ||||||||||||||||||
| 19 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 20 | return never executed: QLine(rect.topRight(), rect.bottomRight());return QLine(rect.topRight(), rect.bottomRight());never executed: return QLine(rect.topRight(), rect.bottomRight()); | 0 | ||||||||||||||||||
| 21 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 22 | return never executed: QLine(rect.topLeft(), rect.topRight());return QLine(rect.topLeft(), rect.topRight());never executed: return QLine(rect.topLeft(), rect.topRight()); | 0 | ||||||||||||||||||
| 23 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 24 | return never executed: QLine(rect.bottomLeft(), rect.bottomRight());return QLine(rect.bottomLeft(), rect.bottomRight());never executed: return QLine(rect.bottomLeft(), rect.bottomRight()); | 0 | ||||||||||||||||||
| 25 | } | - | ||||||||||||||||||
| 26 | return never executed: QLine();return QLine();never executed: return QLine(); | 0 | ||||||||||||||||||
| 27 | } | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | static QRect expandedRect(const QRect &rect, Qt::Edge edge, int increment) | - | ||||||||||||||||||
| 30 | { | - | ||||||||||||||||||
| 31 | switch (edge) { | - | ||||||||||||||||||
| 32 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 33 | return never executed: rect.adjusted(-increment, 0, 0, 0);return rect.adjusted(-increment, 0, 0, 0);never executed: return rect.adjusted(-increment, 0, 0, 0); | 0 | ||||||||||||||||||
| 34 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 35 | return never executed: rect.adjusted(0, 0, increment, 0);return rect.adjusted(0, 0, increment, 0);never executed: return rect.adjusted(0, 0, increment, 0); | 0 | ||||||||||||||||||
| 36 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 37 | return never executed: rect.adjusted(0, -increment, 0, 0);return rect.adjusted(0, -increment, 0, 0);never executed: return rect.adjusted(0, -increment, 0, 0); | 0 | ||||||||||||||||||
| 38 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 39 | return never executed: rect.adjusted(0, 0, 0, increment);return rect.adjusted(0, 0, 0, increment);never executed: return rect.adjusted(0, 0, 0, increment); | 0 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 42 | } | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | const QPoint QQuickTableViewPrivate::kLeft = QPoint(-1, 0); | - | ||||||||||||||||||
| 45 | const QPoint QQuickTableViewPrivate::kRight = QPoint(1, 0); | - | ||||||||||||||||||
| 46 | const QPoint QQuickTableViewPrivate::kUp = QPoint(0, -1); | - | ||||||||||||||||||
| 47 | const QPoint QQuickTableViewPrivate::kDown = QPoint(0, 1); | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | QQuickTableViewPrivate::QQuickTableViewPrivate() | - | ||||||||||||||||||
| 50 | : QQuickFlickablePrivate() | - | ||||||||||||||||||
| 51 | { | - | ||||||||||||||||||
| 52 | cacheBufferDelayTimer.setSingleShot(true); | - | ||||||||||||||||||
| 53 | QObject::connect(&cacheBufferDelayTimer, &QTimer::timeout, [=]{ loadBuffer(); } never executed: );end of block | 0 | ||||||||||||||||||
| 54 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | QQuickTableViewPrivate::~QQuickTableViewPrivate() | - | ||||||||||||||||||
| 57 | { | - | ||||||||||||||||||
| 58 | clear(); | - | ||||||||||||||||||
| 59 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QString QQuickTableViewPrivate::tableLayoutToString() const | - | ||||||||||||||||||
| 62 | { | - | ||||||||||||||||||
| 63 | return never executed: QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9"))return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height());never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 64 | .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 65 | .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 66 | .arg(loadedItems.count()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 67 | .arg(loadedTableOuterRect.x()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 68 | .arg(loadedTableOuterRect.y()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 69 | .arg(loadedTableOuterRect.width()) never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 70 | .arg(loadedTableOuterRect.height()); never executed: return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(loadedTable.topLeft().x()).arg(loadedTable.topLeft().y()) .arg(loadedTable.bottomRight().x()).arg(loadedTable.bottomRight().y()) .arg(loadedItems.count()) .arg(loadedTableOuterRect.x()) .arg(loadedTableOuterRect.y()) .arg(loadedTableOuterRect.width()) .arg(loadedTableOuterRect.height()); | 0 | ||||||||||||||||||
| 71 | } | - | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | void QQuickTableViewPrivate::dumpTable() const | - | ||||||||||||||||||
| 74 | { | - | ||||||||||||||||||
| 75 | auto listCopy = loadedItems.values(); | - | ||||||||||||||||||
| 76 | std::stable_sort(listCopy.begin(), listCopy.end(), | - | ||||||||||||||||||
| 77 | [](const FxTableItem *lhs, const FxTableItem *rhs) | - | ||||||||||||||||||
| 78 | { return never executed: lhs->index < rhs->index;return lhs->index < rhs->index;never executed: });return lhs->index < rhs->index; | 0 | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | QMessageLogger(__FILE__, 129, __PRETTY_FUNCTION__).warning() << ([]() noexcept -> QString { enum { Size = sizeof(u"" "******* TABLE DUMP *******")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "******* TABLE DUMP *******" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
| 81 | for (int i = 0; i < listCopy.count()
| 0 | ||||||||||||||||||
| 82 | QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__).warning() << static_cast<FxTableItem *>(listCopy.at(i))->cell; never executed: QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__).warning() << static_cast<FxTableItem *>(listCopy.at(i))->cell; | 0 | ||||||||||||||||||
| 83 | QMessageLogger(__FILE__, 132, __PRETTY_FUNCTION__).warning() << tableLayoutToString(); | - | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | QString filename = ([]() noexcept -> QString { enum { Size = sizeof(u"" "QQuickTableView_dumptable_capture.png")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "QQuickTableView_dumptable_capture.png" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||||||||||||||
| 86 | if (q_func()->window()->grabWindow().save(filename)
| 0 | ||||||||||||||||||
| 87 | QMessageLogger(__FILE__, 136, __PRETTY_FUNCTION__).warning() << "Window capture saved to:" << filename; never executed: QMessageLogger(__FILE__, 136, __PRETTY_FUNCTION__).warning() << "Window capture saved to:" << filename; | 0 | ||||||||||||||||||
| 88 | } never executed: end of block | 0 | ||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | QQuickTableViewAttached *QQuickTableViewPrivate::getAttachedObject(const QObject *object) const | - | ||||||||||||||||||
| 91 | { | - | ||||||||||||||||||
| 92 | QObject *attachedObject = qmlAttachedPropertiesObject<QQuickTableView>(object); | - | ||||||||||||||||||
| 93 | return never executed: static_cast<QQuickTableViewAttached *>(attachedObject);return static_cast<QQuickTableViewAttached *>(attachedObject);never executed: return static_cast<QQuickTableViewAttached *>(attachedObject); | 0 | ||||||||||||||||||
| 94 | } | - | ||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | int QQuickTableViewPrivate::modelIndexAtCell(const QPoint &cell) const | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | int availableRows = tableSize.height(); | - | ||||||||||||||||||
| 99 | int modelIndex = cell.y() + (cell.x() * availableRows); | - | ||||||||||||||||||
| 100 | ((modelIndex < model->count() || [&](){ dumpTable(); QMessageLogger(__FILE__, 149, __PRETTY_FUNCTION__).warning() << "output:" << modelIndex << cell; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("modelIndex < model->count() || [&](){ dumpTable(); qWarning() << \"output:\" << modelIndex << cell; return false;}()", __FILE__, 149));return false; | 0 | ||||||||||||||||||
| 101 | return never executed: modelIndex;return modelIndex;never executed: return modelIndex; | 0 | ||||||||||||||||||
| 102 | } | - | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | QPoint QQuickTableViewPrivate::cellAtModelIndex(int modelIndex) const | - | ||||||||||||||||||
| 105 | { | - | ||||||||||||||||||
| 106 | int availableRows = tableSize.height(); | - | ||||||||||||||||||
| 107 | ((availableRows > 0 || [&](){ dumpTable(); QMessageLogger(__FILE__, 156, __PRETTY_FUNCTION__).warning() << "output:" << availableRows; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("availableRows > 0 || [&](){ dumpTable(); qWarning() << \"output:\" << availableRows; return false;}()", __FILE__, 156));return false; | 0 | ||||||||||||||||||
| 108 | int column = int(modelIndex / availableRows); | - | ||||||||||||||||||
| 109 | int row = modelIndex % availableRows; | - | ||||||||||||||||||
| 110 | return never executed: QPoint(column, row);return QPoint(column, row);never executed: return QPoint(column, row); | 0 | ||||||||||||||||||
| 111 | } | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | void QQuickTableViewPrivate::updateContentWidth() | - | ||||||||||||||||||
| 114 | { | - | ||||||||||||||||||
| 115 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | const qreal thresholdBeforeAdjust = 0.1; | - | ||||||||||||||||||
| 118 | int currentRightColumn = loadedTable.right(); | - | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | if (currentRightColumn > contentSizeBenchMarkPoint.x()
| 0-204 | ||||||||||||||||||
| 121 | contentSizeBenchMarkPoint.setX(currentRightColumn); | - | ||||||||||||||||||
| 122 | - | |||||||||||||||||||
| 123 | qreal currentWidth = loadedTableOuterRect.right(); | - | ||||||||||||||||||
| 124 | qreal averageCellSize = currentWidth / (currentRightColumn + 1); | - | ||||||||||||||||||
| 125 | qreal averageSize = averageCellSize + cellSpacing.width(); | - | ||||||||||||||||||
| 126 | qreal estimatedWith = (tableSize.width() * averageSize) - cellSpacing.width(); | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | currentWidth += tableMargins.right(); | - | ||||||||||||||||||
| 130 | estimatedWith += tableMargins.right(); | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | if (currentRightColumn >= tableSize.width() - 1
| 0 | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | if (currentWidth != q->implicitWidth()
| 0 | ||||||||||||||||||
| 135 | q->setContentWidth(currentWidth); never executed: q->setContentWidth(currentWidth); | 0 | ||||||||||||||||||
| 136 | } never executed: else if (currentWidth >= q->implicitWidth()end of block
| 0 | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | q->setContentWidth(estimatedWith); | - | ||||||||||||||||||
| 139 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | qreal diff = 1 - (estimatedWith / q->implicitWidth()); | - | ||||||||||||||||||
| 142 | if (qAbs(diff) > thresholdBeforeAdjust
| 0 | ||||||||||||||||||
| 143 | q->setContentWidth(estimatedWith); never executed: q->setContentWidth(estimatedWith); | 0 | ||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||
| 145 | } | - | ||||||||||||||||||
| 146 | } executed 204 times by 1 test: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | void QQuickTableViewPrivate::updateContentHeight() | - | ||||||||||||||||||
| 149 | { | - | ||||||||||||||||||
| 150 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | const qreal thresholdBeforeAdjust = 0.1; | - | ||||||||||||||||||
| 153 | int currentBottomRow = loadedTable.bottom(); | - | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | if (currentBottomRow > contentSizeBenchMarkPoint.y()
| 0-204 | ||||||||||||||||||
| 156 | contentSizeBenchMarkPoint.setY(currentBottomRow); | - | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | qreal currentHeight = loadedTableOuterRect.bottom(); | - | ||||||||||||||||||
| 159 | qreal averageCellSize = currentHeight / (currentBottomRow + 1); | - | ||||||||||||||||||
| 160 | qreal averageSize = averageCellSize + cellSpacing.height(); | - | ||||||||||||||||||
| 161 | qreal estimatedHeight = (tableSize.height() * averageSize) - cellSpacing.height(); | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | currentHeight += tableMargins.bottom(); | - | ||||||||||||||||||
| 165 | estimatedHeight += tableMargins.bottom(); | - | ||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | if (currentBottomRow >= tableSize.height() - 1
| 0 | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | if (currentHeight != q->implicitHeight()
| 0 | ||||||||||||||||||
| 170 | q->setContentHeight(currentHeight); never executed: q->setContentHeight(currentHeight); | 0 | ||||||||||||||||||
| 171 | } never executed: else if (currentHeight >= q->implicitHeight()end of block
| 0 | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | q->setContentHeight(estimatedHeight); | - | ||||||||||||||||||
| 174 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | qreal diff = 1 - (estimatedHeight / q->implicitHeight()); | - | ||||||||||||||||||
| 177 | if (qAbs(diff) > thresholdBeforeAdjust
| 0 | ||||||||||||||||||
| 178 | q->setContentHeight(estimatedHeight); never executed: q->setContentHeight(estimatedHeight); | 0 | ||||||||||||||||||
| 179 | } never executed: end of block | 0 | ||||||||||||||||||
| 180 | } | - | ||||||||||||||||||
| 181 | } executed 204 times by 1 test: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | void QQuickTableViewPrivate::enforceFirstRowColumnAtOrigo() | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | bool layoutNeeded = false; | - | ||||||||||||||||||
| 190 | const qreal flickMargin = 50; | - | ||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | if (loadedTable.x() == 0
| 0 | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | loadedTableOuterRect.moveLeft(tableMargins.left()); | - | ||||||||||||||||||
| 196 | layoutNeeded = true; | - | ||||||||||||||||||
| 197 | } never executed: else if (loadedTableOuterRect.x() < 0end of block
| 0 | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | loadedTableOuterRect.moveLeft(tableMargins.left() + loadedTable.x() == 0 ? 0 : flickMargin); | - | ||||||||||||||||||
| 201 | layoutNeeded = true; | - | ||||||||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | if (loadedTable.y() == 0
| 0 | ||||||||||||||||||
| 205 | loadedTableOuterRect.moveTop(tableMargins.top()); | - | ||||||||||||||||||
| 206 | layoutNeeded = true; | - | ||||||||||||||||||
| 207 | } never executed: else if (loadedTableOuterRect.y() < 0end of block
| 0 | ||||||||||||||||||
| 208 | loadedTableOuterRect.moveTop(tableMargins.top() + loadedTable.y() == 0 ? 0 : flickMargin); | - | ||||||||||||||||||
| 209 | layoutNeeded = true; | - | ||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | if (layoutNeeded
| 0 | ||||||||||||||||||
| 213 | relayoutTableItems(); never executed: relayoutTableItems(); | 0 | ||||||||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | void QQuickTableViewPrivate::syncLoadedTableRectFromLoadedTable() | - | ||||||||||||||||||
| 217 | { | - | ||||||||||||||||||
| 218 | QRectF topLeftRect = loadedTableItem(loadedTable.topLeft())->geometry(); | - | ||||||||||||||||||
| 219 | QRectF bottomRightRect = loadedTableItem(loadedTable.bottomRight())->geometry(); | - | ||||||||||||||||||
| 220 | loadedTableOuterRect = topLeftRect.united(bottomRightRect); | - | ||||||||||||||||||
| 221 | loadedTableInnerRect = QRectF(topLeftRect.bottomRight(), bottomRightRect.topLeft()); | - | ||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | void QQuickTableViewPrivate::syncLoadedTableFromLoadRequest() | - | ||||||||||||||||||
| 225 | { | - | ||||||||||||||||||
| 226 | switch (loadRequest.edge()) { | - | ||||||||||||||||||
| 227 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 228 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 229 | loadedTable.setTopLeft(loadRequest.firstCell()); | - | ||||||||||||||||||
| 230 | break; never executed: break; | 0 | ||||||||||||||||||
| 231 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 232 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 233 | loadedTable.setBottomRight(loadRequest.lastCell()); | - | ||||||||||||||||||
| 234 | break; never executed: break; | 0 | ||||||||||||||||||
| 235 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 236 | loadedTable = QRect(loadRequest.firstCell(), loadRequest.lastCell()); | - | ||||||||||||||||||
| 237 | } never executed: end of block | 0 | ||||||||||||||||||
| 238 | } | - | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | FxTableItem *QQuickTableViewPrivate::itemNextTo(const FxTableItem *fxTableItem, const QPoint &direction) const | - | ||||||||||||||||||
| 241 | { | - | ||||||||||||||||||
| 242 | return never executed: loadedTableItem(fxTableItem->cell + direction);return loadedTableItem(fxTableItem->cell + direction);never executed: return loadedTableItem(fxTableItem->cell + direction); | 0 | ||||||||||||||||||
| 243 | } | - | ||||||||||||||||||
| 244 | - | |||||||||||||||||||
| 245 | FxTableItem *QQuickTableViewPrivate::loadedTableItem(const QPoint &cell) const | - | ||||||||||||||||||
| 246 | { | - | ||||||||||||||||||
| 247 | const int modelIndex = modelIndexAtCell(cell); | - | ||||||||||||||||||
| 248 | ((loadedItems.contains(modelIndex) || [&](){ dumpTable(); QMessageLogger(__FILE__, 297, __PRETTY_FUNCTION__).warning() << "output:" << modelIndex << cell; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("loadedItems.contains(modelIndex) || [&](){ dumpTable(); qWarning() << \"output:\" << modelIndex << cell; return false;}()", __FILE__, 297));return false; | 0 | ||||||||||||||||||
| 249 | return never executed: loadedItems.value(modelIndex);return loadedItems.value(modelIndex);never executed: return loadedItems.value(modelIndex); | 0 | ||||||||||||||||||
| 250 | } | - | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | FxTableItem *QQuickTableViewPrivate::createFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode) | - | ||||||||||||||||||
| 253 | { | - | ||||||||||||||||||
| 254 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | bool ownItem = false; | - | ||||||||||||||||||
| 257 | int modelIndex = modelIndexAtCell(cell); | - | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | QObject* object = model->object(modelIndex, incubationMode); | - | ||||||||||||||||||
| 260 | if (!object
| 0 | ||||||||||||||||||
| 261 | if (model->incubationStatus(modelIndex) == QQmlIncubator::Loading
| 0 | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||
| 265 | } | - | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | QMessageLogger(__FILE__, 316, __PRETTY_FUNCTION__).warning() << "TableView: failed loading index:" << modelIndex; | - | ||||||||||||||||||
| 268 | object = new QQuickItem(); | - | ||||||||||||||||||
| 269 | ownItem = true; | - | ||||||||||||||||||
| 270 | } never executed: end of block | 0 | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | QQuickItem *item = qmlobject_cast<QQuickItem*>(object); | - | ||||||||||||||||||
| 273 | if (!item
| 0 | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | QMessageLogger(__FILE__, 325, __PRETTY_FUNCTION__).warning() << "TableView: delegate is not an item:" << modelIndex; | - | ||||||||||||||||||
| 277 | model->release(object); | - | ||||||||||||||||||
| 278 | item = new QQuickItem(); | - | ||||||||||||||||||
| 279 | ownItem = true; | - | ||||||||||||||||||
| 280 | } never executed: end of block | 0 | ||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | item->setParentItem(q->contentItem()); | - | ||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | FxTableItem *fxTableItem = new FxTableItem(item, q, ownItem); | - | ||||||||||||||||||
| 285 | fxTableItem->setVisible(false); | - | ||||||||||||||||||
| 286 | fxTableItem->cell = cell; | - | ||||||||||||||||||
| 287 | fxTableItem->index = modelIndex; | - | ||||||||||||||||||
| 288 | return never executed: fxTableItem;return fxTableItem;never executed: return fxTableItem; | 0 | ||||||||||||||||||
| 289 | } | - | ||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | FxTableItem *QQuickTableViewPrivate::loadFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode) | - | ||||||||||||||||||
| 292 | { | - | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | static const bool forcedAsync = forcedIncubationMode == QLatin1String("async"); | - | ||||||||||||||||||
| 297 | if (forcedAsync
| 0 | ||||||||||||||||||
| 298 | incubationMode = QQmlIncubator::Asynchronous; never executed: incubationMode = QQmlIncubator::Asynchronous; | 0 | ||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | - | |||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | QBoolBlocker guard(blockItemCreatedCallback); | - | ||||||||||||||||||
| 304 | auto item = createFxTableItem(cell, incubationMode); | - | ||||||||||||||||||
| 305 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 354, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << cell << "ready?" << bool(item); | 0 | ||||||||||||||||||
| 306 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||
| 307 | } | - | ||||||||||||||||||
| 308 | - | |||||||||||||||||||
| 309 | void QQuickTableViewPrivate::releaseLoadedItems() { | - | ||||||||||||||||||
| 310 | - | |||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | auto const tmpList = loadedItems; | - | ||||||||||||||||||
| 313 | loadedItems.clear(); | - | ||||||||||||||||||
| 314 | for (FxTableItem *item : tmpList) | - | ||||||||||||||||||
| 315 | releaseItem(item); never executed: releaseItem(item); | 0 | ||||||||||||||||||
| 316 | } executed 204 times by 1 test: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 317 | - | |||||||||||||||||||
| 318 | void QQuickTableViewPrivate::releaseItem(FxTableItem *fxTableItem) | - | ||||||||||||||||||
| 319 | { | - | ||||||||||||||||||
| 320 | if (fxTableItem->item
| 0 | ||||||||||||||||||
| 321 | if (fxTableItem->ownItem
| 0 | ||||||||||||||||||
| 322 | delete fxTableItem->item; never executed: delete fxTableItem->item; | 0 | ||||||||||||||||||
| 323 | else if (model->release(fxTableItem->item) != QQmlInstanceModel::Destroyed
| 0 | ||||||||||||||||||
| 324 | fxTableItem->item->setParentItem(nullptr); never executed: fxTableItem->item->setParentItem(nullptr); | 0 | ||||||||||||||||||
| 325 | } never executed: end of block | 0 | ||||||||||||||||||
| 326 | - | |||||||||||||||||||
| 327 | delete fxTableItem; | - | ||||||||||||||||||
| 328 | } never executed: end of block | 0 | ||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | void QQuickTableViewPrivate::clear() | - | ||||||||||||||||||
| 331 | { | - | ||||||||||||||||||
| 332 | tableInvalid = true; | - | ||||||||||||||||||
| 333 | tableRebuilding = false; | - | ||||||||||||||||||
| 334 | if (loadRequest.isActive()
| 0-204 | ||||||||||||||||||
| 335 | cancelLoadRequest(); never executed: cancelLoadRequest(); | 0 | ||||||||||||||||||
| 336 | - | |||||||||||||||||||
| 337 | releaseLoadedItems(); | - | ||||||||||||||||||
| 338 | loadedTable = QRect(); | - | ||||||||||||||||||
| 339 | loadedTableOuterRect = QRect(); | - | ||||||||||||||||||
| 340 | loadedTableInnerRect = QRect(); | - | ||||||||||||||||||
| 341 | columnWidths.clear(); | - | ||||||||||||||||||
| 342 | rowHeights.clear(); | - | ||||||||||||||||||
| 343 | contentSizeBenchMarkPoint = QPoint(-1, -1); | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | updateContentWidth(); | - | ||||||||||||||||||
| 346 | updateContentHeight(); | - | ||||||||||||||||||
| 347 | } executed 204 times by 1 test: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | void QQuickTableViewPrivate::unloadItem(const QPoint &cell) | - | ||||||||||||||||||
| 350 | { | - | ||||||||||||||||||
| 351 | const int modelIndex = modelIndexAtCell(cell); | - | ||||||||||||||||||
| 352 | ((loadedItems.contains(modelIndex) || [&](){ dumpTable(); QMessageLogger(__FILE__, 401, __PRETTY_FUNCTION__).warning() << "output:" << modelIndex << cell; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("loadedItems.contains(modelIndex) || [&](){ dumpTable(); qWarning() << \"output:\" << modelIndex << cell; return false;}()", __FILE__, 401));return false; | 0 | ||||||||||||||||||
| 353 | releaseItem(loadedItems.take(modelIndex)); | - | ||||||||||||||||||
| 354 | } never executed: end of block | 0 | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | void QQuickTableViewPrivate::unloadItems(const QLine &items) | - | ||||||||||||||||||
| 357 | { | - | ||||||||||||||||||
| 358 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 407, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << items; | 0 | ||||||||||||||||||
| 359 | - | |||||||||||||||||||
| 360 | if (items.dx()
| 0 | ||||||||||||||||||
| 361 | int y = items.p1().y(); | - | ||||||||||||||||||
| 362 | for (int x = items.p1().x(); x <= items.p2().x()
| 0 | ||||||||||||||||||
| 363 | unloadItem(QPoint(x, y)); never executed: unloadItem(QPoint(x, y)); | 0 | ||||||||||||||||||
| 364 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 365 | int x = items.p1().x(); | - | ||||||||||||||||||
| 366 | for (int y = items.p1().y(); y <= items.p2().y()
| 0 | ||||||||||||||||||
| 367 | unloadItem(QPoint(x, y)); never executed: unloadItem(QPoint(x, y)); | 0 | ||||||||||||||||||
| 368 | } never executed: end of block | 0 | ||||||||||||||||||
| 369 | } | - | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | bool QQuickTableViewPrivate::canLoadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const | - | ||||||||||||||||||
| 372 | { | - | ||||||||||||||||||
| 373 | switch (tableEdge) { | - | ||||||||||||||||||
| 374 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 375 | if (loadedTable.topLeft().x() == 0
| 0 | ||||||||||||||||||
| 376 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 377 | return never executed: loadedTableOuterRect.left() > fillRect.left() + cellSpacing.width();return loadedTableOuterRect.left() > fillRect.left() + cellSpacing.width();never executed: return loadedTableOuterRect.left() > fillRect.left() + cellSpacing.width(); | 0 | ||||||||||||||||||
| 378 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 379 | if (loadedTable.bottomRight().x() >= tableSize.width() - 1
| 0 | ||||||||||||||||||
| 380 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 381 | return never executed: loadedTableOuterRect.right() < fillRect.right() - cellSpacing.width();return loadedTableOuterRect.right() < fillRect.right() - cellSpacing.width();never executed: return loadedTableOuterRect.right() < fillRect.right() - cellSpacing.width(); | 0 | ||||||||||||||||||
| 382 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 383 | if (loadedTable.topLeft().y() == 0
| 0 | ||||||||||||||||||
| 384 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 385 | return never executed: loadedTableOuterRect.top() > fillRect.top() + cellSpacing.height();return loadedTableOuterRect.top() > fillRect.top() + cellSpacing.height();never executed: return loadedTableOuterRect.top() > fillRect.top() + cellSpacing.height(); | 0 | ||||||||||||||||||
| 386 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 387 | if (loadedTable.bottomRight().y() >= tableSize.height() - 1
| 0 | ||||||||||||||||||
| 388 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 389 | return never executed: loadedTableOuterRect.bottom() < fillRect.bottom() - cellSpacing.height();return loadedTableOuterRect.bottom() < fillRect.bottom() - cellSpacing.height();never executed: return loadedTableOuterRect.bottom() < fillRect.bottom() - cellSpacing.height(); | 0 | ||||||||||||||||||
| 390 | } | - | ||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 393 | } | - | ||||||||||||||||||
| 394 | - | |||||||||||||||||||
| 395 | bool QQuickTableViewPrivate::canUnloadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const | - | ||||||||||||||||||
| 396 | { | - | ||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | - | |||||||||||||||||||
| 399 | switch (tableEdge) { | - | ||||||||||||||||||
| 400 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 401 | if (loadedTable.width() <= 1
| 0 | ||||||||||||||||||
| 402 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 403 | return never executed: loadedTableInnerRect.left() < fillRect.left();return loadedTableInnerRect.left() < fillRect.left();never executed: return loadedTableInnerRect.left() < fillRect.left(); | 0 | ||||||||||||||||||
| 404 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 405 | if (loadedTable.width() <= 1
| 0 | ||||||||||||||||||
| 406 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 407 | return never executed: loadedTableInnerRect.right() > fillRect.right();return loadedTableInnerRect.right() > fillRect.right();never executed: return loadedTableInnerRect.right() > fillRect.right(); | 0 | ||||||||||||||||||
| 408 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 409 | if (loadedTable.height() <= 1
| 0 | ||||||||||||||||||
| 410 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 411 | return never executed: loadedTableInnerRect.top() < fillRect.top();return loadedTableInnerRect.top() < fillRect.top();never executed: return loadedTableInnerRect.top() < fillRect.top(); | 0 | ||||||||||||||||||
| 412 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 413 | if (loadedTable.height() <= 1
| 0 | ||||||||||||||||||
| 414 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 415 | return never executed: loadedTableInnerRect.bottom() > fillRect.bottom();return loadedTableInnerRect.bottom() > fillRect.bottom();never executed: return loadedTableInnerRect.bottom() > fillRect.bottom(); | 0 | ||||||||||||||||||
| 416 | } | - | ||||||||||||||||||
| 417 | { dumpTable(); QMessageLogger(__FILE__, 466, __PRETTY_FUNCTION__).warning() << "output:" << tableEdge; do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 466)); __builtin_unreachable(); } while (false); }; | - | ||||||||||||||||||
| 418 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 419 | } | - | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | Qt::Edge QQuickTableViewPrivate::nextEdgeToLoad(const QRectF rect) | - | ||||||||||||||||||
| 422 | { | - | ||||||||||||||||||
| 423 | for (Qt::Edge edge : allTableEdges) { | - | ||||||||||||||||||
| 424 | if (canLoadTableEdge(edge, rect)
| 0 | ||||||||||||||||||
| 425 | return never executed: edge;return edge;never executed: return edge; | 0 | ||||||||||||||||||
| 426 | } never executed: end of block | 0 | ||||||||||||||||||
| 427 | return never executed: Qt::Edge(0);return Qt::Edge(0);never executed: return Qt::Edge(0); | 0 | ||||||||||||||||||
| 428 | } | - | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | Qt::Edge QQuickTableViewPrivate::nextEdgeToUnload(const QRectF rect) | - | ||||||||||||||||||
| 431 | { | - | ||||||||||||||||||
| 432 | for (Qt::Edge edge : allTableEdges) { | - | ||||||||||||||||||
| 433 | if (canUnloadTableEdge(edge, rect)
| 0 | ||||||||||||||||||
| 434 | return never executed: edge;return edge;never executed: return edge; | 0 | ||||||||||||||||||
| 435 | } never executed: end of block | 0 | ||||||||||||||||||
| 436 | return never executed: Qt::Edge(0);return Qt::Edge(0);never executed: return Qt::Edge(0); | 0 | ||||||||||||||||||
| 437 | } | - | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | qreal QQuickTableViewPrivate::cellWidth(const QPoint& cell) | - | ||||||||||||||||||
| 440 | { | - | ||||||||||||||||||
| 441 | - | |||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | - | |||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | auto const cellItem = loadedTableItem(cell)->item; | - | ||||||||||||||||||
| 446 | if (auto const attached = getAttachedObject(cellItem)
| 0 | ||||||||||||||||||
| 447 | if (!attached->m_cellWidth.isNull
| 0 | ||||||||||||||||||
| 448 | return never executed: attached->m_cellWidth;return attached->m_cellWidth;never executed: return attached->m_cellWidth; | 0 | ||||||||||||||||||
| 449 | } never executed: end of block | 0 | ||||||||||||||||||
| 450 | return never executed: cellItem->implicitWidth();return cellItem->implicitWidth();never executed: return cellItem->implicitWidth(); | 0 | ||||||||||||||||||
| 451 | } | - | ||||||||||||||||||
| 452 | - | |||||||||||||||||||
| 453 | qreal QQuickTableViewPrivate::cellHeight(const QPoint& cell) | - | ||||||||||||||||||
| 454 | { | - | ||||||||||||||||||
| 455 | - | |||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | auto const cellItem = loadedTableItem(cell)->item; | - | ||||||||||||||||||
| 460 | if (auto const attached = getAttachedObject(cellItem)
| 0 | ||||||||||||||||||
| 461 | if (!attached->m_cellHeight.isNull
| 0 | ||||||||||||||||||
| 462 | return never executed: attached->m_cellHeight;return attached->m_cellHeight;never executed: return attached->m_cellHeight; | 0 | ||||||||||||||||||
| 463 | } never executed: end of block | 0 | ||||||||||||||||||
| 464 | return never executed: cellItem->implicitHeight();return cellItem->implicitHeight();never executed: return cellItem->implicitHeight(); | 0 | ||||||||||||||||||
| 465 | } | - | ||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | void QQuickTableViewPrivate::calculateColumnWidthsAfterRebuilding() | - | ||||||||||||||||||
| 468 | { | - | ||||||||||||||||||
| 469 | qreal prevColumnWidth = 0; | - | ||||||||||||||||||
| 470 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 471 | qreal columnWidth = 0; | - | ||||||||||||||||||
| 472 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 473 | columnWidth = qMax(columnWidth, cellWidth(QPoint(column, row))); never executed: columnWidth = qMax(columnWidth, cellWidth(QPoint(column, row))); | 0 | ||||||||||||||||||
| 474 | - | |||||||||||||||||||
| 475 | if (columnWidth <= 0
| 0 | ||||||||||||||||||
| 476 | columnWidth = kDefaultColumnWidth; never executed: columnWidth = kDefaultColumnWidth; | 0 | ||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | if (columnWidth == prevColumnWidth
| 0 | ||||||||||||||||||
| 479 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | columnWidths.append({column, columnWidth}); | - | ||||||||||||||||||
| 482 | prevColumnWidth = columnWidth; | - | ||||||||||||||||||
| 483 | } never executed: end of block | 0 | ||||||||||||||||||
| 484 | - | |||||||||||||||||||
| 485 | if (columnWidths.isEmpty()
| 0 | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | - | |||||||||||||||||||
| 488 | columnWidths.append({0, 0}); | - | ||||||||||||||||||
| 489 | } never executed: end of block | 0 | ||||||||||||||||||
| 490 | } never executed: end of block | 0 | ||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | void QQuickTableViewPrivate::calculateRowHeightsAfterRebuilding() | - | ||||||||||||||||||
| 493 | { | - | ||||||||||||||||||
| 494 | qreal prevRowHeight = 0; | - | ||||||||||||||||||
| 495 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 496 | qreal rowHeight = 0; | - | ||||||||||||||||||
| 497 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 498 | rowHeight = qMax(rowHeight, cellHeight(QPoint(column, row))); never executed: rowHeight = qMax(rowHeight, cellHeight(QPoint(column, row))); | 0 | ||||||||||||||||||
| 499 | - | |||||||||||||||||||
| 500 | if (rowHeight <= 0
| 0 | ||||||||||||||||||
| 501 | rowHeight = kDefaultRowHeight; never executed: rowHeight = kDefaultRowHeight; | 0 | ||||||||||||||||||
| 502 | - | |||||||||||||||||||
| 503 | if (rowHeight == prevRowHeight
| 0 | ||||||||||||||||||
| 504 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | rowHeights.append({row, rowHeight}); | - | ||||||||||||||||||
| 507 | prevRowHeight = rowHeight; | - | ||||||||||||||||||
| 508 | } never executed: end of block | 0 | ||||||||||||||||||
| 509 | - | |||||||||||||||||||
| 510 | if (rowHeights.isEmpty()
| 0 | ||||||||||||||||||
| 511 | - | |||||||||||||||||||
| 512 | - | |||||||||||||||||||
| 513 | rowHeights.append({0, 0}); | - | ||||||||||||||||||
| 514 | } never executed: end of block | 0 | ||||||||||||||||||
| 515 | } never executed: end of block | 0 | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | void QQuickTableViewPrivate::calculateColumnWidth(int column) | - | ||||||||||||||||||
| 518 | { | - | ||||||||||||||||||
| 519 | if (column < columnWidths.last().index
| 0 | ||||||||||||||||||
| 520 | - | |||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | return; never executed: return; | 0 | ||||||||||||||||||
| 523 | } | - | ||||||||||||||||||
| 524 | - | |||||||||||||||||||
| 525 | qreal columnWidth = 0; | - | ||||||||||||||||||
| 526 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 527 | columnWidth = qMax(columnWidth, cellWidth(QPoint(column, row))); never executed: columnWidth = qMax(columnWidth, cellWidth(QPoint(column, row))); | 0 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | if (columnWidth <= 0
| 0 | ||||||||||||||||||
| 530 | columnWidth = kDefaultColumnWidth; never executed: columnWidth = kDefaultColumnWidth; | 0 | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | if (columnWidth == columnWidths.last().size
| 0 | ||||||||||||||||||
| 533 | return; never executed: return; | 0 | ||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | columnWidths.append({column, columnWidth}); | - | ||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | void QQuickTableViewPrivate::calculateRowHeight(int row) | - | ||||||||||||||||||
| 539 | { | - | ||||||||||||||||||
| 540 | if (row < rowHeights.last().index
| 0 | ||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | - | |||||||||||||||||||
| 543 | return; never executed: return; | 0 | ||||||||||||||||||
| 544 | } | - | ||||||||||||||||||
| 545 | - | |||||||||||||||||||
| 546 | qreal rowHeight = 0; | - | ||||||||||||||||||
| 547 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 548 | rowHeight = qMax(rowHeight, cellHeight(QPoint(column, row))); never executed: rowHeight = qMax(rowHeight, cellHeight(QPoint(column, row))); | 0 | ||||||||||||||||||
| 549 | - | |||||||||||||||||||
| 550 | if (rowHeight <= 0
| 0 | ||||||||||||||||||
| 551 | rowHeight = kDefaultRowHeight; never executed: rowHeight = kDefaultRowHeight; | 0 | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | if (rowHeight == rowHeights.last().size
| 0 | ||||||||||||||||||
| 554 | return; never executed: return; | 0 | ||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | rowHeights.append({row, rowHeight}); | - | ||||||||||||||||||
| 557 | } never executed: end of block | 0 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | void QQuickTableViewPrivate::calculateEdgeSizeFromLoadRequest() | - | ||||||||||||||||||
| 560 | { | - | ||||||||||||||||||
| 561 | if (tableRebuilding
| 0 | ||||||||||||||||||
| 562 | return; never executed: return; | 0 | ||||||||||||||||||
| 563 | - | |||||||||||||||||||
| 564 | switch (loadRequest.edge()) { | - | ||||||||||||||||||
| 565 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 566 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | - | |||||||||||||||||||
| 569 | return; never executed: return; | 0 | ||||||||||||||||||
| 570 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 571 | if (tableSize.height() > 1
| 0 | ||||||||||||||||||
| 572 | calculateColumnWidth(loadedTable.right()); never executed: calculateColumnWidth(loadedTable.right()); | 0 | ||||||||||||||||||
| 573 | break; never executed: break; | 0 | ||||||||||||||||||
| 574 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 575 | if (tableSize.width() > 1
| 0 | ||||||||||||||||||
| 576 | calculateRowHeight(loadedTable.bottom()); never executed: calculateRowHeight(loadedTable.bottom()); | 0 | ||||||||||||||||||
| 577 | break; never executed: break; | 0 | ||||||||||||||||||
| 578 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 579 | { dumpTable(); QMessageLogger(__FILE__, 628, __PRETTY_FUNCTION__).warning() << "output:" << "This function should not be called when loading top-left item"; do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 628)); __builtin_unreachable(); } while (false); }; | - | ||||||||||||||||||
| 580 | } never executed: end of block | 0 | ||||||||||||||||||
| 581 | } | - | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | void QQuickTableViewPrivate::calculateTableSize() | - | ||||||||||||||||||
| 584 | { | - | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | - | |||||||||||||||||||
| 587 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 588 | QSize prevTableSize = tableSize; | - | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | if (delegateModel
| 0-102 | ||||||||||||||||||
| 591 | tableSize = QSize(delegateModel->columns(), delegateModel->rows()); executed 102 times by 1 test: tableSize = QSize(delegateModel->columns(), delegateModel->rows());Executed by:
| 102 | ||||||||||||||||||
| 592 | else if (model
| 0 | ||||||||||||||||||
| 593 | tableSize = QSize(1, model->count()); never executed: tableSize = QSize(1, model->count()); | 0 | ||||||||||||||||||
| 594 | else | - | ||||||||||||||||||
| 595 | tableSize = QSize(0, 0); never executed: tableSize = QSize(0, 0); | 0 | ||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | if (prevTableSize.width() != tableSize.width()
| 0-102 | ||||||||||||||||||
| 598 | q->columnsChanged(); executed 102 times by 1 test: q->columnsChanged();Executed by:
| 102 | ||||||||||||||||||
| 599 | if (prevTableSize.height() != tableSize.height()
| 0-102 | ||||||||||||||||||
| 600 | q->rowsChanged(); executed 102 times by 1 test: q->rowsChanged();Executed by:
| 102 | ||||||||||||||||||
| 601 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | qreal QQuickTableViewPrivate::columnWidth(int column) | - | ||||||||||||||||||
| 604 | { | - | ||||||||||||||||||
| 605 | if (!columnWidths.isEmpty()
| 0 | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | auto iter = std::upper_bound(columnWidths.constBegin(), columnWidths.constEnd(), | - | ||||||||||||||||||
| 608 | ColumnRowSize{column, -1}, ColumnRowSize::lessThan); | - | ||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | if (iter == columnWidths.constEnd()
| 0 | ||||||||||||||||||
| 611 | - | |||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | if (tableSize.height() > 1
| 0 | ||||||||||||||||||
| 614 | return never executed: columnWidths.last().size;return columnWidths.last().size;never executed: return columnWidths.last().size; | 0 | ||||||||||||||||||
| 615 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 616 | - | |||||||||||||||||||
| 617 | if (iter->index == column
| 0 | ||||||||||||||||||
| 618 | return never executed: iter->size;return iter->size;never executed: return iter->size; | 0 | ||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | - | |||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | - | |||||||||||||||||||
| 623 | - | |||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | if (tableSize.height() > 1
| 0 | ||||||||||||||||||
| 626 | return never executed: (iter - 1)->size;return (iter - 1)->size;never executed: return (iter - 1)->size; | 0 | ||||||||||||||||||
| 627 | } never executed: end of block | 0 | ||||||||||||||||||
| 628 | } | - | ||||||||||||||||||
| 629 | - | |||||||||||||||||||
| 630 | - | |||||||||||||||||||
| 631 | if (column >= loadedTable.left()
| 0 | ||||||||||||||||||
| 632 | return never executed: cellWidth(QPoint(column, loadedTable.top()));return cellWidth(QPoint(column, loadedTable.top()));never executed: return cellWidth(QPoint(column, loadedTable.top())); | 0 | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 635 | } | - | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | qreal QQuickTableViewPrivate::rowHeight(int row) | - | ||||||||||||||||||
| 638 | { | - | ||||||||||||||||||
| 639 | if (!rowHeights.isEmpty()
| 0 | ||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | auto iter = std::lower_bound(rowHeights.constBegin(), rowHeights.constEnd(), | - | ||||||||||||||||||
| 642 | ColumnRowSize{row, -1}, ColumnRowSize::lessThan); | - | ||||||||||||||||||
| 643 | - | |||||||||||||||||||
| 644 | if (iter == rowHeights.constEnd()
| 0 | ||||||||||||||||||
| 645 | - | |||||||||||||||||||
| 646 | - | |||||||||||||||||||
| 647 | if (tableSize.width() > 1
| 0 | ||||||||||||||||||
| 648 | return never executed: rowHeights.last().size;return rowHeights.last().size;never executed: return rowHeights.last().size; | 0 | ||||||||||||||||||
| 649 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 650 | - | |||||||||||||||||||
| 651 | if (iter->index == row
| 0 | ||||||||||||||||||
| 652 | return never executed: iter->size;return iter->size;never executed: return iter->size; | 0 | ||||||||||||||||||
| 653 | - | |||||||||||||||||||
| 654 | - | |||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | - | |||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | if (tableSize.width() > 1
| 0 | ||||||||||||||||||
| 660 | return never executed: (iter - 1)->size;return (iter - 1)->size;never executed: return (iter - 1)->size; | 0 | ||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||
| 662 | } | - | ||||||||||||||||||
| 663 | - | |||||||||||||||||||
| 664 | - | |||||||||||||||||||
| 665 | if (row >= loadedTable.top()
| 0 | ||||||||||||||||||
| 666 | return never executed: cellHeight(QPoint(loadedTable.left(), row));return cellHeight(QPoint(loadedTable.left(), row));never executed: return cellHeight(QPoint(loadedTable.left(), row)); | 0 | ||||||||||||||||||
| 667 | - | |||||||||||||||||||
| 668 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 669 | } | - | ||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | void QQuickTableViewPrivate::relayoutTable() | - | ||||||||||||||||||
| 672 | { | - | ||||||||||||||||||
| 673 | relayoutTableItems(); | - | ||||||||||||||||||
| 674 | columnRowPositionsInvalid = false; | - | ||||||||||||||||||
| 675 | - | |||||||||||||||||||
| 676 | syncLoadedTableRectFromLoadedTable(); | - | ||||||||||||||||||
| 677 | contentSizeBenchMarkPoint = QPoint(-1, -1); | - | ||||||||||||||||||
| 678 | updateContentWidth(); | - | ||||||||||||||||||
| 679 | updateContentHeight(); | - | ||||||||||||||||||
| 680 | } never executed: end of block | 0 | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | void QQuickTableViewPrivate::relayoutTableItems() | - | ||||||||||||||||||
| 683 | { | - | ||||||||||||||||||
| 684 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 733, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug(); | 0 | ||||||||||||||||||
| 685 | columnRowPositionsInvalid = false; | - | ||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | qreal nextColumnX = loadedTableOuterRect.x(); | - | ||||||||||||||||||
| 688 | qreal nextRowY = loadedTableOuterRect.y(); | - | ||||||||||||||||||
| 689 | - | |||||||||||||||||||
| 690 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | qreal width = columnWidth(column); | - | ||||||||||||||||||
| 693 | if (width <= 0
| 0 | ||||||||||||||||||
| 694 | width = kDefaultColumnWidth; never executed: width = kDefaultColumnWidth; | 0 | ||||||||||||||||||
| 695 | - | |||||||||||||||||||
| 696 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 697 | auto item = loadedTableItem(QPoint(column, row)); | - | ||||||||||||||||||
| 698 | QRectF geometry = item->geometry(); | - | ||||||||||||||||||
| 699 | geometry.moveLeft(nextColumnX); | - | ||||||||||||||||||
| 700 | geometry.setWidth(width); | - | ||||||||||||||||||
| 701 | item->setGeometry(geometry); | - | ||||||||||||||||||
| 702 | } never executed: end of block | 0 | ||||||||||||||||||
| 703 | - | |||||||||||||||||||
| 704 | nextColumnX += width + cellSpacing.width(); | - | ||||||||||||||||||
| 705 | } never executed: end of block | 0 | ||||||||||||||||||
| 706 | - | |||||||||||||||||||
| 707 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 708 | - | |||||||||||||||||||
| 709 | qreal height = rowHeight(row); | - | ||||||||||||||||||
| 710 | if (height <= 0
| 0 | ||||||||||||||||||
| 711 | height = kDefaultRowHeight; never executed: height = kDefaultRowHeight; | 0 | ||||||||||||||||||
| 712 | - | |||||||||||||||||||
| 713 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 714 | auto item = loadedTableItem(QPoint(column, row)); | - | ||||||||||||||||||
| 715 | QRectF geometry = item->geometry(); | - | ||||||||||||||||||
| 716 | geometry.moveTop(nextRowY); | - | ||||||||||||||||||
| 717 | geometry.setHeight(height); | - | ||||||||||||||||||
| 718 | item->setGeometry(geometry); | - | ||||||||||||||||||
| 719 | } never executed: end of block | 0 | ||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | nextRowY += height + cellSpacing.height(); | - | ||||||||||||||||||
| 722 | } never executed: end of block | 0 | ||||||||||||||||||
| 723 | - | |||||||||||||||||||
| 724 | if (__builtin_expect(!!(lcTableViewDelegateLifecycle().isDebugEnabled()), false)
| 0 | ||||||||||||||||||
| 725 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 726 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 727 | QPoint cell = QPoint(column, row); | - | ||||||||||||||||||
| 728 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 777, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "relayout item:" << cell << loadedTableItem(cell)->geometry(); | 0 | ||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||
| 730 | } never executed: end of block | 0 | ||||||||||||||||||
| 731 | } never executed: end of block | 0 | ||||||||||||||||||
| 732 | } never executed: end of block | 0 | ||||||||||||||||||
| 733 | - | |||||||||||||||||||
| 734 | void QQuickTableViewPrivate::layoutVerticalEdge(Qt::Edge tableEdge) | - | ||||||||||||||||||
| 735 | { | - | ||||||||||||||||||
| 736 | int column = (
| 0 | ||||||||||||||||||
| 737 | QPoint neighbourDirection = (
| 0 | ||||||||||||||||||
| 738 | qreal left = -1; | - | ||||||||||||||||||
| 739 | - | |||||||||||||||||||
| 740 | qreal width = columnWidth(column); | - | ||||||||||||||||||
| 741 | if (width <= 0
| 0 | ||||||||||||||||||
| 742 | width = kDefaultColumnWidth; never executed: width = kDefaultColumnWidth; | 0 | ||||||||||||||||||
| 743 | - | |||||||||||||||||||
| 744 | for (int row = loadedTable.top(); row <= loadedTable.bottom()
| 0 | ||||||||||||||||||
| 745 | auto fxTableItem = loadedTableItem(QPoint(column, row)); | - | ||||||||||||||||||
| 746 | auto const neighbourItem = itemNextTo(fxTableItem, neighbourDirection); | - | ||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | QRectF geometry = fxTableItem->geometry(); | - | ||||||||||||||||||
| 749 | geometry.setWidth(width); | - | ||||||||||||||||||
| 750 | geometry.setHeight(neighbourItem->geometry().height()); | - | ||||||||||||||||||
| 751 | - | |||||||||||||||||||
| 752 | if (left == -1
| 0 | ||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | - | |||||||||||||||||||
| 755 | left = tableEdge == Qt::LeftEdge
| 0 | ||||||||||||||||||
| 756 | neighbourItem->geometry().left() - cellSpacing.width() - geometry.width() : | - | ||||||||||||||||||
| 757 | neighbourItem->geometry().right() + cellSpacing.width(); | - | ||||||||||||||||||
| 758 | } never executed: end of block | 0 | ||||||||||||||||||
| 759 | - | |||||||||||||||||||
| 760 | geometry.moveLeft(left); | - | ||||||||||||||||||
| 761 | geometry.moveTop(neighbourItem->geometry().top()); | - | ||||||||||||||||||
| 762 | - | |||||||||||||||||||
| 763 | fxTableItem->setGeometry(geometry); | - | ||||||||||||||||||
| 764 | fxTableItem->setVisible(true); | - | ||||||||||||||||||
| 765 | - | |||||||||||||||||||
| 766 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 815, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "layout item:" << QPoint(column, row) << fxTableItem->geometry(); | 0 | ||||||||||||||||||
| 767 | } never executed: end of block | 0 | ||||||||||||||||||
| 768 | } never executed: end of block | 0 | ||||||||||||||||||
| 769 | - | |||||||||||||||||||
| 770 | void QQuickTableViewPrivate::layoutHorizontalEdge(Qt::Edge tableEdge) | - | ||||||||||||||||||
| 771 | { | - | ||||||||||||||||||
| 772 | int row = (
| 0 | ||||||||||||||||||
| 773 | QPoint neighbourDirection = (
| 0 | ||||||||||||||||||
| 774 | qreal top = -1; | - | ||||||||||||||||||
| 775 | - | |||||||||||||||||||
| 776 | qreal height = rowHeight(row); | - | ||||||||||||||||||
| 777 | if (height <= 0
| 0 | ||||||||||||||||||
| 778 | height = kDefaultRowHeight; never executed: height = kDefaultRowHeight; | 0 | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | for (int column = loadedTable.left(); column <= loadedTable.right()
| 0 | ||||||||||||||||||
| 781 | auto fxTableItem = loadedTableItem(QPoint(column, row)); | - | ||||||||||||||||||
| 782 | auto const neighbourItem = itemNextTo(fxTableItem, neighbourDirection); | - | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | QRectF geometry = fxTableItem->geometry(); | - | ||||||||||||||||||
| 785 | geometry.setWidth(neighbourItem->geometry().width()); | - | ||||||||||||||||||
| 786 | geometry.setHeight(height); | - | ||||||||||||||||||
| 787 | - | |||||||||||||||||||
| 788 | if (top == -1
| 0 | ||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | - | |||||||||||||||||||
| 791 | top = tableEdge == Qt::TopEdge
| 0 | ||||||||||||||||||
| 792 | neighbourItem->geometry().top() - cellSpacing.height() - geometry.height() : | - | ||||||||||||||||||
| 793 | neighbourItem->geometry().bottom() + cellSpacing.height(); | - | ||||||||||||||||||
| 794 | } never executed: end of block | 0 | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | geometry.moveTop(top); | - | ||||||||||||||||||
| 797 | geometry.moveLeft(neighbourItem->geometry().left()); | - | ||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | fxTableItem->setGeometry(geometry); | - | ||||||||||||||||||
| 800 | fxTableItem->setVisible(true); | - | ||||||||||||||||||
| 801 | - | |||||||||||||||||||
| 802 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 851, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "layout item:" << QPoint(column, row) << fxTableItem->geometry(); | 0 | ||||||||||||||||||
| 803 | } never executed: end of block | 0 | ||||||||||||||||||
| 804 | } never executed: end of block | 0 | ||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | void QQuickTableViewPrivate::layoutTopLeftItem() | - | ||||||||||||||||||
| 807 | { | - | ||||||||||||||||||
| 808 | - | |||||||||||||||||||
| 809 | const QPoint cell = loadRequest.firstCell(); | - | ||||||||||||||||||
| 810 | ((cell == QPoint(0, 0) || [&](){ dumpTable(); QMessageLogger(__FILE__, 859, __PRETTY_FUNCTION__).warning() << "output:" << loadRequest.toString(); return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("cell == QPoint(0, 0) || [&](){ dumpTable(); qWarning() << \"output:\" << loadRequest.toString(); return false;}()", __FILE__, 859));return false; | 0 | ||||||||||||||||||
| 811 | auto topLeftItem = loadedTableItem(cell); | - | ||||||||||||||||||
| 812 | auto item = topLeftItem->item; | - | ||||||||||||||||||
| 813 | - | |||||||||||||||||||
| 814 | qreal width = cellWidth(cell); | - | ||||||||||||||||||
| 815 | qreal height = cellHeight(cell); | - | ||||||||||||||||||
| 816 | if (width <= 0
| 0 | ||||||||||||||||||
| 817 | width = kDefaultColumnWidth; never executed: width = kDefaultColumnWidth; | 0 | ||||||||||||||||||
| 818 | if (height <= 0
| 0 | ||||||||||||||||||
| 819 | height = kDefaultRowHeight; never executed: height = kDefaultRowHeight; | 0 | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | item->setPosition(QPoint(tableMargins.left(), tableMargins.top())); | - | ||||||||||||||||||
| 822 | item->setSize(QSizeF(width, height)); | - | ||||||||||||||||||
| 823 | topLeftItem->setVisible(true); | - | ||||||||||||||||||
| 824 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 873, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << "geometry:" << topLeftItem->geometry(); | 0 | ||||||||||||||||||
| 825 | } never executed: end of block | 0 | ||||||||||||||||||
| 826 | - | |||||||||||||||||||
| 827 | void QQuickTableViewPrivate::layoutTableEdgeFromLoadRequest() | - | ||||||||||||||||||
| 828 | { | - | ||||||||||||||||||
| 829 | switch (loadRequest.edge()) { | - | ||||||||||||||||||
| 830 | case never executed: Qt::LeftEdge:case Qt::LeftEdge:never executed: case Qt::LeftEdge: | 0 | ||||||||||||||||||
| 831 | case never executed: Qt::RightEdge:case Qt::RightEdge:never executed: case Qt::RightEdge: | 0 | ||||||||||||||||||
| 832 | layoutVerticalEdge(loadRequest.edge()); | - | ||||||||||||||||||
| 833 | break; never executed: break; | 0 | ||||||||||||||||||
| 834 | case never executed: Qt::TopEdge:case Qt::TopEdge:never executed: case Qt::TopEdge: | 0 | ||||||||||||||||||
| 835 | case never executed: Qt::BottomEdge:case Qt::BottomEdge:never executed: case Qt::BottomEdge: | 0 | ||||||||||||||||||
| 836 | layoutHorizontalEdge(loadRequest.edge()); | - | ||||||||||||||||||
| 837 | break; never executed: break; | 0 | ||||||||||||||||||
| 838 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 839 | layoutTopLeftItem(); | - | ||||||||||||||||||
| 840 | break; never executed: break; | 0 | ||||||||||||||||||
| 841 | } | - | ||||||||||||||||||
| 842 | } | - | ||||||||||||||||||
| 843 | - | |||||||||||||||||||
| 844 | void QQuickTableViewPrivate::cancelLoadRequest() | - | ||||||||||||||||||
| 845 | { | - | ||||||||||||||||||
| 846 | loadRequest.markAsDone(); | - | ||||||||||||||||||
| 847 | model->cancel(modelIndexAtCell(loadRequest.currentCell())); | - | ||||||||||||||||||
| 848 | - | |||||||||||||||||||
| 849 | if (tableInvalid
| 0 | ||||||||||||||||||
| 850 | - | |||||||||||||||||||
| 851 | - | |||||||||||||||||||
| 852 | return; never executed: return; | 0 | ||||||||||||||||||
| 853 | } | - | ||||||||||||||||||
| 854 | - | |||||||||||||||||||
| 855 | if (loadRequest.atBeginning()
| 0 | ||||||||||||||||||
| 856 | - | |||||||||||||||||||
| 857 | return; never executed: return; | 0 | ||||||||||||||||||
| 858 | } | - | ||||||||||||||||||
| 859 | - | |||||||||||||||||||
| 860 | QLine rollbackItems; | - | ||||||||||||||||||
| 861 | rollbackItems.setP1(loadRequest.firstCell()); | - | ||||||||||||||||||
| 862 | rollbackItems.setP2(loadRequest.previousCell()); | - | ||||||||||||||||||
| 863 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 912, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "rollback:" << rollbackItems << tableLayoutToString(); | 0 | ||||||||||||||||||
| 864 | unloadItems(rollbackItems); | - | ||||||||||||||||||
| 865 | } never executed: end of block | 0 | ||||||||||||||||||
| 866 | - | |||||||||||||||||||
| 867 | void QQuickTableViewPrivate::processLoadRequest() | - | ||||||||||||||||||
| 868 | { | - | ||||||||||||||||||
| 869 | ((loadRequest.isActive() || [&](){ dumpTable(); QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).warning() << "output:" << ""; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("loadRequest.isActive() || [&](){ dumpTable(); qWarning() << \"output:\" << \"\"; return false;}()", __FILE__, 918));return false; | 0 | ||||||||||||||||||
| 870 | - | |||||||||||||||||||
| 871 | while (loadRequest.hasCurrentCell()
| 0 | ||||||||||||||||||
| 872 | QPoint cell = loadRequest.currentCell(); | - | ||||||||||||||||||
| 873 | FxTableItem *fxTableItem = loadFxTableItem(cell, loadRequest.incubationMode()); | - | ||||||||||||||||||
| 874 | - | |||||||||||||||||||
| 875 | if (!fxTableItem
| 0 | ||||||||||||||||||
| 876 | - | |||||||||||||||||||
| 877 | - | |||||||||||||||||||
| 878 | return; never executed: return; | 0 | ||||||||||||||||||
| 879 | } | - | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | loadedItems.insert(modelIndexAtCell(cell), fxTableItem); | - | ||||||||||||||||||
| 882 | loadRequest.moveToNextCell(); | - | ||||||||||||||||||
| 883 | } never executed: end of block | 0 | ||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 934, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "all items loaded!"; | 0 | ||||||||||||||||||
| 886 | - | |||||||||||||||||||
| 887 | syncLoadedTableFromLoadRequest(); | - | ||||||||||||||||||
| 888 | calculateEdgeSizeFromLoadRequest(); | - | ||||||||||||||||||
| 889 | layoutTableEdgeFromLoadRequest(); | - | ||||||||||||||||||
| 890 | - | |||||||||||||||||||
| 891 | syncLoadedTableRectFromLoadedTable(); | - | ||||||||||||||||||
| 892 | enforceFirstRowColumnAtOrigo(); | - | ||||||||||||||||||
| 893 | updateContentWidth(); | - | ||||||||||||||||||
| 894 | updateContentHeight(); | - | ||||||||||||||||||
| 895 | - | |||||||||||||||||||
| 896 | loadRequest.markAsDone(); | - | ||||||||||||||||||
| 897 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 946, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "request completed! Table:" << tableLayoutToString(); | 0 | ||||||||||||||||||
| 898 | } never executed: end of block | 0 | ||||||||||||||||||
| 899 | - | |||||||||||||||||||
| 900 | void QQuickTableViewPrivate::beginRebuildTable() | - | ||||||||||||||||||
| 901 | { | - | ||||||||||||||||||
| 902 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 951, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug(); | 0-102 | ||||||||||||||||||
| 903 | clear(); | - | ||||||||||||||||||
| 904 | tableInvalid = false; | - | ||||||||||||||||||
| 905 | tableRebuilding = true; | - | ||||||||||||||||||
| 906 | calculateTableSize(); | - | ||||||||||||||||||
| 907 | loadInitialTopLeftItem(); | - | ||||||||||||||||||
| 908 | loadAndUnloadVisibleEdges(); | - | ||||||||||||||||||
| 909 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 910 | - | |||||||||||||||||||
| 911 | void QQuickTableViewPrivate::endRebuildTable() | - | ||||||||||||||||||
| 912 | { | - | ||||||||||||||||||
| 913 | tableRebuilding = false; | - | ||||||||||||||||||
| 914 | - | |||||||||||||||||||
| 915 | if (loadedItems.isEmpty()
| 0-102 | ||||||||||||||||||
| 916 | return; executed 102 times by 1 test: return;Executed by:
| 102 | ||||||||||||||||||
| 917 | - | |||||||||||||||||||
| 918 | - | |||||||||||||||||||
| 919 | - | |||||||||||||||||||
| 920 | - | |||||||||||||||||||
| 921 | columnWidths.clear(); | - | ||||||||||||||||||
| 922 | rowHeights.clear(); | - | ||||||||||||||||||
| 923 | if (tableSize.height() > 1
| 0 | ||||||||||||||||||
| 924 | calculateColumnWidthsAfterRebuilding(); never executed: calculateColumnWidthsAfterRebuilding(); | 0 | ||||||||||||||||||
| 925 | if (tableSize.width() > 1
| 0 | ||||||||||||||||||
| 926 | calculateRowHeightsAfterRebuilding(); never executed: calculateRowHeightsAfterRebuilding(); | 0 | ||||||||||||||||||
| 927 | - | |||||||||||||||||||
| 928 | relayoutTable(); | - | ||||||||||||||||||
| 929 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 978, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << tableLayoutToString(); | 0 | ||||||||||||||||||
| 930 | } never executed: end of block | 0 | ||||||||||||||||||
| 931 | - | |||||||||||||||||||
| 932 | void QQuickTableViewPrivate::loadInitialTopLeftItem() | - | ||||||||||||||||||
| 933 | { | - | ||||||||||||||||||
| 934 | ((loadedItems.isEmpty() || [&](){ dumpTable(); QMessageLogger(__FILE__, 983, __PRETTY_FUNCTION__).warning() << "output:" << ""; return never executed: false;return false;never executed: }()) ? static_cast<void>(0) : qt_assert("loadedItems.isEmpty() || [&](){ dumpTable(); qWarning() << \"output:\" << \"\"; return false;}()", __FILE__, 983));return false; | 0 | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | if (tableSize.isEmpty()
| 0-102 | ||||||||||||||||||
| 937 | return; executed 102 times by 1 test: return;Executed by:
| 102 | ||||||||||||||||||
| 938 | - | |||||||||||||||||||
| 939 | if (model->count() == 0
| 0 | ||||||||||||||||||
| 940 | return; never executed: return; | 0 | ||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | - | |||||||||||||||||||
| 943 | - | |||||||||||||||||||
| 944 | loadRequest.begin(QPoint(0, 0), QQmlIncubator::AsynchronousIfNested); | - | ||||||||||||||||||
| 945 | processLoadRequest(); | - | ||||||||||||||||||
| 946 | } never executed: end of block | 0 | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | void QQuickTableViewPrivate::unloadEdge(Qt::Edge edge) | - | ||||||||||||||||||
| 949 | { | - | ||||||||||||||||||
| 950 | unloadItems(rectangleEdge(loadedTable, edge)); | - | ||||||||||||||||||
| 951 | loadedTable = expandedRect(loadedTable, edge, -1); | - | ||||||||||||||||||
| 952 | syncLoadedTableRectFromLoadedTable(); | - | ||||||||||||||||||
| 953 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1002, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << tableLayoutToString(); | 0 | ||||||||||||||||||
| 954 | } never executed: end of block | 0 | ||||||||||||||||||
| 955 | - | |||||||||||||||||||
| 956 | void QQuickTableViewPrivate::loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMode incubationMode) | - | ||||||||||||||||||
| 957 | { | - | ||||||||||||||||||
| 958 | QLine cellsToLoad = rectangleEdge(expandedRect(loadedTable, edge, 1), edge); | - | ||||||||||||||||||
| 959 | loadRequest.begin(cellsToLoad, edge, incubationMode); | - | ||||||||||||||||||
| 960 | processLoadRequest(); | - | ||||||||||||||||||
| 961 | } never executed: end of block | 0 | ||||||||||||||||||
| 962 | - | |||||||||||||||||||
| 963 | void QQuickTableViewPrivate::loadAndUnloadVisibleEdges() | - | ||||||||||||||||||
| 964 | { | - | ||||||||||||||||||
| 965 | if (loadRequest.isActive()
| 0-102 | ||||||||||||||||||
| 966 | - | |||||||||||||||||||
| 967 | - | |||||||||||||||||||
| 968 | return; never executed: return; | 0 | ||||||||||||||||||
| 969 | } | - | ||||||||||||||||||
| 970 | - | |||||||||||||||||||
| 971 | if (loadedItems.isEmpty()
| 0-102 | ||||||||||||||||||
| 972 | - | |||||||||||||||||||
| 973 | - | |||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | return; executed 102 times by 1 test: return;Executed by:
| 102 | ||||||||||||||||||
| 976 | } | - | ||||||||||||||||||
| 977 | - | |||||||||||||||||||
| 978 | const QRectF unloadRect = hasBufferedItems
| 0 | ||||||||||||||||||
| 979 | bool tableModified; | - | ||||||||||||||||||
| 980 | - | |||||||||||||||||||
| 981 | do { | - | ||||||||||||||||||
| 982 | tableModified = false; | - | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | if (Qt::Edge edge = nextEdgeToUnload(unloadRect)
| 0 | ||||||||||||||||||
| 985 | tableModified = true; | - | ||||||||||||||||||
| 986 | unloadEdge(edge); | - | ||||||||||||||||||
| 987 | } never executed: end of block | 0 | ||||||||||||||||||
| 988 | - | |||||||||||||||||||
| 989 | if (Qt::Edge edge = nextEdgeToLoad(viewportRect)
| 0 | ||||||||||||||||||
| 990 | tableModified = true; | - | ||||||||||||||||||
| 991 | loadEdge(edge, QQmlIncubator::AsynchronousIfNested); | - | ||||||||||||||||||
| 992 | if (loadRequest.isActive()
| 0 | ||||||||||||||||||
| 993 | return; never executed: return; | 0 | ||||||||||||||||||
| 994 | } never executed: end of block | 0 | ||||||||||||||||||
| 995 | } never executed: while (tableModifiedend of block
| 0 | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | } never executed: end of block | 0 | ||||||||||||||||||
| 998 | - | |||||||||||||||||||
| 999 | void QQuickTableViewPrivate::loadBuffer() | - | ||||||||||||||||||
| 1000 | { | - | ||||||||||||||||||
| 1001 | - | |||||||||||||||||||
| 1002 | - | |||||||||||||||||||
| 1003 | - | |||||||||||||||||||
| 1004 | if (cacheBuffer <= 0
| 0 | ||||||||||||||||||
| 1005 | return; never executed: return; | 0 | ||||||||||||||||||
| 1006 | - | |||||||||||||||||||
| 1007 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1066, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug(); | 0 | ||||||||||||||||||
| 1008 | const QRectF loadRect = bufferRect(); | - | ||||||||||||||||||
| 1009 | while (Qt::Edge edge = nextEdgeToLoad(loadRect)
| 0 | ||||||||||||||||||
| 1010 | loadEdge(edge, QQmlIncubator::Asynchronous); | - | ||||||||||||||||||
| 1011 | if (loadRequest.isActive()
| 0 | ||||||||||||||||||
| 1012 | break; never executed: break; | 0 | ||||||||||||||||||
| 1013 | } never executed: end of block | 0 | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | hasBufferedItems = true; | - | ||||||||||||||||||
| 1016 | } never executed: end of block | 0 | ||||||||||||||||||
| 1017 | - | |||||||||||||||||||
| 1018 | void QQuickTableViewPrivate::unloadBuffer() | - | ||||||||||||||||||
| 1019 | { | - | ||||||||||||||||||
| 1020 | if (!hasBufferedItems
| 0-102 | ||||||||||||||||||
| 1021 | return; executed 102 times by 1 test: return;Executed by:
| 102 | ||||||||||||||||||
| 1022 | - | |||||||||||||||||||
| 1023 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1082, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug(); | 0 | ||||||||||||||||||
| 1024 | hasBufferedItems = false; | - | ||||||||||||||||||
| 1025 | cacheBufferDelayTimer.stop(); | - | ||||||||||||||||||
| 1026 | if (loadRequest.isActive()
| 0 | ||||||||||||||||||
| 1027 | cancelLoadRequest(); never executed: cancelLoadRequest(); | 0 | ||||||||||||||||||
| 1028 | while (Qt::Edge edge = nextEdgeToUnload(viewportRect)
| 0 | ||||||||||||||||||
| 1029 | unloadEdge(edge); never executed: unloadEdge(edge); | 0 | ||||||||||||||||||
| 1030 | } never executed: end of block | 0 | ||||||||||||||||||
| 1031 | - | |||||||||||||||||||
| 1032 | QRectF QQuickTableViewPrivate::bufferRect() | - | ||||||||||||||||||
| 1033 | { | - | ||||||||||||||||||
| 1034 | return never executed: viewportRect.adjusted(-cacheBuffer, -cacheBuffer, cacheBuffer, cacheBuffer);return viewportRect.adjusted(-cacheBuffer, -cacheBuffer, cacheBuffer, cacheBuffer);never executed: return viewportRect.adjusted(-cacheBuffer, -cacheBuffer, cacheBuffer, cacheBuffer); | 0 | ||||||||||||||||||
| 1035 | } | - | ||||||||||||||||||
| 1036 | - | |||||||||||||||||||
| 1037 | void QQuickTableViewPrivate::invalidateTable() { | - | ||||||||||||||||||
| 1038 | tableInvalid = true; | - | ||||||||||||||||||
| 1039 | if (loadRequest.isActive()
| 0-102 | ||||||||||||||||||
| 1040 | cancelLoadRequest(); never executed: cancelLoadRequest(); | 0 | ||||||||||||||||||
| 1041 | q_func()->polish(); | - | ||||||||||||||||||
| 1042 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1043 | - | |||||||||||||||||||
| 1044 | void QQuickTableViewPrivate::invalidateColumnRowPositions() { | - | ||||||||||||||||||
| 1045 | columnRowPositionsInvalid = true; | - | ||||||||||||||||||
| 1046 | q_func()->polish(); | - | ||||||||||||||||||
| 1047 | } executed 200 times by 1 test: end of blockExecuted by:
| 200 | ||||||||||||||||||
| 1048 | - | |||||||||||||||||||
| 1049 | void QQuickTableViewPrivate::updatePolish() | - | ||||||||||||||||||
| 1050 | { | - | ||||||||||||||||||
| 1051 | - | |||||||||||||||||||
| 1052 | - | |||||||||||||||||||
| 1053 | - | |||||||||||||||||||
| 1054 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 1055 | - | |||||||||||||||||||
| 1056 | if (loadRequest.isActive()
| 0-306 | ||||||||||||||||||
| 1057 | - | |||||||||||||||||||
| 1058 | - | |||||||||||||||||||
| 1059 | - | |||||||||||||||||||
| 1060 | - | |||||||||||||||||||
| 1061 | return; never executed: return; | 0 | ||||||||||||||||||
| 1062 | } | - | ||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | - | |||||||||||||||||||
| 1065 | - | |||||||||||||||||||
| 1066 | - | |||||||||||||||||||
| 1067 | viewportRect = QRectF(q->contentX(), q->contentY(), q->width(), q->height()); | - | ||||||||||||||||||
| 1068 | if (!viewportRect.isValid()
| 102-204 | ||||||||||||||||||
| 1069 | return; executed 102 times by 1 test: return;Executed by:
| 102 | ||||||||||||||||||
| 1070 | - | |||||||||||||||||||
| 1071 | if (tableInvalid
| 102 | ||||||||||||||||||
| 1072 | beginRebuildTable(); | - | ||||||||||||||||||
| 1073 | if (loadRequest.isActive()
| 0-102 | ||||||||||||||||||
| 1074 | return; never executed: return; | 0 | ||||||||||||||||||
| 1075 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1076 | - | |||||||||||||||||||
| 1077 | if (tableRebuilding
| 102 | ||||||||||||||||||
| 1078 | endRebuildTable(); executed 102 times by 1 test: endRebuildTable();Executed by:
| 102 | ||||||||||||||||||
| 1079 | - | |||||||||||||||||||
| 1080 | if (loadedItems.isEmpty()
| 0-204 | ||||||||||||||||||
| 1081 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle()().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1140, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle()().categoryName()).debug() << "no items loaded, meaning empty model or no delegate"; | 0-204 | ||||||||||||||||||
| 1082 | return; executed 204 times by 1 test: return;Executed by:
| 204 | ||||||||||||||||||
| 1083 | } | - | ||||||||||||||||||
| 1084 | - | |||||||||||||||||||
| 1085 | if (columnRowPositionsInvalid
| 0 | ||||||||||||||||||
| 1086 | relayoutTable(); never executed: relayoutTable(); | 0 | ||||||||||||||||||
| 1087 | - | |||||||||||||||||||
| 1088 | if (hasBufferedItems
| 0 | ||||||||||||||||||
| 1089 | - | |||||||||||||||||||
| 1090 | - | |||||||||||||||||||
| 1091 | unloadBuffer(); | - | ||||||||||||||||||
| 1092 | } never executed: end of block | 0 | ||||||||||||||||||
| 1093 | - | |||||||||||||||||||
| 1094 | loadAndUnloadVisibleEdges(); | - | ||||||||||||||||||
| 1095 | - | |||||||||||||||||||
| 1096 | if (loadRequest.isActive()
| 0 | ||||||||||||||||||
| 1097 | return; never executed: return; | 0 | ||||||||||||||||||
| 1098 | - | |||||||||||||||||||
| 1099 | if (cacheBuffer > 0
| 0 | ||||||||||||||||||
| 1100 | - | |||||||||||||||||||
| 1101 | - | |||||||||||||||||||
| 1102 | - | |||||||||||||||||||
| 1103 | - | |||||||||||||||||||
| 1104 | cacheBufferDelayTimer.start(kBufferTimerInterval); | - | ||||||||||||||||||
| 1105 | } never executed: end of block | 0 | ||||||||||||||||||
| 1106 | } never executed: end of block | 0 | ||||||||||||||||||
| 1107 | - | |||||||||||||||||||
| 1108 | void QQuickTableViewPrivate::createWrapperModel() | - | ||||||||||||||||||
| 1109 | { | - | ||||||||||||||||||
| 1110 | QQuickTableView * const q = q_func(); | - | ||||||||||||||||||
| 1111 | - | |||||||||||||||||||
| 1112 | delegateModel = new QQmlDelegateModel(qmlContext(q), q); | - | ||||||||||||||||||
| 1113 | if (q->isComponentComplete()
| 0-102 | ||||||||||||||||||
| 1114 | delegateModel->componentComplete(); never executed: delegateModel->componentComplete(); | 0 | ||||||||||||||||||
| 1115 | model = delegateModel; | - | ||||||||||||||||||
| 1116 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1117 | - | |||||||||||||||||||
| 1118 | void QQuickTableViewPrivate::itemCreatedCallback(int modelIndex, QObject*) | - | ||||||||||||||||||
| 1119 | { | - | ||||||||||||||||||
| 1120 | if (blockItemCreatedCallback
| 0 | ||||||||||||||||||
| 1121 | return; never executed: return; | 0 | ||||||||||||||||||
| 1122 | - | |||||||||||||||||||
| 1123 | for (bool qt_category_enabled = lcTableViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1182, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << "item done loading:" << cellAtModelIndex(modelIndex); | 0 | ||||||||||||||||||
| 1124 | << cellAtModelIndex(modelIndex); never executed: QMessageLogger(__FILE__, 1182, __PRETTY_FUNCTION__, lcTableViewDelegateLifecycle().categoryName()).debug() << "item done loading:" << cellAtModelIndex(modelIndex); | 0 | ||||||||||||||||||
| 1125 | - | |||||||||||||||||||
| 1126 | - | |||||||||||||||||||
| 1127 | - | |||||||||||||||||||
| 1128 | - | |||||||||||||||||||
| 1129 | - | |||||||||||||||||||
| 1130 | processLoadRequest(); | - | ||||||||||||||||||
| 1131 | loadAndUnloadVisibleEdges(); | - | ||||||||||||||||||
| 1132 | updatePolish(); | - | ||||||||||||||||||
| 1133 | } never executed: end of block | 0 | ||||||||||||||||||
| 1134 | - | |||||||||||||||||||
| 1135 | void QQuickTableViewPrivate::initItemCallback(int modelIndex, QObject *object) | - | ||||||||||||||||||
| 1136 | { | - | ||||||||||||||||||
| 1137 | (void)modelIndex;; | - | ||||||||||||||||||
| 1138 | auto attached = getAttachedObject(object); | - | ||||||||||||||||||
| 1139 | if (!attached
| 0 | ||||||||||||||||||
| 1140 | return; never executed: return; | 0 | ||||||||||||||||||
| 1141 | - | |||||||||||||||||||
| 1142 | - | |||||||||||||||||||
| 1143 | - | |||||||||||||||||||
| 1144 | - | |||||||||||||||||||
| 1145 | - | |||||||||||||||||||
| 1146 | - | |||||||||||||||||||
| 1147 | - | |||||||||||||||||||
| 1148 | QPoint cell = cellAtModelIndex(modelIndex); | - | ||||||||||||||||||
| 1149 | attached->setTableView(q_func()); | - | ||||||||||||||||||
| 1150 | attached->setColumn(cell.x()); | - | ||||||||||||||||||
| 1151 | attached->setRow(cell.y()); | - | ||||||||||||||||||
| 1152 | } never executed: end of block | 0 | ||||||||||||||||||
| 1153 | - | |||||||||||||||||||
| 1154 | void QQuickTableViewPrivate::modelUpdated(const QQmlChangeSet &changeSet, bool reset) | - | ||||||||||||||||||
| 1155 | { | - | ||||||||||||||||||
| 1156 | (void)changeSet;; | - | ||||||||||||||||||
| 1157 | (void)reset;; | - | ||||||||||||||||||
| 1158 | - | |||||||||||||||||||
| 1159 | - | |||||||||||||||||||
| 1160 | invalidateTable(); | - | ||||||||||||||||||
| 1161 | } never executed: end of block | 0 | ||||||||||||||||||
| 1162 | - | |||||||||||||||||||
| 1163 | QQuickTableView::QQuickTableView(QQuickItem *parent) | - | ||||||||||||||||||
| 1164 | : QQuickFlickable(*(new QQuickTableViewPrivate), parent) | - | ||||||||||||||||||
| 1165 | { | - | ||||||||||||||||||
| 1166 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1167 | - | |||||||||||||||||||
| 1168 | int QQuickTableView::rows() const | - | ||||||||||||||||||
| 1169 | { | - | ||||||||||||||||||
| 1170 | return never executed: d_func()->tableSize.height();return d_func()->tableSize.height();never executed: return d_func()->tableSize.height(); | 0 | ||||||||||||||||||
| 1171 | } | - | ||||||||||||||||||
| 1172 | - | |||||||||||||||||||
| 1173 | int QQuickTableView::columns() const | - | ||||||||||||||||||
| 1174 | { | - | ||||||||||||||||||
| 1175 | return never executed: d_func()->tableSize.width();return d_func()->tableSize.width();never executed: return d_func()->tableSize.width(); | 0 | ||||||||||||||||||
| 1176 | } | - | ||||||||||||||||||
| 1177 | - | |||||||||||||||||||
| 1178 | qreal QQuickTableView::rowSpacing() const | - | ||||||||||||||||||
| 1179 | { | - | ||||||||||||||||||
| 1180 | return never executed: d_func()->cellSpacing.height();return d_func()->cellSpacing.height();never executed: return d_func()->cellSpacing.height(); | 0 | ||||||||||||||||||
| 1181 | } | - | ||||||||||||||||||
| 1182 | - | |||||||||||||||||||
| 1183 | void QQuickTableView::setRowSpacing(qreal spacing) | - | ||||||||||||||||||
| 1184 | { | - | ||||||||||||||||||
| 1185 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1186 | if (qFuzzyCompare(d->cellSpacing.height(), spacing)
| 0-100 | ||||||||||||||||||
| 1187 | return; never executed: return; | 0 | ||||||||||||||||||
| 1188 | - | |||||||||||||||||||
| 1189 | d->cellSpacing.setHeight(spacing); | - | ||||||||||||||||||
| 1190 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1191 | rowSpacingChanged(); | - | ||||||||||||||||||
| 1192 | } executed 100 times by 1 test: end of blockExecuted by:
| 100 | ||||||||||||||||||
| 1193 | - | |||||||||||||||||||
| 1194 | qreal QQuickTableView::columnSpacing() const | - | ||||||||||||||||||
| 1195 | { | - | ||||||||||||||||||
| 1196 | return never executed: d_func()->cellSpacing.width();return d_func()->cellSpacing.width();never executed: return d_func()->cellSpacing.width(); | 0 | ||||||||||||||||||
| 1197 | } | - | ||||||||||||||||||
| 1198 | - | |||||||||||||||||||
| 1199 | void QQuickTableView::setColumnSpacing(qreal spacing) | - | ||||||||||||||||||
| 1200 | { | - | ||||||||||||||||||
| 1201 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1202 | if (qFuzzyCompare(d->cellSpacing.width(), spacing)
| 0-100 | ||||||||||||||||||
| 1203 | return; never executed: return; | 0 | ||||||||||||||||||
| 1204 | - | |||||||||||||||||||
| 1205 | d->cellSpacing.setWidth(spacing); | - | ||||||||||||||||||
| 1206 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1207 | columnSpacingChanged(); | - | ||||||||||||||||||
| 1208 | } executed 100 times by 1 test: end of blockExecuted by:
| 100 | ||||||||||||||||||
| 1209 | - | |||||||||||||||||||
| 1210 | qreal QQuickTableView::topMargin() const | - | ||||||||||||||||||
| 1211 | { | - | ||||||||||||||||||
| 1212 | return never executed: d_func()->tableMargins.top();return d_func()->tableMargins.top();never executed: return d_func()->tableMargins.top(); | 0 | ||||||||||||||||||
| 1213 | } | - | ||||||||||||||||||
| 1214 | - | |||||||||||||||||||
| 1215 | void QQuickTableView::setTopMargin(qreal margin) | - | ||||||||||||||||||
| 1216 | { | - | ||||||||||||||||||
| 1217 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1218 | if (qt_is_nan(margin)
| 0 | ||||||||||||||||||
| 1219 | return; never executed: return; | 0 | ||||||||||||||||||
| 1220 | if (qFuzzyCompare(d->tableMargins.top(), margin)
| 0 | ||||||||||||||||||
| 1221 | return; never executed: return; | 0 | ||||||||||||||||||
| 1222 | - | |||||||||||||||||||
| 1223 | d->tableMargins.setTop(margin); | - | ||||||||||||||||||
| 1224 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1225 | topMarginChanged(); | - | ||||||||||||||||||
| 1226 | } never executed: end of block | 0 | ||||||||||||||||||
| 1227 | - | |||||||||||||||||||
| 1228 | qreal QQuickTableView::bottomMargin() const | - | ||||||||||||||||||
| 1229 | { | - | ||||||||||||||||||
| 1230 | return never executed: d_func()->tableMargins.bottom();return d_func()->tableMargins.bottom();never executed: return d_func()->tableMargins.bottom(); | 0 | ||||||||||||||||||
| 1231 | } | - | ||||||||||||||||||
| 1232 | - | |||||||||||||||||||
| 1233 | void QQuickTableView::setBottomMargin(qreal margin) | - | ||||||||||||||||||
| 1234 | { | - | ||||||||||||||||||
| 1235 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1236 | if (qt_is_nan(margin)
| 0 | ||||||||||||||||||
| 1237 | return; never executed: return; | 0 | ||||||||||||||||||
| 1238 | if (qFuzzyCompare(d->tableMargins.bottom(), margin)
| 0 | ||||||||||||||||||
| 1239 | return; never executed: return; | 0 | ||||||||||||||||||
| 1240 | - | |||||||||||||||||||
| 1241 | d->tableMargins.setBottom(margin); | - | ||||||||||||||||||
| 1242 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1243 | bottomMarginChanged(); | - | ||||||||||||||||||
| 1244 | } never executed: end of block | 0 | ||||||||||||||||||
| 1245 | - | |||||||||||||||||||
| 1246 | qreal QQuickTableView::leftMargin() const | - | ||||||||||||||||||
| 1247 | { | - | ||||||||||||||||||
| 1248 | return never executed: d_func()->tableMargins.left();return d_func()->tableMargins.left();never executed: return d_func()->tableMargins.left(); | 0 | ||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||
| 1250 | - | |||||||||||||||||||
| 1251 | void QQuickTableView::setLeftMargin(qreal margin) | - | ||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||
| 1253 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1254 | if (qt_is_nan(margin)
| 0 | ||||||||||||||||||
| 1255 | return; never executed: return; | 0 | ||||||||||||||||||
| 1256 | if (qFuzzyCompare(d->tableMargins.left(), margin)
| 0 | ||||||||||||||||||
| 1257 | return; never executed: return; | 0 | ||||||||||||||||||
| 1258 | - | |||||||||||||||||||
| 1259 | d->tableMargins.setLeft(margin); | - | ||||||||||||||||||
| 1260 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1261 | leftMarginChanged(); | - | ||||||||||||||||||
| 1262 | } never executed: end of block | 0 | ||||||||||||||||||
| 1263 | - | |||||||||||||||||||
| 1264 | qreal QQuickTableView::rightMargin() const | - | ||||||||||||||||||
| 1265 | { | - | ||||||||||||||||||
| 1266 | return never executed: d_func()->tableMargins.right();return d_func()->tableMargins.right();never executed: return d_func()->tableMargins.right(); | 0 | ||||||||||||||||||
| 1267 | } | - | ||||||||||||||||||
| 1268 | - | |||||||||||||||||||
| 1269 | void QQuickTableView::setRightMargin(qreal margin) | - | ||||||||||||||||||
| 1270 | { | - | ||||||||||||||||||
| 1271 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1272 | if (qt_is_nan(margin)
| 0 | ||||||||||||||||||
| 1273 | return; never executed: return; | 0 | ||||||||||||||||||
| 1274 | if (qFuzzyCompare(d->tableMargins.right(), margin)
| 0 | ||||||||||||||||||
| 1275 | return; never executed: return; | 0 | ||||||||||||||||||
| 1276 | - | |||||||||||||||||||
| 1277 | d->tableMargins.setRight(margin); | - | ||||||||||||||||||
| 1278 | d->invalidateColumnRowPositions(); | - | ||||||||||||||||||
| 1279 | rightMarginChanged(); | - | ||||||||||||||||||
| 1280 | } never executed: end of block | 0 | ||||||||||||||||||
| 1281 | - | |||||||||||||||||||
| 1282 | int QQuickTableView::cacheBuffer() const | - | ||||||||||||||||||
| 1283 | { | - | ||||||||||||||||||
| 1284 | return never executed: d_func()->cacheBuffer;return d_func()->cacheBuffer;never executed: return d_func()->cacheBuffer; | 0 | ||||||||||||||||||
| 1285 | } | - | ||||||||||||||||||
| 1286 | - | |||||||||||||||||||
| 1287 | void QQuickTableView::setCacheBuffer(int newBuffer) | - | ||||||||||||||||||
| 1288 | { | - | ||||||||||||||||||
| 1289 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1290 | if (d->cacheBuffer == newBuffer
| 0-102 | ||||||||||||||||||
| 1291 | return; never executed: return; | 0 | ||||||||||||||||||
| 1292 | - | |||||||||||||||||||
| 1293 | d->cacheBuffer = newBuffer; | - | ||||||||||||||||||
| 1294 | - | |||||||||||||||||||
| 1295 | if (newBuffer == 0
| 0-102 | ||||||||||||||||||
| 1296 | d->unloadBuffer(); executed 102 times by 1 test: d->unloadBuffer();Executed by:
| 102 | ||||||||||||||||||
| 1297 | - | |||||||||||||||||||
| 1298 | cacheBufferChanged(); | - | ||||||||||||||||||
| 1299 | polish(); | - | ||||||||||||||||||
| 1300 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1301 | - | |||||||||||||||||||
| 1302 | QVariant QQuickTableView::model() const | - | ||||||||||||||||||
| 1303 | { | - | ||||||||||||||||||
| 1304 | return never executed: d_func()->modelVariant;return d_func()->modelVariant;never executed: return d_func()->modelVariant; | 0 | ||||||||||||||||||
| 1305 | } | - | ||||||||||||||||||
| 1306 | - | |||||||||||||||||||
| 1307 | void QQuickTableView::setModel(const QVariant &newModel) | - | ||||||||||||||||||
| 1308 | { | - | ||||||||||||||||||
| 1309 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1310 | - | |||||||||||||||||||
| 1311 | d->modelVariant = newModel; | - | ||||||||||||||||||
| 1312 | QVariant effectiveModelVariant = d->modelVariant; | - | ||||||||||||||||||
| 1313 | if (effectiveModelVariant.userType() == qMetaTypeId<QJSValue>()
| 0 | ||||||||||||||||||
| 1314 | effectiveModelVariant = effectiveModelVariant.value<QJSValue>().toVariant(); never executed: effectiveModelVariant = effectiveModelVariant.value<QJSValue>().toVariant(); | 0 | ||||||||||||||||||
| 1315 | - | |||||||||||||||||||
| 1316 | if (d->model
| 0 | ||||||||||||||||||
| 1317 | QObjectPrivate::disconnect(d->model, &QQmlInstanceModel::createdItem, d, &QQuickTableViewPrivate::itemCreatedCallback); | - | ||||||||||||||||||
| 1318 | QObjectPrivate::disconnect(d->model, &QQmlInstanceModel::initItem, d, &QQuickTableViewPrivate::initItemCallback); | - | ||||||||||||||||||
| 1319 | QObjectPrivate::disconnect(d->model, &QQmlInstanceModel::modelUpdated, d, &QQuickTableViewPrivate::modelUpdated); | - | ||||||||||||||||||
| 1320 | } never executed: end of block | 0 | ||||||||||||||||||
| 1321 | - | |||||||||||||||||||
| 1322 | const auto instanceModel = qobject_cast<QQmlInstanceModel *>(qvariant_cast<QObject*>(effectiveModelVariant)); | - | ||||||||||||||||||
| 1323 | - | |||||||||||||||||||
| 1324 | if (instanceModel
| 0 | ||||||||||||||||||
| 1325 | if (d->delegateModel
| 0 | ||||||||||||||||||
| 1326 | delete d->delegateModel; never executed: delete d->delegateModel; | 0 | ||||||||||||||||||
| 1327 | d->model = instanceModel; | - | ||||||||||||||||||
| 1328 | d->delegateModel = qmlobject_cast<QQmlDelegateModel *>(instanceModel); | - | ||||||||||||||||||
| 1329 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 1330 | if (!d->delegateModel
| 0 | ||||||||||||||||||
| 1331 | d->createWrapperModel(); never executed: d->createWrapperModel(); | 0 | ||||||||||||||||||
| 1332 | QQmlDelegateModelPrivate::get(d->delegateModel)->m_useFirstColumnOnly = false; | - | ||||||||||||||||||
| 1333 | d->delegateModel->setModel(effectiveModelVariant); | - | ||||||||||||||||||
| 1334 | } never executed: end of block | 0 | ||||||||||||||||||
| 1335 | - | |||||||||||||||||||
| 1336 | ((d->model) ? static_cast<void>(0) : qt_assert("d->model", __FILE__, 1395)); | - | ||||||||||||||||||
| 1337 | QObjectPrivate::connect(d->model, &QQmlInstanceModel::createdItem, d, &QQuickTableViewPrivate::itemCreatedCallback); | - | ||||||||||||||||||
| 1338 | QObjectPrivate::connect(d->model, &QQmlInstanceModel::initItem, d, &QQuickTableViewPrivate::initItemCallback); | - | ||||||||||||||||||
| 1339 | QObjectPrivate::connect(d->model, &QQmlInstanceModel::modelUpdated, d, &QQuickTableViewPrivate::modelUpdated); | - | ||||||||||||||||||
| 1340 | - | |||||||||||||||||||
| 1341 | d->invalidateTable(); | - | ||||||||||||||||||
| 1342 | - | |||||||||||||||||||
| 1343 | modelChanged(); | - | ||||||||||||||||||
| 1344 | } never executed: end of block | 0 | ||||||||||||||||||
| 1345 | - | |||||||||||||||||||
| 1346 | QQmlComponent *QQuickTableView::delegate() const | - | ||||||||||||||||||
| 1347 | { | - | ||||||||||||||||||
| 1348 | const QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1349 | if (d->delegateModel
| 0-102 | ||||||||||||||||||
| 1350 | return never executed: d->delegateModel->delegate();return d->delegateModel->delegate();never executed: return d->delegateModel->delegate(); | 0 | ||||||||||||||||||
| 1351 | - | |||||||||||||||||||
| 1352 | return executed 102 times by 1 test: nullptr;return nullptr;Executed by:
executed 102 times by 1 test: return nullptr;Executed by:
| 102 | ||||||||||||||||||
| 1353 | } | - | ||||||||||||||||||
| 1354 | - | |||||||||||||||||||
| 1355 | void QQuickTableView::setDelegate(QQmlComponent *newDelegate) | - | ||||||||||||||||||
| 1356 | { | - | ||||||||||||||||||
| 1357 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1358 | if (newDelegate == delegate()
| 0-102 | ||||||||||||||||||
| 1359 | return; never executed: return; | 0 | ||||||||||||||||||
| 1360 | - | |||||||||||||||||||
| 1361 | if (!d->delegateModel
| 0-102 | ||||||||||||||||||
| 1362 | d->createWrapperModel(); executed 102 times by 1 test: d->createWrapperModel();Executed by:
| 102 | ||||||||||||||||||
| 1363 | - | |||||||||||||||||||
| 1364 | d->delegateModel->setDelegate(newDelegate); | - | ||||||||||||||||||
| 1365 | d->invalidateTable(); | - | ||||||||||||||||||
| 1366 | - | |||||||||||||||||||
| 1367 | delegateChanged(); | - | ||||||||||||||||||
| 1368 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1369 | - | |||||||||||||||||||
| 1370 | QQuickTableViewAttached *QQuickTableView::qmlAttachedProperties(QObject *obj) | - | ||||||||||||||||||
| 1371 | { | - | ||||||||||||||||||
| 1372 | return never executed: new QQuickTableViewAttached(obj);return new QQuickTableViewAttached(obj);never executed: return new QQuickTableViewAttached(obj); | 0 | ||||||||||||||||||
| 1373 | } | - | ||||||||||||||||||
| 1374 | - | |||||||||||||||||||
| 1375 | void QQuickTableView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | - | ||||||||||||||||||
| 1376 | { | - | ||||||||||||||||||
| 1377 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1378 | QQuickFlickable::geometryChanged(newGeometry, oldGeometry); | - | ||||||||||||||||||
| 1379 | - | |||||||||||||||||||
| 1380 | - | |||||||||||||||||||
| 1381 | - | |||||||||||||||||||
| 1382 | d->updatePolish(); | - | ||||||||||||||||||
| 1383 | } executed 204 times by 1 test: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 1384 | - | |||||||||||||||||||
| 1385 | void QQuickTableView::viewportMoved(Qt::Orientations orientation) | - | ||||||||||||||||||
| 1386 | { | - | ||||||||||||||||||
| 1387 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1388 | QQuickFlickable::viewportMoved(orientation); | - | ||||||||||||||||||
| 1389 | - | |||||||||||||||||||
| 1390 | - | |||||||||||||||||||
| 1391 | - | |||||||||||||||||||
| 1392 | d->updatePolish(); | - | ||||||||||||||||||
| 1393 | } never executed: end of block | 0 | ||||||||||||||||||
| 1394 | - | |||||||||||||||||||
| 1395 | void QQuickTableView::componentComplete() | - | ||||||||||||||||||
| 1396 | { | - | ||||||||||||||||||
| 1397 | QQuickTableViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1398 | - | |||||||||||||||||||
| 1399 | if (!d->model
| 0-102 | ||||||||||||||||||
| 1400 | setModel(QVariant()); never executed: setModel(QVariant()); | 0 | ||||||||||||||||||
| 1401 | - | |||||||||||||||||||
| 1402 | if (d->delegateModel
| 0-102 | ||||||||||||||||||
| 1403 | d->delegateModel->componentComplete(); executed 102 times by 1 test: d->delegateModel->componentComplete();Executed by:
| 102 | ||||||||||||||||||
| 1404 | - | |||||||||||||||||||
| 1405 | QQuickFlickable::componentComplete(); | - | ||||||||||||||||||
| 1406 | } executed 102 times by 1 test: end of blockExecuted by:
| 102 | ||||||||||||||||||
| 1407 | - | |||||||||||||||||||
| 1408 | - | |||||||||||||||||||
| 1409 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |