| 278 | } |
| 279 | |
| 280 | auto TableGroupItem::createFromComponent(QQmlComponent& component) -> QQuickItem* |
| 281 | { |
| 282 | if (!component.isReady()) { |
| 283 | qWarning() << "qan::TableGroupItem::classBegin(): createTableCell(): Error table cell component is not ready."; |
| 284 | qWarning() << component.errorString(); |
| 285 | return nullptr; |
| 286 | } |
| 287 | const auto rootContext = qmlContext(this); |
| 288 | if (rootContext == nullptr) { |
| 289 | qWarning() << "qan::TableGroupItem::classBegin(): createTableCell(): Error, no QML context."; |
| 290 | return nullptr; |
| 291 | } |
| 292 | QQuickItem* item = nullptr; |
| 293 | QObject* object = component.beginCreate(rootContext); |
| 294 | if (object == nullptr || |
| 295 | component.isError()) { |
| 296 | if (object != nullptr) |
| 297 | object->deleteLater(); |
| 298 | return nullptr; |
| 299 | } |
| 300 | component.completeCreate(); |
| 301 | if (!component.isError()) { |
| 302 | QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership); |
| 303 | item = qobject_cast<QQuickItem*>(object); |
| 304 | } // Note: There is no leak until cpp ownership is set |
| 305 | if (item != nullptr) |
| 306 | item->setVisible(true); |
| 307 | return item; |
| 308 | }; |
| 309 | |
| 310 | void TableGroupItem::initializeTableLayout() |
| 311 | { |
nothing calls this directly
no outgoing calls
no test coverage detected