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. [Partially Solved] QML & qmlRegisterType
Forum Updated to NodeBB v4.3 + New Features

[Partially Solved] QML & qmlRegisterType

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 3.2k 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.
  • W Offline
    W Offline
    Wroman
    wrote on last edited by
    #1

    Hi there,

    i'm a bit confused with qml type registering and QObject-derived objects.

    In my case, i would like to use QToolBox in my QML GUI.

    EDIT : My bad, QToolBox is a QWidget-derived object...

    How am i supposed to do this ?

    I tried a basic :

    @ qmlRegisterType<QToolBox>("MyQMLObjects.MyToolBox", 1, 0, "QToolBox");@

    in my main.cpp before importing in my main.qml :

    @import MyQMLObjects.MyToolBox 1.0;@

    And here it asks me plenty of weird message i usually had when i have MOC Problems. (You see, it's kinda "_Qfbksdqbgflsdfjqùm21 not found in moc_dummy.cpp at line 42.")

    So, my question is : Can i expose QtWidgets such as QToolBox, QMenu... in QML ?

    Trust me, i'm an engineer !

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Torgeir
      wrote on last edited by
      #2

      You can't quite do it like this, particularly if you want to use the widgets as items in QML.

      Google 'QML embed QWidget' and you can see examples for how to do this with QGraphicsProxyWidget.
      That is a solution that only works for QtQuick 1.1. For QtQuick 2.0 I don't know if/how that could be achieved.

      QGraphicsProxyWidget example is "here":http://doc.qt.digia.com/4.7/declarative-cppextensions-qwidgets.html

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wroman
        wrote on last edited by
        #3

        Thanks for the reply.

        And yeah, i found QGraphicsProxyWidget and was trying to find the QtQuick2.0 way of doing quite the same thing.

        Obviously, the straightest way would be to code the plugin I needed. Just as the qml-QPushButton which is described in Qt examples. If it's no longer possible or recommanded in QtQuick2.0 to use QGraphicsProxyWidget, I guess the solution is here to recode what i need in a QML plugin.

        If someone has a clue about the QtQuick2.0 way of doing this, It could be great.

        Trust me, i'm an engineer !

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wroman
          wrote on last edited by
          #4

          So, i had a look around and what i've found i mostly "wait 5.1".

          If someone has another clue, i would be grateful. If not, i'll wait for 5.1.

          Trust me, i'm an engineer !

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Feanoreal
            wrote on last edited by
            #5

            So, in new qt qiuck2 .0from qt 5.1 i can use qmlRegisterType or not? Can't find information about it. :{

            edit: http://doc-snapshot.qt-project.org/qt5-stable/qtquickdialogs/qml-qtquick-dialogs1-filedialog.html

            1 Reply Last reply
            0

            • Login

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