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. Embed QML Item in QWidget
Forum Updated to NodeBB v4.3 + New Features

Embed QML Item in QWidget

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 3.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.
  • M Offline
    M Offline
    mojo_risin
    wrote on last edited by
    #1

    Hello

    I need to have some "analog" gauges in my QWidget application. So far the best way to create the gauges appears to be QtQuick. I have never used it before, but I think I can manage to make what I need using the examples. However, I do not want to develop my whole app in QtQuick. Is it possible to create an item with its signals and slots, and the embed it into a QWidget? And is it a good idea to do so? I am reading "Integrating QML in existing QT UI code" and it looks like there is a way. But before I start, I would like to hear if I am on the right path here. I would also be grateful for any tutorials regarding this topic.

    Thanks a lot

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Have a look at "QQuickwidget":http://doc.qt.io/qt-5/qquickwidget.html. It can be used with other Qt Widgets. You can find an example there. There's QQuickWidget in QtCreator's widget box too just like other widgets.

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mojo_risin
        wrote on last edited by
        #3

        Thanks for the link. I managed to get the thing working before I read this relpy using QDeclarativeView objects and adding them to a widget. I am also able to use C++ signals in the QML using rootContext()->setContextProperty. Is there any benefit if I use the QQuickWidget instead? From what I see, I will still need to have a QDeclarativeView to refer to the QML item.

        1 Reply Last reply
        0
        • JKSHJ Online
          JKSHJ Online
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hi,

          QDeclarativeView is for Qt Quick 1. These are old technologies which are now deprecated.

          Use QQuickWidget + Qt Quick 2 instead.

          See "Porting QML Applications to Qt 5":http://doc.qt.io/qt-5/qtquick-porting-qt5.html for more info.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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