Adjusted icon text alignment

This commit is contained in:
Martin Tůma 2019-10-05 13:21:36 +02:00
parent 148f79eaef
commit 8da172c0ff

View File

@ -67,12 +67,12 @@ QRectF TextPointItem::moveTextRect(const QRectF &rect) const
textRect.moveCenter(_pos); textRect.moveCenter(_pos);
break; break;
case Text::Left: case Text::Left:
textRect.moveTopLeft(_pos - QPointF(-iconRect.width() / 2, textRect.moveTopLeft(_pos - QPointF(-iconRect.width() / 2
textRect.height() / 2)); - font().pixelSize()/4.0, textRect.height() / 2));
break; break;
case Text::Right: case Text::Right:
textRect.moveTopRight(_pos - QPointF(iconRect.width() / 2, textRect.moveTopRight(_pos - QPointF(iconRect.width() / 2
textRect.height() / 2)); + font().pixelSize()/4.0, textRect.height() / 2));
break; break;
case Text::Bottom: case Text::Bottom:
textRect.moveTopLeft(_pos - QPointF(textRect.width() / 2, textRect.moveTopLeft(_pos - QPointF(textRect.width() / 2,
@ -136,7 +136,7 @@ void TextPointItem::paint(QPainter *painter) const
_icon.height() / 2), _icon); _icon.height() / 2), _icon);
#endif // ENABLE_HIDPI #endif // ENABLE_HIDPI
} else } else
textRect = moveTextRect(_textRect); textRect = _boundingRect;
if (hasHalo()) { if (hasHalo()) {
QStaticText st(text()); QStaticText st(text());