Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.48 KB | None | 0 0
  1. QQuickItem* PluginBase::createObject(QQmlEngine* engine, QUrl qmlFile)
  2. {
  3.     QQmlComponent component(engine, qmlFile);
  4.     if (component.status() == QQmlComponent::Ready)
  5.     {
  6.         auto item = qobject_cast<QQuickItem*>(component.create());
  7.         QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership);
  8.         m_items.append(item);
  9.         return item;
  10.     } else
  11.     {
  12.         emit error(component.errors().last().toString());
  13.         return nullptr;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement