scale_index_(0),
scale_index_drag_offset_(0)
{
- colour_ = SignalColours[channel_->index() % countof(SignalColours)];
+ set_colour(SignalColours[channel_->index() % countof(SignalColours)]);
}
AnalogSignal::~AnalogSignal()
void AnalogSignal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
{
- if (channel_->enabled())
+ if (channel_->enabled()) {
+ Trace::paint_back(p, pp);
paint_axis(p, pp, get_visual_y());
+ }
}
void AnalogSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
{
shared_ptr<Trigger> trigger;
- colour_ = SignalColours[channel->index() % countof(SignalColours)];
+ set_colour(SignalColours[channel->index() % countof(SignalColours)]);
/* Populate this channel's trigger setting with whatever we
* find in the current session trigger, if anything. */
signal_height_ = ((units < 1) ? 1 : units) * font_height;
}
-void LogicSignal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
-{
- if (channel_->enabled())
- paint_axis(p, pp, get_visual_y());
-}
-
void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
{
QLineF *line;
*/
void scale_handle_dragged(int offset);
- /**
- * Paints the background layer of the signal with a QPainter
- * @param p the QPainter to paint into.
- * @param pp the painting parameters object to paint with..
- */
- void paint_back(QPainter &p, const ViewItemPaintParams &pp);
-
/**
* Paints the mid-layer of the signal with a QPainter
* @param p the QPainter to paint into.
return items_;
}
+void Signal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
+{
+ if (channel_->enabled())
+ Trace::paint_back(p, pp);
+}
+
void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
{
name_widget_ = new QComboBox(parent);
*/
const item_list& child_items() const;
+ void paint_back(QPainter &p, const ViewItemPaintParams &pp);
+
virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
QMenu* create_context_menu(QWidget *parent);
void Trace::set_colour(QColor colour)
{
colour_ = colour;
+
+ bgcolour_ = colour;
+ bgcolour_.setAlpha(20);
}
void Trace::paint_label(QPainter &p, const QRect &rect, bool hover)
pp.width(), h);
}
+void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
+{
+ p.setPen(QPen(Qt::NoPen));
+ p.setBrush(bgcolour_);
+
+ const std::pair<int, int> extents = v_extents();
+
+ 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)
{
p.setPen(AxisPen);
set_colour(colour);
if (owner_)
- owner_->row_item_appearance_changed(true, false);
+ owner_->row_item_appearance_changed(true, true);
}
} // namespace view
QRectF label_rect(const QRectF &rect) const;
protected:
+ /**
+ * Paints the background layer of the signal with a QPainter
+ * @param p the QPainter to paint into.
+ * @param pp the painting parameters object to paint with..
+ */
+ virtual void paint_back(QPainter &p, const ViewItemPaintParams &pp);
+
/**
* Paints a zero axis across the viewport.
* @param p the QPainter to paint into.
protected:
QString name_;
- QColor colour_;
+ QColor colour_, bgcolour_;
private:
pv::widgets::Popup *popup_;