Qt-UI
Widget Size
← QWidget | ● | Compilation with QMake →
Widget size is not set directly because there is not one size of one widget on all platforms and for all screen resolutions.
Instead, we can provide methods that return the preferred, minimum and maximum sizes. Those methods are questioned by the parent widget when choosing an appropriate layout for the widget for a particular available container size.
//! return preferred minimum window size
QSize minimumSizeHint() const
{
return(QSize(100, 100));
}
//! return preferred window size
QSize sizeHint() const
{
return(QSize(512, 512));
}
QSize minimumSizeHint() const
{
return(QSize(100, 100));
}
//! return preferred window size
QSize sizeHint() const
{
return(QSize(512, 512));
}
← QWidget | ● | Compilation with QMake →