Hey

I'm trying to save/load position of my nodes in graphic view but so far they keep showwing up in wrong places...

This is what I do to store them :

Qt Code:
  1. class nodes_test(QGraphicsScene):
  2. def __init__(self,parent,dict_data):
  3. super(nodes_test,self).__init__(parent)
  4. self.par = parent
  5. self.dict_data = dict_data
  6.  
  7. def mouseReleaseEvent(self, event):
  8. if len(self.selectedItems()) > 0:
  9. for item in self.selectedItems():
  10. po = item.pos()
  11. print po,item.objectName
  12. self.dict_data[item.objectName]["node_pos"] = po.x(),po.y()
  13.  
  14. super(nodes_test,self).mouseReleaseEvent(event)
To copy to clipboard, switch view to plain text mode 


This is what I do to load them :

Qt Code:
  1. load_node.setRect(QtCore.QRectF(UI["node_pos"][0],UI["node_pos"][1],300,250))
  2. box_group.setGeometry(2+UI["node_pos"][0],50+UI["node_pos"][1],298,150)
To copy to clipboard, switch view to plain text mode 

If you can answer in python - great otherwise any sort of answer c++/etc/etc would be great - thanks!