I am trying to mix QML in a widgets app by dynamically loading a dialog’s QML 
source into a QuickWidget.


  1.  I have a QDialog with a QFrame.
  2.  In the QDialog constructor, I load the QML form a resource into a 
QQuickWidget.
  3.  When I add the QQuickWidget to the QFrame my app hangs at this line in 
the debugger.

Should this work?

-Ed

///////////////////////////////////////////////////// MainWindow



void MainWindow::on_pushButtonAdd_clicked()

{

    DialogPicker dialogPicker(this);

    dialogPicker.exec();

}

///////////////////////////////////////////////////// DialogPicker


#include <QQmlProperty>

#include <QQuickItem>

#include <QQuickView>


#include <QQuickWidget>

#include <QQmlError>

#include <QtWidgets>


#include "dialogpicker.h"

#include "ui_dialogpicker.h"


DialogPicker::DialogPicker(QWidget *parent) :

    QDialog(parent),

    ui(new Ui::DialogPicker)

    ,m_quickWidget(new QQuickWidget(this))

{

    ui->setupUi(this);


    m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView );

    m_quickWidget->setSource(QUrl("qrc:/res/files/picklist.qml"));

    ui->frameQmlHost->layout()->addWidget(m_quickWidget);           <- **** App 
hangs here ????


}


///// QML picklist.qml


import QtQuick 2.2


Item {

    Text {

        text: "Qt Quick Text"

        font.pixelSize: 32

        anchors.centerIn: parent

    }

}



This email and any files transmitted with it from The Charles Machine Works, 
Inc. are confidential and intended solely for the use of the individual or 
entity to which they are addressed. If you have received this email in error 
please notify the sender. Our company accepts no liability for the contents of 
this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in 
writing. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
company. Finally, the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for any damage caused 
by any virus transmitted by this email.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to