[graphics/drawy/gsoc2026] src/gui/item: fix: apply text alignment correctly in auto sized item

Abdelhadi Wael <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 303318195d29aa03054e1b774c2bcd4b8e38206b by Abdelhadi Wael.
Committed on 16/07/2026 at 08:04.
Pushed by mlaurent into branch 'gsoc2026'.

fix: apply text alignment correctly in auto sized item

M  +3    -0    src/gui/item/text.cpp

https://invent.kde.org/graphics/drawy/-/commit/303318195d29aa03054e1b774c2bcd4b8e38206b

diff --git a/src/gui/item/text.cpp b/src/gui/item/text.cpp
index b1b745c7..ff5bf59c 100644
--- a/src/gui/item/text.cpp
+++ b/src/gui/item/text.cpp
@@ -236,6 +236,9 @@ void TextItem::updateBoundingBox()
 
     if (m_wrapWidth > 0) {
         m_document.setTextWidth(m_wrapWidth);
+    } else {
+        m_document.setTextWidth(-1);
+        m_document.setTextWidth(m_document.size().width());
     }
 
     if (m_document.isEmpty()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.