You can't access a non-static member like that, you need an instance of the MainWindow class (or a reference or a pointer to an instance).
For example in main you'll access it like this:
int main(int argc, char *argv[])
{
MainWindow instanceOfMainWindowClass;
instanceOfMainWindowClass.app_language = "romanian";
instanceOfMainWindowClass.show();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow instanceOfMainWindowClass;
instanceOfMainWindowClass.app_language = "romanian";
instanceOfMainWindowClass.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
In another class you'll need to pass a pointer or reference to the instance of MainWindow to the constructor (or create a method to set the pointer) of your second class (constructor approach is similar to how you pass the parent pointer with Qt), i'll let you try that for an exercise
And i really recommend you read a C++ book (like Thinking in C++ - it can be found for free in electronic format) or else Qt will seem very hard or read Introduction to design patterns in C++ with Qt (it's available for free from ICS, you'll need to register on their site: http://www.ics.com/design-patterns ) this one starts with C++ and introduces Qt right after.
Bookmarks