diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 1d00b7f5..8ca6efef 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -59,6 +59,10 @@ # define ARCH_PROCESSOR "x86_64" #elif defined(Q_PROCESSOR_IA64) # define ARCH_PROCESSOR "ia64" +#elif defined(Q_PROCESSOR_LOONGARCH_64) +# define ARCH_PROCESSOR "loongarch64" +#elif defined(Q_PROCESSOR_LOONGARCH) +# define ARCH_PROCESSOR "loongarch" #elif defined(Q_PROCESSOR_MIPS_64) # define ARCH_PROCESSOR "mips64" #elif defined(Q_PROCESSOR_MIPS) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index a6ead549..2a0382c7 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -228,6 +228,13 @@ # define Q_PROCESSOR_WORDSIZE 8 // Q_BYTE_ORDER not defined, use endianness auto-detection +#elif defined(_loongarch) || defined(__loongarch__) +# define Q_PROCESSOR_LOONGARCH +# if defined(__loongarch64) +# define Q_PROCESSOR_LOONGARCH_64 +# define Q_PROCESSOR_WORDSIZE 8 +# endif + /* MIPS family, known revisions: I, II, III, IV, 32, 64 diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 9bbf2773..dfe0ee98 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -396,10 +396,7 @@ qreal QHighDpiScaling::roundScaleFactor(qreal rawFactor) } // Check application object if no environment value was set. - if (scaleFactorRoundingPolicy == Qt::HighDpiScaleFactorRoundingPolicy::Unset) { - scaleFactorRoundingPolicy = QGuiApplication::highDpiScaleFactorRoundingPolicy(); - } else { - // Make application setting reflect environment + if (scaleFactorRoundingPolicy != Qt::HighDpiScaleFactorRoundingPolicy::Unset) { QGuiApplication::setHighDpiScaleFactorRoundingPolicy(scaleFactorRoundingPolicy); } } @@ -460,8 +457,6 @@ QDpi QHighDpiScaling::effectiveLogicalDpi(const QPlatformScreen *screen, qreal r policyText.constData(), values.constData()); } } - if (dpiAdjustmentPolicy == DpiAdjustmentPolicy::Unset) - dpiAdjustmentPolicy = DpiAdjustmentPolicy::UpOnly; } // Apply adjustment policy. @@ -539,7 +534,7 @@ void QHighDpiScaling::updateHighDpiScaling() ++i; } } - m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive; + m_active = m_globalScalingActive || m_usePixelDensity; } /* @@ -684,9 +679,7 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen) return QDpi(96, 96); if (!m_usePixelDensity) { - const qreal screenScaleFactor = screenSubfactor(screen->handle()); - const QDpi dpi = QPlatformScreen::overrideDpi(screen->handle()->logicalDpi()); - return QDpi{ dpi.first / screenScaleFactor, dpi.second / screenScaleFactor }; + return screen->handle()->logicalDpi(); } const qreal scaleFactor = rawScaleFactor(screen->handle()); diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 5b02c5d6..e4714c99 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -159,12 +159,12 @@ inline QVector2D scale(const QVector2D &value, qreal scaleFactor, QPointF /* ori inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0)) { - return (pos - origin) * scaleFactor + origin; + return (pos - origin) * scaleFactor + origin * scaleFactor; } inline QPoint scale(const QPoint &pos, qreal scaleFactor, QPoint origin = QPoint(0, 0)) { - return (pos - origin) * scaleFactor + origin; + return (pos - origin) * scaleFactor + origin * scaleFactor; } inline QRect scale(const QRect &rect, qreal scaleFactor, QPoint origin = QPoint(0, 0)) diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 8e0eb351..3bceaf2e 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -410,6 +410,12 @@ QSize QScreen::availableSize() const QRect QScreen::geometry() const { Q_D(const QScreen); + + if (d->platformScreen) + { + return QHighDpi::fromNativePixels(d->platformScreen->geometry(), this); + } + return d->geometry; } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index e86aff1c..9d281f66 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1568,7 +1568,7 @@ QRegion QTransform::map(const QRegion &r) const } QPainterPath p = map(qt_regionToPath(r)); - return p.toFillPolygon(QTransform()).toPolygon(); + return p.toFillPolygon().toPolygon(); } struct QHomogeneousCoordinate