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. How to show a widget by WId in Qt Quick 2 (Qt 5.0.1)
Forum Updated to NodeBB v4.3 + New Features

How to show a widget by WId in Qt Quick 2 (Qt 5.0.1)

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 3 Posters 4.3k 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.
  • P Offline
    P Offline
    pmdev
    wrote on last edited by
    #1

    Hi All,

    I'm looking for a solution to show the contents of a dll that need a HWND (winId) to do it.

    Somebody already did implement it? I see from documentation that before it was possible but in 5.x is not,
    because it is not possible to mix QWidget with QML, is it?

    Thanks a lot for your help.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      weiyuemin
      wrote on last edited by
      #2

      Mixing QWidget with QML is available again in Qt 5.1, using QWidget::createWindowContainer

      You can check out the code from git.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pmdev
        wrote on last edited by
        #3

        There is something I cannot get: in that way the application is mainly a QtQuick app or a QWidget App? Which are the implication when I want to port it to Android or iOS?

        The issue comes because I have a dll that can show by HWND the contents of a proprietary file format...

        I need to use Qt Quick because in few months I like to be ready to move to Android and iOS, waiting for the port to these platform of the viewer in the dll.
        Kindly can you give me some advice?

        Thanks a lot.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmdev
          wrote on last edited by
          #4

          Sorry, I think you solved my problem! Thanks!
          In the end I got it! :-)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sl.sy.ifm
            wrote on last edited by
            #5

            As far as I know "QWidget::createWindowContainer" only solves inserting "QWindow"-based views (Quick2, Qt5-GUI-OpenGL-View, Qt3D-view,...) into QWidget-GUI/-Layout
            So, it wont help you getting a native (winId) view into a Quick2-view

            I'm not aware that there is something to support the other direction, but I also don't know all the related changes ...

            btw. I'm not even sure that there is a equivalent to HWND on Android/iOS, maybe someone knows more about that topic?

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pmdev
              wrote on last edited by
              #6

              I hope to have time to compile Qt 5.1 from git... it's my first time after last time I did years compiling kde 3...

              After compiling if I'm still "working", I will test the possibility to mix QML/QWidget and try to use the winid from some of the QWidget: I promise I will post about the results, to share and to try to have a clear idea about how things work.

              About iOS/Android I will not test it in a few weeks, because I like to know if I could, but right now
              I don't need to dev on them.

              1 Reply Last reply
              0
              • W Offline
                W Offline
                weiyuemin
                wrote on last edited by
                #7

                In the way of QWidget::createWindowContainer, I think you can suppose the application is mainly a QWidget App, because the QQuickView is 'contained' in a QWidget.

                And is this you are expecting for?
                http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtwinmigrate

                "The project provides a set of classes that allow using Qt and MFC/Win32 windows in the same application. User interface elements developed with Qt can be embedded into an existing MFC or Win32 based user interface, and existing custom controls developed with MFC or Win32 can be integrated into Qt widgets"

                e.g. You can encapsulate your winId into a QWinHost.

                Blogs about porting Qt to Android and IOS:
                http://blog.qt.digia.com/blog/2013/03/13/preview-of-qt-5-for-android/?utm_source=rss&utm_medium=rss&utm_campaign=preview-of-qt-5-for-android
                http://blog.qt.digia.com/blog/2013/03/05/qt-for-ios-preview/

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pmdev
                  wrote on last edited by
                  #8

                  Hi All,

                  everything works fine in 5.1! Thanks everybody.

                  If somebody need help please let me know...

                  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