Qt World Summit: Submit your Presentation

Button won't click when embedded in QWidget

  • hi, i'm trying to add a button defined in qml to an existing project, but when i click the button it does not respond (does not press down / provide any feedback that it has been clicked, and i don't think the event is fired either). i'm using Qt5.1 under OSX.

    my qml is as follows:

    @import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.0

    Rectangle {
    width: 200
    height: 200

    Button {
        text: qsTr("Hello World")
        anchors.centerIn: parent


    and i embed this as follows (as per this blog post "here":http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/ ):

    @QQuickView *qqView = new QQuickView();
    QWidget *container = QWidget::createWindowContainer(qqView, this);
    container->setMinimumSize(200, 200);
    container->setMaximumSize(400, 400);

    any tips on how to get this working?

    with thanks

Log in to reply