adjustSize在显示过程中可能存在展示不完全的问题,产生场景:
子widget大小超过父widget,同时子widget大于当前屏幕分辨率的2/3。
对adjustSize应源码如下:
QSize QWidgetPrivate::adjustedSize() const
{
Q_Q(const QWidget);
QSize s = q->sizeHint();
if (q->isWindow()) {
Qt::Orientations exp;
if (layout) {
if (layout->hasHeightForWidth())
s.setHeight(layout->totalHeightForWidth(s.width()));
exp = layout->expandingDirections();
} else
{
if (q->sizePolicy().hasHeightForWidth())
s.setHeight(q->heightForWidth(s.width()));
exp = q->sizePolicy().expandingDirections();
}
if (exp & Qt::Horizontal)
s.setWidth(qMax(s.width(), 200));
if (exp & Qt::Vertical)
s.setHeight(qMax(s.height(), 100));
#if 0 // Used to be included in Qt4 for Q_WS_X11
QRect screen &#