0
0
mirror of https://github.com/yse/easy_profiler.git synced 2025-01-14 00:27:55 +08:00

(EasyChronometerItem) Fixed an error of displaying text on large scale

This commit is contained in:
Victor Zarubkin 2016-08-30 20:47:49 +03:00
parent eaa79a4c4c
commit 245bc6c386

View File

@ -888,14 +888,15 @@ void EasyChronometerItem::paint(QPainter* _painter, const QStyleOptionGraphicsIt
return;
}
if (m_right + textRect.width() < sceneRight)
const auto w = textRect.width() / currentScale;
if (m_right + w < sceneRight)
{
// Text will be drawed to the right of rectangle
rect.translate(rect.width(), 0);
textFlags &= ~Qt::AlignHCenter;
textFlags |= Qt::AlignLeft;
}
else if (m_left - textRect.width() > sceneLeft)
else if (m_left - w > sceneLeft)
{
// Text will be drawed to the left of rectangle
rect.translate(-rect.width(), 0);