Below code does not work. It prints the rectange out side of na list item

Qt Code:
  1. QDeclarativeView *qmlListViewName = new QDeclarativeView(this);
  2. qmlListViewName->rootContext()->setContextProperty("name", name);
  3. qmlListViewName->setSource(QUrl("qrc:/qml/ListViewName.qml"));
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. setIndexWidget(nameItem->index(),qmlListViewName);
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4. width: 100
  5. height: 62
  6. color: "yellow"
  7.  
  8. Text {
  9. id: fileName
  10. anchors.centerIn: parent
  11. text: name
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 


When I remove [this] from new QDeclarativeView(this); -> new QDeclarativeView;
It does not do anything.

Any ideas why ?