Getting correct geometry size after setMinimumSize() and showMaximized()?
-
Hi,
After I set my main window's minimum size, and then manually maximize it, I am trying to retrieve the new dimensions, but it seems to be just returning the dimensions of whatever I call setMinimumSize() with.
Here is my code:MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
setMinimumSize(920,500);
showMaximized();qDebug("Dimensions %d, %d", size().width(), size().height());
}
The output is:
"Dimensions 920, 500"Any ideas how I get the REAL geometry or frame size for the main window, after I move or resize or maximize or manipulate it in any way?
Thanks!
Ryan -
Hi and welcome to devnet,
You are asking for the geometry too early.
showMaximized doesn't happen right now in the constructor, Qt's eventLoop need to start first. You can get the information e.g. in the resizeEvent
Hope it helps
-
Thank you very much SGaist.
-
You're welcome !
If this answers your question, then please update the thread title prepending [solved] so other forum users may know a solution has been found :)