Hello all!

I have a code that create 2 QTableViews dynamically when a QPushButton is clicked:

Qt Code:
  1. void MainWindow::on_pushButtonNovoInvestimento_clicked()
  2. {
  3. QTableView *tableViewLancamentosInvestimento = new QTableView(boxInvestimento2);
  4. QTableView *tableViewIndicadoresInvestimento = new QTableView(boxInvestimento2);
  5.  
  6. QStandardItemModel *modeloLancamentosInvestimento = new QStandardItemModel(0, 3, tableViewLancamentosInvestimento);
  7. QStandardItemModel *modeloIndicadoresInvestimento = new QStandardItemModel(0, 2, tableViewIndicadoresInvestimento);
  8.  
  9. tableViewLancamentosInvestimento->setModel(modeloLancamentosInvestimento);
  10. tableViewIndicadoresInvestimento->setModel(modeloIndicadoresInvestimento);
  11.  
  12. connect(modeloLancamentosInvestimento, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(alteraModeloLancamentoInvestimento(QModelIndex,QModelIndex)));
  13. }
To copy to clipboard, switch view to plain text mode 

But I need that when data of the first model changes, some data of the second model changes too.

How can I do that once the 2 models are created dynamically?

I am trying to do something like the code above, but its not working:
Qt Code:
  1. void MainWindow::alteraModeloLancamentoInvestimento(QModelIndex topLeft, QModelIndex bottomRight)
  2. {
  3. QStandardItemModel *modeloLancamentosInvestimento = qobject_cast<QStandardItemModel *>(sender());
  4. }
To copy to clipboard, switch view to plain text mode 

How can I access the second model?