contentsSizeHint modified
This commit is contained in:
parent
a721b8841d
commit
f836967e71
|
@ -185,27 +185,26 @@ QSizeF MyToggleButton::contentsSizeHint(
|
||||||
if ( which != Qt::PreferredSize )
|
if ( which != Qt::PreferredSize )
|
||||||
return QSizeF();
|
return QSizeF();
|
||||||
|
|
||||||
qreal w = constraint.width();
|
QSizeF hint;
|
||||||
qreal h = constraint.height();
|
|
||||||
|
|
||||||
// better use Minimum Width/Height hints TODO ...
|
// better use Minimum Width/Height hints TODO ...
|
||||||
constexpr qreal aspectRatio = 4.0 / 3.0;
|
constexpr qreal aspectRatio = 4.0 / 3.0;
|
||||||
|
|
||||||
if ( w >= 0.0 )
|
if ( constraint.width() >= 0.0 )
|
||||||
{
|
{
|
||||||
h = w / aspectRatio;
|
hint.rheight() = constraint.width() / aspectRatio;
|
||||||
}
|
}
|
||||||
else if ( h >= 0.0 )
|
else if ( constraint.height() >= 0.0 )
|
||||||
{
|
{
|
||||||
w = h * aspectRatio;
|
hint.rwidth() = constraint.height() * aspectRatio;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w = metric( Panel | QskAspect::MinimumWidth );
|
hint.rwidth() = metric( Panel | QskAspect::MinimumWidth );
|
||||||
h = metric( Panel | QskAspect::MinimumHeight );
|
hint.rheight() = metric( Panel | QskAspect::MinimumHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
return QSizeF( w, h );
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyToggleButton::updateLayout()
|
void MyToggleButton::updateLayout()
|
||||||
|
|
Loading…
Reference in New Issue