Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How many QGraphicsItem should one qml return?
Forum Updated to NodeBB v4.3 + New Features

How many QGraphicsItem should one qml return?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ytbryan
    wrote on last edited by
    #1

    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
    >(m_Component->create());
    COpenGLScene theScene;
    theScene.addItem(m_Item);
    theScene.getItems().count();//is this supposed to return a count of 1 or 2?
    @

    @
    //MyRectangle.qml
    import QtQuick 1.0

    Rectangle
    {
    width: 100
    height: 62

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

    }
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

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

      Chuck

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved