[Libreoffice-commits] core.git: vcl/qt5

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 24 11:59:45 UTC 2021


 vcl/qt5/Qt5Graphics_Controls.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8125fd6c5c3e7143704a1be281f46f42036184cb
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Sep 24 09:15:26 2021 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Sep 24 13:59:09 2021 +0200

    qt5: Avoid calling QApplication::fontMetrics
    
    It's deprecated in Qt 6.
    
    Change-Id: Idd7e93627a0c13b89b1a271c859ce29d01e55ce2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122556
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index 4847603bf8ab..5082e9340b2d 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -795,7 +795,8 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart
                     // find out the minimum size that should be used
                     // assume contents is a text line
                     QSize aContentSize = downscale(contentRect.size(), Round::Ceil);
-                    aContentSize.setHeight(QApplication::fontMetrics().height());
+                    QFontMetrics aFontMetrics(QApplication::font());
+                    aContentSize.setHeight(aFontMetrics.height());
                     QSize aMinSize = upscale(
                         sizeFromContents(QStyle::CT_ComboBox, &cbo, aContentSize), Round::Ceil);
                     if (aMinSize.height() > contentRect.height())
@@ -838,7 +839,8 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart
                 case ControlPart::Entire:
                 {
                     QSize aContentSize = downscale(contentRect.size(), Round::Ceil);
-                    aContentSize.setHeight(QApplication::fontMetrics().height());
+                    QFontMetrics aFontMetrics(QApplication::font());
+                    aContentSize.setHeight(aFontMetrics.height());
                     QSize aMinSize = upscale(
                         sizeFromContents(QStyle::CT_SpinBox, &sbo, aContentSize), Round::Ceil);
                     if (aMinSize.height() > contentRect.height())


More information about the Libreoffice-commits mailing list