189QSize QSize::scaled(
const QSize &s, Qt::AspectRatioMode mode)
const noexcept
191 if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) {
195 qint64 rw = qint64(s.height()) * qint64(width()) / qint64(height());
197 if (mode == Qt::KeepAspectRatio) {
198 useHeight = (rw <= s.width());
200 useHeight = (rw >= s.width());
204 return QSize(
int(rw), s.height());
206 return QSize(s.width(),
207 qint32(qint64(s.width()) * qint64(height()) / qint64(width())));
640QSizeF QSizeF::scaled(
const QSizeF &s, Qt::AspectRatioMode mode)
const noexcept
642 if (mode == Qt::IgnoreAspectRatio || qIsNull(wd) || qIsNull(ht)) {
646 qreal rw = s.ht * wd / ht;
648 if (mode == Qt::KeepAspectRatio) {
649 useHeight = (rw <= s.wd);
651 useHeight = (rw >= s.wd);
655 return QSizeF(rw, s.ht);
657 return QSizeF(s.wd, s.wd * ht / wd);