[Interest] Embedding QQuickItem

Bruno Tezine bruno at tezine.com
Wed Aug 14 20:36:05 CEST 2013


Hi,
I have the following QML code:

import QtQuick 2.1

import QtQuick.Controls 1.0
Rectangle{
     id: rect

     width: 300

     height: 590

     GStackView{

         id: stack

         anchors.fill:parent

         Component.onCompleted: stack.push();

     }

}


GStackView is my own QML Component. When the push function is called in 
C++, I do the following:

QQmlComponent *component=new QQmlComponent(engine);
component->setData("import QtQuick 2.1\n import QtQuick.Controls 1.0\n 
Button{width:100\nheight:100\n text:'ola'}", QUrl());
QQuickItem *item = qobject_cast<QQuickItem *>(component->create());
item->setFlag(QQuickItem::ItemHasContents,true);
item->setWidth(this->width());
item->setHeight(this->height());
item->setParent(this);

Why the item is not displayed inside GStackView? The rect is shown and I 
receive the status "ready" after loading the item.
Thank you,
       Bruno.



More information about the Interest mailing list