projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DecodeTrace: Turn row_height and text_height into class members
[pulseview.git]
/
pv
/
view
/
decodetrace.cpp
diff --git
a/pv/view/decodetrace.cpp
b/pv/view/decodetrace.cpp
index c8a20dc3c9c6cf7eb3888080351e624ba38349c7..61653658e47182eeb86fe236f50acb0e74ddbb3a 100644
(file)
--- a/
pv/view/decodetrace.cpp
+++ b/
pv/view/decodetrace.cpp
@@
-116,6
+116,8
@@
DecodeTrace::DecodeTrace(pv::SigSession &session,
decoder_stack->stack().front()->decoder()->name)),
_session(session),
_decoder_stack(decoder_stack),
decoder_stack->stack().front()->decoder()->name)),
_session(session),
_decoder_stack(decoder_stack),
+ _text_height(0),
+ _row_height(0),
_delete_mapper(this),
_show_hide_mapper(this)
{
_delete_mapper(this),
_show_hide_mapper(this)
{
@@
-178,9
+180,9
@@
void DecodeTrace::paint_mid(QPainter &p, int left, int right)
samples_per_pixel, 0.0);
QFontMetrics m(QApplication::font());
samples_per_pixel, 0.0);
QFontMetrics m(QApplication::font());
-
const int text_height =
m.boundingRect(QRect(), 0, "Tg").height();
-
const int annotation_height = (text_height * 5
) / 4;
- const int
row_height = (text_height * 6
) / 4;
+
_text_height =
m.boundingRect(QRect(), 0, "Tg").height();
+
_row_height = (_text_height * 6
) / 4;
+ const int
annotation_height = (_text_height * 5
) / 4;
assert(_decoder_stack);
const QString err = _decoder_stack->error_message();
assert(_decoder_stack);
const QString err = _decoder_stack->error_message();
@@
-218,7
+220,7
@@
void DecodeTrace::paint_mid(QPainter &p, int left, int right)
annotation_height, left, right,
samples_per_pixel, pixels_offset, y,
base_colour);
annotation_height, left, right,
samples_per_pixel, pixels_offset, y,
base_colour);
- y += row_height;
+ y +=
_
row_height;
_cur_row_headings.push_back(row.title());
}
_cur_row_headings.push_back(row.title());
}
@@
-235,13
+237,11
@@
void DecodeTrace::paint_fore(QPainter &p, int left, int right)
(void)right;
(void)right;
- QFontMetrics m(QApplication::font());
- const int text_height = m.boundingRect(QRect(), 0, "Tg").height();
- const int row_height = (text_height * 6) / 4;
+ assert(_row_height);
for (size_t i = 0; i < _cur_row_headings.size(); i++)
{
for (size_t i = 0; i < _cur_row_headings.size(); i++)
{
- const int y = i * row_height + get_y();
+ const int y = i *
_
row_height + get_y();
p.setPen(QPen(Qt::NoPen));
p.setBrush(QApplication::palette().brush(QPalette::WindowText));
p.setPen(QPen(Qt::NoPen));
p.setBrush(QApplication::palette().brush(QPalette::WindowText));
@@
-256,8
+256,8
@@
void DecodeTrace::paint_fore(QPainter &p, int left, int right)
p.drawPolygon(points, countof(points));
}
p.drawPolygon(points, countof(points));
}
- const QRect r(left + ArrowSize * 2, y - row_height / 2,
- right - left, row_height);
+ const QRect r(left + ArrowSize * 2, y -
_
row_height / 2,
+ right - left,
_
row_height);
const QString h(_cur_row_headings[i]);
const int f = Qt::AlignLeft | Qt::AlignVCenter |
Qt::TextDontClip;
const QString h(_cur_row_headings[i]);
const int f = Qt::AlignLeft | Qt::AlignVCenter |
Qt::TextDontClip;