Is the slot getting called?
If you do the connection correctly then there should be no problem here.
You are getting the initial value of dimx because you're printing it too soon.
You should do something like this to see the value assigned in the slot:
MainWindow *mainWin=new MainWindow;
[B]mainWin->show();
[/B]
int execRet = app.exec();
[B]std:: ofstream myfile;
myfile.open ("data.txt");
myfile<<dimx;
myfile.close();
return execRet;
[/B]
QApplication app(argc, argv);
MainWindow *mainWin=new MainWindow;
[B]mainWin->show();
[/B]
int execRet = app.exec();
[B]std:: ofstream myfile;
myfile.open ("data.txt");
myfile<<dimx;
myfile.close();
return execRet;
[/B]
To copy to clipboard, switch view to plain text mode
This is one way of doing it.
You were saving the variable right after showing the
window( show exits immediately), therefore it did not had the chance to get its new value.
Generally, assigning to a static var should work, but you have to know when/where/if the var was modified prior to using it.
Regards
Bookmarks