Hi,

I have this code as part of my Dialog with a QListView and QGraphicsView:

Qt Code:
  1. void TextureDialog::on_toolButtonAddLayer_clicked(){
  2. QString fileName = QFileDialog::getOpenFileName(this, tr("Abrir imagen"), workingDirectory,
  3. tr("Imagenes (*.png *.xpm *.jpg)"));
  4. if(fileName.isEmpty()) return;
  5. workingDirectory=QFileInfo(fileName).absolutePath();
  6.  
  7. GraphicsObjectItem *objectItem=objectPreviewScene->addLayer(fileName);
  8. StandardItem *item=new StandardItem(objectItem, QIcon(fileName), fileName);
  9. qDebug()<<"objectItem: "<<objectItem<<endl<<item->sceneItem();
  10. int row=listModelLayers->rowCount();
  11.  
  12. listModelLayers->appendRow(item);
  13. listViewLayers->setCurrentIndex(listModelLayers->index(row, 0));
  14. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void TextureDialog::moveUp(){
  2. StandardItem *item;
  3.  
  4. item=static_cast<StandardItem*>(listViewLayers->currentIndex().internalPointer());
  5.  
  6. qDebug()<<item->sceneItem();
  7. //if(item){
  8. //qDebug()<<item;
  9. //}
  10. //qDebug()<<static_cast<QObject*>(item)->objectName();
  11. }
To copy to clipboard, switch view to plain text mode 

It executes in this order, and the debug exit is:

Ejectuando...
objectItem: QGraphicsItem(this = 0x81cfe78 , parent = 0x0 , pos = QPointF( 0 , 0 ) , z = 0 , flags = { "isVisible|isEnabled" })
QGraphicsItem(this = 0x81cfe78 , parent = 0x0 , pos = QPointF( 0 , 0 ) , z = 0 , flags = { "isVisible|isEnabled" })
QGraphicsItem(0)
---------------------- Finalizado normalmente ----------------------
Someone can help me to fix this problem?

Thanks