MCPcopy Create free account
hub / github.com/cneben/QuickQanava / createFromComponent

Method createFromComponent

src/qanTableGroupItem.cpp:280–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280auto 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
310void TableGroupItem::initializeTableLayout()
311{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected