title: How to synchronise ui and data (dictionary)
body: <p>I have a dictionary that contains data that I used to fill a Table in PyQt5.
  The table looks roughly like this:</p>
  
  <pre><code>| Material | Amount |
  +----------+--------+
  | Iron     | 20     |
  | ...      | ...    |
  </code></pre>
  
  <p>Now my question is, how changes that are made via the UI inside the table can be synchronised with the dictionary. E. g.: via the UI I change the amount value for iron to 30. This should also update the dictionary.</p>
  
  <p>Edit: For example trigger a on change event or somthing like that, that would read the table and create a new dictionary, replacing the old one. (which seems to be laborious)</p>
  
  <p>I createt the table with the following code:</p>
  
  <pre><code>   self.allMaterials = json.load(open('materials.json'))  # reads json file that contains all materials and there amounts
  
      for rowIndex, rawMaterial in enumerate(self.allMaterials["materials"]["raw"]):
          itemName = QtWidgets.QTableWidgetItem(rawMaterial["name"])  # fills cell with material name
          itemName.setFlags(QtCore.Qt.ItemIsEnabled)  # makes cell read only
          itemAmount = QtWidgets.QTableWidgetItem()  # creates widget for cell
          itemAmount.setData(QtCore.Qt.EditRole, rawMaterial["amount"])  # fills material amount and makes it editable
  
          self.tableMatRaw.setItem(rowIndex, 0, itemName)  # positioning cell
          self.tableMatRaw.setItem(rowIndex, 1, itemAmount)  # positioning cell
  </code></pre>