[TD] Add comments and more transparent tolerance position adjustment calculation.

This commit is contained in:
Aapo
2020-11-28 02:03:37 +02:00
committed by wwmayer
parent 4ed3c99e3e
commit 4e06414552
3 changed files with 18 additions and 4 deletions

View File

@@ -210,11 +210,22 @@ QRectF QGCustomText::tightBoundingRect() const
qreal x_adj = (result.width() - tight.width())/4.0;
qreal y_adj = (result.height() - tight.height())/4.0;
// Adjust the bounding box 50% towards the Qt tightBoundingRect(),
// except chomp some extra empty space above the font (2*y_adj)
result.adjust(x_adj, 2*y_adj, -x_adj, -y_adj);
return result;
}
// Calculate the amount of difference between tight and relaxed bounding boxes
QPointF QGCustomText::tightBoundingAdjust() const
{
QRectF original = QGraphicsTextItem::boundingRect();
QRectF tight = tightBoundingRect();
return QPointF(tight.x()-original.x(), tight.y()-original.y());
}
QColor QGCustomText::getNormalColor() //preference!
{
return PreferencesGui::normalQColor();