Hi everyone!

I'm a new member of forum and I'm a beginner with Qt. I searched in forum if somebody else had the same problem, but I found the solution only for the reverse problem.

My problem is the following:

I have a QMainWindow (Qsem2D) with some member data and with a button which when is clicked open a QDialog (SettingSolver) window that is a child of QMainWindow.

Qsem2D:

Qsem2D.h
Qt Code:
  1. #include <QMainWindow>
  2.  
  3. class Qsem2d : public QMainWindow
  4. {
  5. .....
  6. private:
  7. bool *m_isForward;
  8.  
  9. signals:
  10. void signalIsForward(bool i_isForward);
  11.  
  12. private slots:
  13. void on_pushButton_clicked();
  14.  
  15. void sendSignalToSettingSolver();
  16.  
  17. .....
  18. }
To copy to clipboard, switch view to plain text mode 
Qsem2D.cpp
Qt Code:
  1. #include Qsem2D.h
  2. #include SolverSetting.h
  3. ....
  4.  
  5. void Qsem2D::on_pushButton_clicked()
  6. {
  7. sendSignalToSettingSolver();
  8. SolverSetting *newWindow = new SolverSetting;
  9. newWindow->show;
  10. }
  11.  
  12. void Qsem2D::sendSignalToSettingSolver()
  13. {
  14. emit signalIsForward(*m_isForward);
  15. }
To copy to clipboard, switch view to plain text mode 
SettingSolver:

SettingSolver.h
Qt Code:
  1. #include "Qsem2D.h"
  2. #include <QDialog>
  3.  
  4. class SettingSolver : public QDialog
  5. {
  6. public:
  7.  
  8. SettingSolver(Qsem2D *parent = 0);
  9. ~SettingSolver();
  10. .....
  11.  
  12. private:
  13. bool *m_isForward;
  14.  
  15. private slots:
  16.  
  17. void receiveSignalFromMainWindow(bool i_isForward);
  18. }
To copy to clipboard, switch view to plain text mode 
SettingSolver.cpp
Qt Code:
  1. #include "SettingSolver.h"
  2. #include <QDialog>
  3.  
  4. SettingSolver::SettingSolver(Qsem2D *parent):
  5. QDialog(parent),
  6. ui(new Ui::SettingSolver),
  7. m_isForward(new bool)
  8. {
  9. .....
  10. connect(parent,SIGNAL(signalIsForward),this,SLOT(receiveSignalFromMainWindow)
  11. if(*m_isForward)
  12. {
  13. ....
  14. }
  15. .....
  16. }
  17.  
  18. void SolverSetting::receiveSignalFromMainWindow(bool i_isForward)
  19. {
  20. *m_isForward = i_isForward;
  21. }
To copy to clipboard, switch view to plain text mode 

The code could contain some errors because I don't have the original code handy but what I want understand is the concept.

My need is to pass the member data Qsem2D::m_isForward from MainWindow to member data SolverSetting::m_isForward (QDialog). For how the code is made now when I call the constructor for SolverSetting the member data SolverSetting::m_isForward is a pointer that points to memory allocation with no sense information instead I wish that it contains the value of Qsem2D::m_isForward.

What's wrong?

Thanks.

Regards.