190QSize QSize::scaled(
const QSize &s, Qt::AspectRatioMode mode)
const noexcept
192 if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) {
196 qint64 rw = qint64(s.height()) * qint64(width()) / qint64(height());
198 if (mode == Qt::KeepAspectRatio) {
199 useHeight = (rw <= s.width());
201 useHeight = (rw >= s.width());
205 return QSize(
int(rw), s.height());
207 return QSize(s.width(),
208 qint32(qint64(s.width()) * qint64(height()) / qint64(width())));
641QSizeF QSizeF::scaled(
const QSizeF &s, Qt::AspectRatioMode mode)
const noexcept
643 if (mode == Qt::IgnoreAspectRatio || qIsNull(wd) || qIsNull(ht)) {
647 qreal rw = s.ht * wd / ht;
649 if (mode == Qt::KeepAspectRatio) {
650 useHeight = (rw <= s.wd);
652 useHeight = (rw >= s.wd);
656 return QSizeF(rw, s.ht);
658 return QSizeF(s.wd, s.wd * ht / wd);