How many QGraphicsItem should one qml return?

  • Hi all,

    If i add a qml(which contains two elements) to a QGraphicsScene via qdeclarativeitem, should i get back two QGraphicsItem or one when i call QGraphicsScene.items();

    I am complaining because the app crash when i run it on the touch monitor and touch the area where qml is rendered.

    The app works fine with just one rectangle element in the qml.

    did I miss out something here? Thanks!

    QDeclarativeEngine engine;
    QDeclarativeComponent component(&engine;, QUrl::fromLocalFile("MyRectangle.qml"));
    QObject rectangleInstance = component.
    QDeclarativeItem m_Item = qobject_cast<QDeclarativeItem
    COpenGLScene theScene;
    theScene.getItems().count();//is this supposed to return a count of 1 or 2?

    import QtQuick 1.0

    width: 100
    height: 62

        TextEdit {
        id: text_edit1
        x: 0
        y: 0
        width: 94
        height: 62
        text: "Textboxedit"
        font.pixelSize: 12


  • It'll return all items added into scene. So for your case, the count is 2

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.