limit underline to rect width

This commit is contained in:
itsmattkc
2019-10-19 10:42:08 +11:00
parent 09b3a1970d
commit 66b715f6ca
3 changed files with 18 additions and 1 deletions
@@ -0,0 +1,6 @@
#include "sequenceparams.h"
SequenceParams::SequenceParams()
{
}
@@ -0,0 +1,11 @@
#ifndef SEQUENCEPARAMS_H
#define SEQUENCEPARAMS_H
class SequenceParams
{
public:
SequenceParams();
};
#endif // SEQUENCEPARAMS_H
@@ -100,7 +100,7 @@ void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsI
// Linked clips are underlined
if (block_->HasLinks()) {
QFontMetrics fm = painter->fontMetrics();
int text_width = QFontMetricsWidth(fm, block_->block_name());
int text_width = qMin(qRound(rect().width()), QFontMetricsWidth(fm, block_->block_name()));
QPointF underline_start = rect().topLeft() + QPointF(0, fm.height());
QPointF underline_end = underline_start + QPointF(text_width, 0);