Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Include QML in a Qt Widget application

Include QML in a Qt Widget application

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k 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
    mclaus
    wrote on last edited by
    #1

    Hi – I am attempting to embed a QtQuickView window into a layout on a QMainWindow object via the use of a QWidget::createWindowContainer call. While it is partially working, I am having several difficulties

    1. The QtQuickView application does not respond to mouse events properly when it is embedded in the window, but it does when I display it as a standad-alone window.

    2. I don’t seem to be able to control the placement of the embedded widget without the layout properly. The drawing area on the QtQuickView widget seems to spill over the sides of the space allocated for it, and I don’t seem able to adjust it.

    Here my code to create and embed the widget – pretty straightforward. The commented out bits are some things I tried to control the placement of the widget – but it didn’t seem to work.

    Anybody have any experience working with these QtQuickView widgets?

    // add the QML view to the UI window
    qmlView = new QQuickView(QUrl(qmlFileName));
    QWidget* qmlWidget = QWidget::createWindowContainer(qmlView, this);
    // qmlWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    // qmlWidget->setMinimumWidth(450);
    // qmlWidget->setMinimumHeight(350); ui->horizontalLayout->addWidget(qmlWidget);
    ui->horizontalLayout->addWidget(qmlWidget);

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      You probably should use a QQuickWidget to integrate Qt Quick in a widget application.
      QQuickWidget is a new feature coming with Qt 5.3: "Introduced QQuickWidget for easy and flexible integration of Quick views with QWidget-based UIs."
      Since there is a need for this widget I guess the QQuickView is not working properly, but I have never tried it myself.

      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