I have connected the QSpinBox::valueChanged() Signal to a slot from my QMainMindow class.This is a part of the code:
Qt Code:
  1. double dimx;//The global scope
  2. ...
  3. void MainWindow::accepter(double d){
  4. dimx=d;
  5. qApp->aboutQt();
  6. }
  7. //in the main function
  8. ...
  9. QApplication app(argc, argv);
  10. MainWindow *mainWin=new MainWindow;
  11. std:: ofstream myfile;
  12.  
  13. myfile.open ("data.txt");
  14. myfile<<dimx;
  15. myfile.close();
  16.  
  17.  
  18. return app.exec();
  19. }
To copy to clipboard, switch view to plain text mode 
The qApp->aboutQt() make sure that the Signal /slot connection works.
What i get in my data.txt file is the initial value of dimx.