Important: Please read the Qt Code of Conduct -

QQuickWidget in Widgets Application

  • Hi,

    i'm developing qt widgets application and I want to add QML object into UI. I'm using QuickWidget like this:

    @QuickWidget::QuickWidget(QWidget *parent)
    : QQuickWidget(parent)

    Then I promoted QWidget to QuickWidget. As I run the app, the widget is filled with "UI copy" (have no idea why..) and the QML area is filled with black color like this:


    If I resize the application window, the UI changes and insted of black area the QML file is displayed, but also inside whole UI copy like this:


    Could anyone help me solve this? I tested my code on simple app (only 1 QTabWidget with 2 tabs) an it works great. So the problem is not in non-working QML.

    Thanks for any advice.

  • Ok,

    I did some more investigation and find out the problem is caused with this line:


    In the previous tab "Camera" is only one QWidget named videoContainer.
    Here is code I'm using to add video into this QWidget:

    @ // init player
    player = new QMediaPlayer;

    // init playlist
    playlist = new QMediaPlaylist(player);
    // add video files from local disk
    // playlist index
    // play in loop
    // ui video frame
    QWidget *qw = ui->videoContainer;
    // init video widget
    videoWidget = new QVideoWidget(qw);
    // THIS CAUSES THE ERROR - assign output widget

    Could this be a bug or am I using it wrong way?
    Thanks for any help.

Log in to reply