Hello!
I want the size of my main window to change as the program runs.
This is my main function
int main(int argc, char *argv[])
{
MyWidget window;
int x = 100; int y =100;
QRect screen
= qApp
->desktop
()->screenGeometry
();
window.setGeometry(5,20,screen.width()-x,screen.height()-y);
window.show();
return application.exec();
}
int main(int argc, char *argv[])
{
QApplication application(argc, argv);
MyWidget window;
int x = 100; int y =100;
QRect screen = qApp->desktop()->screenGeometry();
window.setGeometry(5,20,screen.width()-x,screen.height()-y);
window.show();
return application.exec();
}
To copy to clipboard, switch view to plain text mode
This above positions my window where I want it. But as the program runs the x and y variables will change and I'd like to resize window by doing
window.setGeometry(5,20,screen.width()-x,screen.height()-y);
window.setGeometry(5,20,screen.width()-x,screen.height()-y);
To copy to clipboard, switch view to plain text mode
from other functions. I cannot do this since "window" is not reconized by other functions.
I don't think I can put this implementation
MyWidget window;
MyWidget window;
To copy to clipboard, switch view to plain text mode
in my *.h file to make it public since that wouldn't work.
Does anyone have suggestions how to make this automatic window resizing work so that it could be done from functions other than "main". Maybe use updateGeometry() somehow?
Bookmarks