Hi, m new to QT, i got a TEXTBROWSER in my MAINWINDOW which contains data that keeps on changing ...now i need to pass this changing data to my another TEXTBROWSER in QDIALOG....

Below is my code, using which i m only able to pass the first value of data, it's not updating itself.....HELP!

MainWindow.h
Qt Code:
  1. Private:
  2. QString txtoutput; //this holds the data that keeps on updating
  3. private slots:
  4. void cmdOutputDialog();
To copy to clipboard, switch view to plain text mode 

MainWindow.cpp
Qt Code:
  1. connect(ui->buttonclicked, SIGNAL(clicked()), this, SLOT(cmdOutputDialog()));
  2.  
  3. void MainWindow::cmdOutputDialog()
  4. {
  5. CmdOutputDialog *dlg=new CmdOutputDialog(this);
  6. dlg->display(txtoutput);
  7. dlg->exec();
  8. }
To copy to clipboard, switch view to plain text mode 

MyDialog.h
Qt Code:
  1. public slots:
  2. void display(QString &text);
  3. private:
  4. QString m_disp;
To copy to clipboard, switch view to plain text mode 

MyDialog.cpp
Qt Code:
  1. void MyDialog::display(QString &text)
  2. {
  3. m_disp=text;
  4. ui->textbrowser->setText(m_disp);
  5. }
To copy to clipboard, switch view to plain text mode