Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Create built-in quick component in C++
Forum Updated to NodeBB v4.3 + New Features

Create built-in quick component in C++

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    The_Progger
    wrote on 7 May 2013, 16:31 last edited by
    #1

    I need to create QQuickText in C++. I use this code:

    @
    QQmlType *type = QQmlMetaType::qmlType("QtQuick/Text", 2, 0);
    if (type)
    {
    QObject *obj = type->create();
    QQuickItem item = qobject_cast<QQuickItem>(obj);
    qDebug() << item;
    }
    @

    It work, but I had to include <private/qqmlmetatype_p.h>. There is another way?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 8 May 2013, 07:55 last edited by
      #2

      See "this":http://qt-project.org/doc/qt-4.8/qtbinding.html#loading-qml-components-from-c guide (it's for QtQuick 1, but it works the same in QML2, you just need to change class names).

      (Z(:^

      1 Reply Last reply
      0

      1/2

      7 May 2013, 16:31

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved