Commit 370bb750 authored by Eric Jiang's avatar Eric Jiang Committed by Jean-Baptiste Mardelle
Browse files

Fix titler text alignment

When editing text in the title editor, modifying left-aligned text
behaves as though the text is right-aligned and vice-versa. This diff
fixes the logic of offsetting the text location based on alignment.
parent 71a0cb33
Pipeline #167214 passed with stage
in 6 minutes and 36 seconds
......@@ -360,9 +360,15 @@ void MyTextItem::updateGeometry()
QPointF topRight = boundingRect().topRight();
if ((m_alignment & static_cast<int>((Qt::AlignRight) != 0)) != 0) {
// if the text is right-aligned, then shift the container leftwards by the
// same amount it grew to maintain right-alignment
if (m_alignment & Qt::AlignRight) {
setPos(pos() + (topRightPrev - topRight));
// likewise, shift it halfway if we're center-aligned
else if (m_alignment & Qt::AlignHCenter) {
setPos(pos() + (topRightPrev - topRight) / 2);
QRectF MyTextItem::baseBoundingRect() const
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment