[Development] Created graphical object was not placed in the graphics scene

Tomas Konir tomas.konir at gmail.com
Wed Sep 18 17:26:19 CEST 2019


Hi,

I tried code like below and getting message:
QQmlComponent: Created graphical object was not placed in the graphics
scene.

import QtQuick 2.13
import QtQuick.Controls 2.12
import QtQuick.Window 2.13

Window {
    visible: true
    width: 640
    height: 480
    Button {
        anchors.centerIn: parent
        text: "show"
        onClicked: menu.popup()
    }
    Menu {
        id: menu
    }
    Component {
        id: component
        MenuItem {
        }
    }
    Component.onCompleted: {
        var item = component.createObject(menu)
        item.text = "test menu"
        menu.addItem(item)
    }
}

Am i doing something wrong? Or it is a BUG in Qt ?

Regards

Tom

-- 
Tomas Konir
Czech Republic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190918/640d9fef/attachment.html>


More information about the Development mailing list