Check the min. window sizes

* on smaller screens makes sure the min.sizes are not exceeded
* normally not changing min.sizes
This commit is contained in:
Klaus Basan
2018-01-19 20:36:36 +01:00
parent 464f64367e
commit d5c9a29618
4 changed files with 24 additions and 1 deletions

View File

@@ -510,4 +510,15 @@ namespace BlackGui
if (!widget) { return; }
widget->setStyleSheet(widget->styleSheet());
}
void CGuiUtility::superviseMainWindowMinSizes(qreal wRatio, qreal hRatio)
{
QWidget *w = CGuiUtility::mainApplicationWidget();
if (!w) { return; }
const QSize s = CGuiUtility::desktopSize();
const int minW = wRatio * s.width();
const int minH = hRatio * s.height();
w->setMinimumWidth(qMin(minW, w->minimumWidth()));
w->setMinimumHeight(qMin(minH, w->minimumHeight()));
}
} // ns