Hello!
How do you access the main window (that's declared only in main function) from other functions of the same class?
This below is my main() and I can resize the window as shown.
int main(int argc, char *argv[])
{
MyWidget window;
window.resize(1200,800);
window.show();
return application.exec();
}
int main(int argc, char *argv[])
{
QApplication application(argc, argv);
MyWidget window;
window.resize(1200,800);
window.show();
return application.exec();
}
To copy to clipboard, switch view to plain text mode
But why can't I do it from another function like
void MyWidget::reSize()
{
window.resize(1200,800);
}
void MyWidget::reSize()
{
window.resize(1200,800);
}
To copy to clipboard, switch view to plain text mode
The comiler complains like this: "insufficient contextual information to determine type". I think I need to declare "window" somewhere else to make this work.
I do not think that I can declare "window" in my *.h file, can I? Isn't this instance a bit different from all others?
Bookmarks