Hi everyone

I have project which uses Qt5 and QtQuick 1.1 imports in qml. For QtQuick
1.1 was used desktop components from qt4 branch bit ported to Qt5.
Crash happend on dynamic Window component creation. For example this code
will cause the segfault.

Window {
    width: 360; height: 360; id: mainWindow
    Button {
        anchors.centerIn: parent; text: qsTr("Hello World")
        onClicked: Qt.createQmlObject("import QtQuick 1.1; Window {
Rectangle {anchors.fill: parent; color: \"yellow\"} Component.onCompleted:
show()}", mainWindow)
    }
}

Debug build of Qt aborts on assert:
in file: qtbase/src/widgets/graphicsview/qgraphicsscene.cpp
in method: void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
at line: 621
at folowing assert:

Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem",
    "Parent item's scene is different from this item's scene");
item->setParentItem(0);

Commenting out assertion and modifying code will cause to Window creation.
But then contents(yellow rectangle) of new created window painted inside
parent window instead of it.

//Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem",
//           "Parent item's scene is different from this item's scene");
if(parentItem->scene() == q)
    item->setParentItem(0);

Can someone help me or point in which direction moving on? Change Window
component, or try to fix something in qgraphicsscene.cpp, or something else?
Thanks.

Screenshot of how contents painted in wrong window:
testQuick1.png<http://dl.dropbox.com/u/3094456/axonian/testQuick1.png>
Sources: 
testQuick1.tar.gz<http://dl.dropbox.com/u/3094456/axonian/testQuick1.tar.gz>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to