From 54482b7c757b0d4da2078262989f6a98b464bb38 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 3 Jun 2020 14:47:37 +0300 Subject: [PATCH] Fix label alignment. Alignment type 0 (no alignment, same as left) was incorrectly handled for layout piece. Code for the layout piece label is separate and did not handle this case. Valid value 0 was handled as right alignment. --- src/libs/vlayout/vlayoutpiece.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 7d4fbb5cb..680683785 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -1202,10 +1202,10 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector(dW)); } - if ((tl.m_eAlign & Qt::AlignLeft) > 0) + + qreal dX = 0; + if (tl.m_eAlign == 0 || (tl.m_eAlign & Qt::AlignLeft) > 0) { dX = 0; } @@ -1245,7 +1247,7 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector 0) { #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) dX = dW - fm.horizontalAdvance(qsText);