{
/// @todo Replace this with an implementation that knows the true
/// height of the trace
- QFontMetrics m(QApplication::font());
- const int text_height = m.boundingRect(QRect(), 0, "Tg").height();
- const int row_height = (text_height * 6) / 4;
+ const int row_height = (RowItemPaintParams::text_height() * 6) / 4;
return make_pair(-row_height / 2, row_height * 7 / 2);
}
{
using namespace pv::data::decode;
- QFontMetrics m(QApplication::font());
- text_height_ = m.boundingRect(QRect(), 0, "Tg").height();
+ text_height_ = RowItemPaintParams::text_height();
row_height_ = (text_height_ * 6) / 4;
const int annotation_height = (text_height_ * 5) / 4;
#include <cassert>
+#include <QApplication>
+#include <QFontMetrics>
+
#include "rowitempaintparams.hpp"
namespace pv {
assert(scale > 0.0);
}
+QFont RowItemPaintParams::font()
+{
+ return QApplication::font();
+}
+
+int RowItemPaintParams::text_height() {
+ QFontMetrics m(font());
+ return m.boundingRect(QRect(), 0, "Tg").height();
+}
+
} // namespace view
} // namespace pv
#ifndef PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_H
#define PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_H
+#include <QFont>
+
namespace pv {
namespace view {
return offset_ / scale_;
}
+public:
+ static QFont font();
+
+ static int text_height();
+
private:
int left_;
int right_;