int Ruler::calculate_text_height() const
{
- QFontMetrics fm(font());
- return fm.boundingRect(0, 0, INT_MAX, INT_MAX,
- Qt::AlignLeft | Qt::AlignTop, "8").height();
+ return QFontMetrics(font()).ascent();
}
void Ruler::hover_point_changed()
QFontMetrics m(QApplication::font());
const float text_width =
max(m.boundingRect(get_text()).size().width(), ArrowSize);
- const float text_height = m.boundingRect("Tg").size().height();
+ const float text_height = m.height();
const QSizeF label_size(
text_width + View::LabelPadding.width() * 2,
QFontMetrics m(QApplication::font());
const QSize text_size(
- m.boundingRect(QRect(), 0, name_).width(),
- m.boundingRect(QRect(), 0, "Tg").height());
+ m.boundingRect(QRect(), 0, name_).width(), m.height());
const QSizeF label_size(
text_size.width() + View::LabelPadding.width() * 2,
ceilf((text_size.height() + View::LabelPadding.height() * 2) / 2) * 2);
}
int ViewItemPaintParams::text_height() {
- QFontMetrics m(font());
- return m.boundingRect(QRect(), 0, "Tg").height();
+ return QFontMetrics(font()).height();
}
} // namespace view