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. Using QML to develop a component
Forum Updated to NodeBB v4.3 + New Features

Using QML to develop a component

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 1.4k 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.
  • C Offline
    C Offline
    Cupidvogel
    wrote on last edited by
    #1

    I have been going through the Qt Quick and QML tutorials, and all the examples show some standard GUI executable launching, the settings of which are configured in the QML file.

    Is it possible to develop only a component of the overall GUI in QML? For example, I have a main window, with the menu bar showing on top (in OS X). When a certain option is clicked from the menu bar, I want a detailed dialog box to open, showing lots of rich content. Of course I know there are other ways to do this, but is it possible to fire the new dialog window within the main window (which didn't use QML) using QML?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes, you can run QML code from withing a QtWidgets application by using QWidget::createWindowContainer().

      You can also run QML-only apps by using the qml binary located in <QTDIR>/qtbase/bin.

      (Z(:^

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bootchk
        wrote on last edited by
        #3

        Yes, its possible, but it is new territory with few examples. Yes createWindowContainer() enables it, but it is not a complete solution. For example, does show() such a QWidget container (containing a QML Dialog) make the dialog execute? Or do you also need to interface your C++ code to the QML objects so that you can call Dialog.open() method of the QML?

        Also, do you need to parent such a container QWidget to your main window QWidget? Or do you need to parent the contained QQuickView to the QWindow of your app? (See discussions about QWidget parent tree versus QWindow/QObject parent tree.)

        The general question is usually answered using the phrase "embedding QML in C++" or "embedding QML in QWidgets."

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bootchk
          wrote on last edited by
          #4

          Yes, its possible, but it is new territory with few examples. Yes createWindowContainer() enables it, but it is not a complete solution. For example, does show() such a QWidget container (containing a QML Dialog) make the dialog execute? Or do you also need to interface your C++ code to the QML objects so that you can call Dialog.open() method of the QML?

          Also, do you need to parent such a container QWidget to your main window QWidget? Or do you need to parent the contained QQuickView to the QWindow of your app? (See discussions about QWidget parent tree versus QWindow/QObject parent tree.)

          The general question is usually answered using the phrase "embedding QML in C++" or "embedding QML in QWidgets."

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Qt 5.4 also comes with new QQuickWidget, which is the preferred solution to creating a window container.

            (Z(:^

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Qt 5.4 also comes with new QQuickWidget, which is the preferred solution to creating a window container.

              (Z(:^

              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