Search code examples
qtsizeqwidgetsizehint

Exact size of Application is size or sizeHint


I have set the,

setGeometry(0,0,1280,760);
setMaximumSize(1280,760);
setMinimumSize(1280,760);

Now when I am printing size and sizeHint, I am getting

size : QSize(1280, 760)

sizeHint : QSize(970, 752)

Which is exact size of my application, How can I change the size and size exactly to 1280X760 ?


Solution

  • Size hint is only a recommended size for widget which are inside QLayout. It does not affect windows widgets, which is in your case your application window.

    However if you want to have a different size hint, you need to reimplement sizeHint().

    QSize MyAppWindow:sizeHint() const
    {
       return QSize(1280, 760);
    }