I have connected the QSpinBox::valueChanged() Signal to a slot from my QMainMindow class.This is a part of the code:
double dimx;//The global scope
...
void MainWindow::accepter(double d){
dimx=d;
qApp->aboutQt();
}
//in the main function
...
MainWindow *mainWin=new MainWindow;
std:: ofstream myfile;
myfile.open ("data.txt");
myfile<<dimx;
myfile.close();
return app.exec();
}
double dimx;//The global scope
...
void MainWindow::accepter(double d){
dimx=d;
qApp->aboutQt();
}
//in the main function
...
QApplication app(argc, argv);
MainWindow *mainWin=new MainWindow;
std:: ofstream myfile;
myfile.open ("data.txt");
myfile<<dimx;
myfile.close();
return app.exec();
}
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.
Bookmarks