title: Why can I emit dataChanged(), but not layoutChanged() in a PySide2 table model?
body: <p>I am new to Qt. Currently I am trying to learn how to update a table model from a different thread and then how to get an immediate display update for it. I read the documentation and found the <code>dataChanged()</code> and <code>layoutChanged()</code> signals. While <code>dataChanged()</code> works fine, any attempt to emit <code>layoutChanged()</code> fails with:</p>
  
  <pre><code>'QObject::connect: Cannot queue arguments of type 'QList&amp;lt;QPersistentModelIndex&amp;gt;' (Make sure 'QList&amp;lt;QPersistentModelIndex&amp;gt;' is registered using qRegisterMetaType().)
  </code></pre>
  
  <p>Searching for this particular error didn't give me anything that I could turn into working code. I am not using any <code>QList</code> or <code>QPersistentModelIndex</code> explicitly, but of course that can be implicitly used due to the constructs that I chose.</p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>class TimedModel(QtCore.QAbstractTableModel):
  
      def __init__(self, table, view):
          super(TimedModel, self).__init__()
          self.table = table
          self.view =  view
          self.setHeaderData(0, Qt.Horizontal, Qt.AlignLeft, Qt.TextAlignmentRole)
          self.rows = 6
          self.columns = 4
          self.step = 5
          self.timer = Thread(
              name = "Timer",
              target = self.tableTimer,
              daemon = True)
          self.timer.start()
          self.random = Random()
          self.updated = set()
  
      @staticmethod
      def encode(row, column):
          return row &lt;&lt; 32 | column
  
      def data(self, index, role):
  
          if role == Qt.DisplayRole or role == Qt.EditRole:
              return f'Data-{index.row()}-{index.column()}'
  
          if role == Qt.ForegroundRole:
              encoded = TimedModel.encode(index.row(), index.column())
              return QBrush(Qt.red if encoded in self.updated else Qt.black)            
  
          return None
  
      def rowCount(self, index):
          return self.rows
  
      def columnCount(self, index):
          return self.columns
  
      def headerData(self, col, orientation, role):
          if orientation == Qt.Vertical:
              # Vertical
              return super().headerData(col, orientation, role)
          # Horizontal
          if not 0 &lt;= col &lt; self.columns:
              return None
          if role == Qt.DisplayRole:
              return f'Data-{col}'
          if role == Qt.TextAlignmentRole:
              return int(Qt.AlignLeft | Qt.AlignVCenter)
          return super().headerData(col, orientation, role)
  
      def tableTimer(self):
          while True:
              time.sleep(5.0)
              randomRow = self.random.randint(0, self.rows)
              randomColumn = self.random.randint(0, self.columns)
              encodedRandom = TimedModel.encode(randomRow, randomColumn)
              if encodedRandom in self.updated:
                  self.updated.remove(encodedRandom)
              else:
                  self.updated.add(encodedRandom)
              updatedIndex = self.createIndex(randomRow, randomColumn)
              self.dataChanged.emit(updatedIndex, updatedIndex)
  
              '''this here does not work:'''
              self.layoutAboutToBeChanged.emit()
              self.rows += self.step
              self.layoutChanged.emit()
  
  class MainWindow(QtWidgets.QMainWindow):
  
      def __init__(self):
          QtWidgets.QMainWindow.__init__(self)
  
          self.timedTable = QTableView()
          self.model = TimedModel(self.timedTable, self)
  
          self.timedTable.setModel(self.model)
          headerView = self.timedTable.horizontalHeader()
          headerView.setStretchLastSection(True)
          self.setCentralWidget(self.timedTable)
  
          self.setGeometry(300, 300, 1000, 600)
          self.setWindowTitle('Timed Table')
          self.show()
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      app.name = "Timed Table Application"
      window = MainWindow()
      window.show()
      app.exec_()
  </code></pre>