Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I am rather new to Qt and the QWidget::size() function is confusing me.
What exactly does it return? One would expect it to give you the actual size of the widget on your screen in pixels, but this seems to be false. For example, "this":http://pasteboard.co/1348433126209172.png has the "size()" 640x480.
Can someone explain it to me?
Roman74 last edited by
I think it will help you:
Uhm, I am sorry but it doesn't.
Maybe I just fail to see the part of the article which answers my question or maybe you misunderstood me.
utcenter last edited by
The method should return the size of the particular widget, be that a "main" widget that is the root of your application, sitting in an OS window frame, or some nested sub-component. In the first case, the size returned is without the window frame and title bar. If you aren't getting it correctly it is either a bug or more likely you are doing something wrong.
giesbert last edited by
when do you call the method size? This might have impact on the answer...
I kinda feel stupid now. It's as Gerolf intended, I called the function before the Widget had it's final size. I tried inside resizeEvent() again and it seems to work fine.
Thanks for the help.