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. Is it possible to integrate a QWidget into QML/QtQuick 2.0.
Forum Update on Monday, May 27th 2025

Is it possible to integrate a QWidget into QML/QtQuick 2.0.

Scheduled Pinned Locked Moved QML and Qt Quick
qwidgetqmlqt 5.5qtquick
4 Posts 2 Posters 7.9k Views
  • 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.
  • R Offline
    R Offline
    RichardD
    wrote on last edited by
    #1

    The problem I'm facing is the following:

    • I have a Qt 5.5 project where I use QML/QtQuick 2.0 for the GUI.
    • I want to reuse/integrate a QWidget from another project that does not use qml files.

    I got to the point where I can show the widget in a separate window. However I need it to be part of the main window, which is qml. I also have trouble getting events back from the widget.

    On blogs I read that it is not possible to integrate a QWidget into QML with QtQuick 2.0.
    Can either someone verify this statement or show a solution to integrate a QWidget into QML/QtQuick 2.0.

    Thanks!

    p3c0P 1 Reply Last reply
    0
    • R RichardD

      The problem I'm facing is the following:

      • I have a Qt 5.5 project where I use QML/QtQuick 2.0 for the GUI.
      • I want to reuse/integrate a QWidget from another project that does not use qml files.

      I got to the point where I can show the widget in a separate window. However I need it to be part of the main window, which is qml. I also have trouble getting events back from the widget.

      On blogs I read that it is not possible to integrate a QWidget into QML with QtQuick 2.0.
      Can either someone verify this statement or show a solution to integrate a QWidget into QML/QtQuick 2.0.

      Thanks!

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @RichardD No. Because pure QML doesnot have any functionality which will understand QWidget API's.
      It's actually the other way. You can integrate QML in QWidget based applications.
      For eg: have a look at QQuickWidget and QWidget's createWindowContainer. The recommended one is QQuickWidget.

      157

      R 1 Reply Last reply
      0
      • p3c0P p3c0

        @RichardD No. Because pure QML doesnot have any functionality which will understand QWidget API's.
        It's actually the other way. You can integrate QML in QWidget based applications.
        For eg: have a look at QQuickWidget and QWidget's createWindowContainer. The recommended one is QQuickWidget.

        R Offline
        R Offline
        RichardD
        wrote on last edited by
        #3

        @p3c0 Thanks for the quick response!
        I have seen that the other way around is possible, but unfortunately that is not the problem I'm dealing with.

        I found some examples but they are dated, on a previous version of Qt or use QtQuick 1.0:
        http://kunalmaemo.blogspot.nl/2011/07/how-to-display-qwidget-into-qml.html
        http://doc.qt.io/qt-4.8/qt-declarative-cppextensions-qwidgets-example.html
        The QGraphicsProxyWidget method looks very promising to me.

        So could you state that with QtQuick 1.0 it was possible and with QtQuick 2.0 it is no longer possible?

        If the above statement is true, I wonder why this is no longer possible. I can imagine, that a lot of developers have created custom widgets that they would like to use in new qml based applications. Are the concept that different that there is no workaround to deal with this?

        Thanks!

        p3c0P 1 Reply Last reply
        0
        • R RichardD

          @p3c0 Thanks for the quick response!
          I have seen that the other way around is possible, but unfortunately that is not the problem I'm dealing with.

          I found some examples but they are dated, on a previous version of Qt or use QtQuick 1.0:
          http://kunalmaemo.blogspot.nl/2011/07/how-to-display-qwidget-into-qml.html
          http://doc.qt.io/qt-4.8/qt-declarative-cppextensions-qwidgets-example.html
          The QGraphicsProxyWidget method looks very promising to me.

          So could you state that with QtQuick 1.0 it was possible and with QtQuick 2.0 it is no longer possible?

          If the above statement is true, I wonder why this is no longer possible. I can imagine, that a lot of developers have created custom widgets that they would like to use in new qml based applications. Are the concept that different that there is no workaround to deal with this?

          Thanks!

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @RichardD QtQuick 2.0 is completely different from QtQuick 1.0. QtQuick 1.0 backend was implemented with Qt's Graphics Framework while QtQuick 2.0 is based on Scene Graph to take advantage of OpenGL.
          Now since QtQuick 1.0 was based on Graphics Framework the API's like QGraphicsProxyWidget could be used out of the box in it. But there is no such functionality in QtQuick 2.0.
          Some references here:

          • http://blog.qt.io/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/)
          • http://blog.qt.io/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/#comment-342929
            You will need to port some of the functionality to QtQuick 2.0 for eg. using QQuickPaintedItem.

          157

          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