projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
InputFile: Use new reset() function to allow re-reading file
[pulseview.git]
/
pv
/
view
/
trace.cpp
diff --git
a/pv/view/trace.cpp
b/pv/view/trace.cpp
index 3727afa2de246912c8834dc0f3977d5131ec25bc..ea443f23b91cebf4ddb141b64ae3ef4af705b357 100644
(file)
--- a/
pv/view/trace.cpp
+++ b/
pv/view/trace.cpp
@@
-38,9
+38,13
@@
namespace pv {
namespace view {
namespace pv {
namespace view {
-const QPen Trace::AxisPen(QColor(
128, 128, 128, 64
));
+const QPen Trace::AxisPen(QColor(
0, 0, 0, 30*256/100
));
const int Trace::LabelHitPadding = 2;
const int Trace::LabelHitPadding = 2;
+const int Trace::ColourBGAlpha = 8*256/100;
+const QColor Trace::BrightGrayBGColour = QColor(0, 0, 0, 10*255/100);
+const QColor Trace::DarkGrayBGColour = QColor(0, 0, 0, 15*255/100);
+
Trace::Trace(QString name) :
name_(name),
coloured_bg_(true), // Default setting is set in MainWindow::setup_ui()
Trace::Trace(QString name) :
name_(name),
coloured_bg_(true), // Default setting is set in MainWindow::setup_ui()
@@
-69,7
+73,7
@@
void Trace::set_colour(QColor colour)
colour_ = colour;
bgcolour_ = colour;
colour_ = colour;
bgcolour_ = colour;
- bgcolour_.setAlpha(
20
);
+ bgcolour_.setAlpha(
ColourBGAlpha
);
}
void Trace::set_coloured_bg(bool state)
}
void Trace::set_coloured_bg(bool state)
@@
-172,34
+176,33
@@
QRectF Trace::label_rect(const QRectF &rect) const
label_size.height());
}
label_size.height());
}
-QRectF Trace::hit_box_rect(const ViewItemPaintParams &pp) const
-{
- const float h = QFontMetrics(QApplication::font()).height();
- return QRectF(pp.left(), get_visual_y() - h / 2.0f,
- pp.width(), h);
-}
-
void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
{
void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
{
- if (coloured_bg_) {
- p.setPen(QPen(Qt::NoPen));
+ if (coloured_bg_)
p.setBrush(bgcolour_);
p.setBrush(bgcolour_);
+ else
+ p.setBrush(bgcolour_state_ ? BrightGrayBGColour : DarkGrayBGColour);
-
const std::pair<int, int> extents = v_extents(
);
+
p.setPen(QPen(Qt::NoPen)
);
- const int x = 0;
- const int y = get_visual_y() + extents.first;
- const int w = pp.right() - pp.left();
- const int h = extents.second - extents.first;
+ const std::pair<int, int> extents = v_extents();
- p.drawRect(x, y, w, h);
- }
+ const int x = 0;
+ const int y = get_visual_y() + extents.first;
+ const int w = pp.right() - pp.left();
+ const int h = extents.second - extents.first;
+
+ p.drawRect(x, y, w, h);
}
void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
{
}
void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
{
+ p.setRenderHint(QPainter::Antialiasing, false);
+
p.setPen(AxisPen);
p.setPen(AxisPen);
- p.drawLine(QPointF(pp.left(), y + 0.5f), QPointF(pp.right(), y + 0.5f));
+ p.drawLine(QPointF(pp.left(), y), QPointF(pp.right(), y));
+
+ p.setRenderHint(QPainter::Antialiasing, true);
}
void Trace::add_colour_option(QWidget *parent, QFormLayout *form)
}
void Trace::add_colour_option(QWidget *parent, QFormLayout *form)