From b587e7143d7f1eeb6686b52727fbb9d7db6a820c Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 10 Oct 2024 17:58:48 +0200 Subject: [PATCH] QPainter: Fix regression in drawText with empty rect and DontClip flag A recent bugfix introduced a shortcut in text layouting, skipping all layout when the cliprect parameter is empty, since all will be clipped away anyway. However, the case when the DontClip flag is set was overlooked. This commit rectifies that. This commit modifies c7df8dda8b60b4e4e7b1859f462d65cef5d8c85b Fixes: QTBUG-129914 Pick-to: 6.8 Change-Id: Ief44acdd08e5e5f5491241362aacfcd2083f011d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 3d7647f2f97..c496f2c8275 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7102,7 +7102,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=nullptr) ); // we either have an option or flags - if (_r.isEmpty()) { + if (_r.isEmpty() && !(tf & Qt::TextDontClip)) { if (!brect) return; else