PulseView  unreleased development snapshot
A Qt-based sigrok GUI
pv::views::trace::Trace Class Reference

#include <trace.hpp>

Inheritance diagram for pv::views::trace::Trace:
Collaboration diagram for pv::views::trace::Trace:

Public Types

enum  SegmentDisplayMode {
  ShowLastSegmentOnly = 1, ShowLastCompleteSegmentOnly, ShowSingleSegmentOnly, ShowAllSegments,
  ShowAccumulatedIntensity
}
 

Public Member Functions

shared_ptr< data::SignalBasebase () const
 
virtual bool is_selectable (QPoint pos) const
 
virtual bool is_draggable (QPoint pos) const
 
virtual void set_segment_display_mode (SegmentDisplayMode mode)
 
virtual void on_setting_changed (const QString &key, const QVariant &value)
 
virtual void paint_label (QPainter &p, const QRect &rect, bool hover)
 
virtual void paint_error (QPainter &p, const ViewItemPaintParams &pp)
 
virtual QMenu * create_header_context_menu (QWidget *parent)
 
virtual QMenu * create_view_context_menu (QWidget *parent, QPoint &click_pos)
 
pv::widgets::Popupcreate_popup (QWidget *parent)
 
QRectF label_rect (const QRectF &rect) const
 
virtual QRectF hit_box_rect (const ViewItemPaintParams &pp) const
 
void set_current_segment (const int segment)
 
int get_current_segment () const
 
virtual void hover_point_changed (const QPoint &hp)
 
- Public Member Functions inherited from pv::views::trace::TraceTreeItem
 TraceTreeItem ()
 
TraceTreeItemOwnerowner () const
 
void select (bool select=true)
 
int layout_v_offset () const
 
void set_layout_v_offset (int v_offset)
 
int visual_v_offset () const
 
void set_visual_v_offset (int v_offset)
 
void force_to_v_offset (int v_offset)
 
void animate_to_layout_v_offset ()
 
virtual void set_owner (TraceTreeItemOwner *owner)
 
int get_visual_y () const
 
void drag_by (const QPoint &delta)
 
QPoint drag_point (const QRect &rect) const
 
virtual pair< int, int > v_extents () const =0
 
- Public Member Functions inherited from pv::views::trace::ViewItem
 ViewItem ()
 
virtual bool enabled () const =0
 
bool selected () const
 
bool dragging () const
 
void drag ()
 
virtual void drag_release ()
 
virtual void paint_mid (QPainter &p, ViewItemPaintParams &pp)
 
virtual void paint_fore (QPainter &p, ViewItemPaintParams &pp)
 
virtual void delete_pressed ()
 
virtual void mouse_left_press_event (const QMouseEvent *event)
 

Protected Slots

virtual void on_name_changed (const QString &text)
 
virtual void on_color_changed (const QColor &color)
 
virtual void on_error_message_changed (const QString &msg)
 
void on_popup_closed ()
 

Protected Member Functions

 Trace (shared_ptr< data::SignalBase > signal)
 
 ~Trace ()
 
virtual void paint_back (QPainter &p, ViewItemPaintParams &pp)
 
void paint_axis (QPainter &p, ViewItemPaintParams &pp, int y)
 
void paint_hover_marker (QPainter &p)
 
void add_color_option (QWidget *parent, QFormLayout *form)
 
void create_popup_form ()
 
virtual void populate_popup_form (QWidget *parent, QFormLayout *form)
 

Protected Attributes

shared_ptr< data::SignalBasebase_
 
QPen axis_pen_
 
SegmentDisplayMode segment_display_mode_
 
bool show_hover_marker_
 
uint32_t context_menu_x_pos_
 
int current_segment_
 The ID of the currently displayed segment. More...
 
- Protected Attributes inherited from pv::views::trace::TraceTreeItem
TraceTreeItemOwnerowner_
 
int layout_v_offset_
 
int visual_v_offset_
 
- Protected Attributes inherited from pv::views::trace::ViewItem
QWidget * context_parent_
 
QPoint drag_point_
 

Private Slots

void on_nameedit_changed (const QString &name)
 
void on_coloredit_changed (const QColor &color)
 
void on_create_marker_here () const
 

Private Attributes

pv::widgets::Popuppopup_
 
QFormLayout * popup_form_
 

Static Private Attributes

static const QPen AxisPen
 
static const int LabelHitPadding = 2
 
static const QColor BrightGrayBGColor = QColor(0, 0, 0, 10 * 255 / 100)
 
static const QColor DarkGrayBGColor = QColor(0, 0, 0, 15 * 255 / 100)
 
static const QColor ErrorBgColor = QColor(0xEF, 0x29, 0x29)
 

Additional Inherited Members

- Static Public Member Functions inherited from pv::views::trace::ViewItem
static QColor select_text_color (QColor background)
 
- Static Public Attributes inherited from pv::views::trace::ViewItem
static const QSizeF LabelPadding
 
static const int HighlightRadius = 3
 
- Static Protected Member Functions inherited from pv::views::trace::ViewItem
static QPen highlight_pen ()
 
- Properties inherited from pv::views::trace::TraceTreeItem
int visual_v_offset
 

Detailed Description

The Trace class represents a TraceTreeItem which occupies some vertical space on the canvas and spans across its entire width, essentially showing a time series of values, events, objects or similar. While easily confused with Signal, the difference is that Trace may represent anything that can be drawn, not just numeric values. One example is a DecodeTrace.

For this reason, Trace is more generic and contains properties and helpers that benefit any kind of time series items.

Definition at line 63 of file trace.hpp.

Member Enumeration Documentation

Allowed values for the multi-segment display mode.

Note: Consider these locations when updating the list:

Enumerator
ShowLastSegmentOnly 
ShowLastCompleteSegmentOnly 
ShowSingleSegmentOnly 
ShowAllSegments 
ShowAccumulatedIntensity 

Definition at line 80 of file trace.hpp.

Constructor & Destructor Documentation

pv::views::trace::Trace::Trace ( shared_ptr< data::SignalBase signal)
protected

Definition at line 54 of file trace.cpp.

Here is the call graph for this function:

pv::views::trace::Trace::~Trace ( )
protected

Definition at line 76 of file trace.cpp.

Here is the call graph for this function:

Member Function Documentation

void pv::views::trace::Trace::add_color_option ( QWidget *  parent,
QFormLayout *  form 
)
protected

Definition at line 327 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

shared_ptr< data::SignalBase > pv::views::trace::Trace::base ( ) const

Returns the underlying SignalBase instance.

Definition at line 81 of file trace.cpp.

QMenu * pv::views::trace::Trace::create_header_context_menu ( QWidget *  parent)
virtual

Reimplemented from pv::views::trace::ViewItem.

Reimplemented in pv::views::trace::DecodeTrace, and pv::views::trace::Signal.

Definition at line 201 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

pv::widgets::Popup * pv::views::trace::Trace::create_popup ( QWidget *  parent)
virtual

Reimplemented from pv::views::trace::ViewItem.

Definition at line 236 of file trace.cpp.

Here is the call graph for this function:

void pv::views::trace::Trace::create_popup_form ( )
protected

Definition at line 362 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QMenu * pv::views::trace::Trace::create_view_context_menu ( QWidget *  parent,
QPoint &  click_pos 
)
virtual

Reimplemented from pv::views::trace::ViewItem.

Reimplemented in pv::views::trace::DecodeTrace.

Definition at line 208 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int pv::views::trace::Trace::get_current_segment ( ) const

Definition at line 286 of file trace.cpp.

QRectF pv::views::trace::Trace::hit_box_rect ( const ViewItemPaintParams pp) const
virtual

Computes the outline rectangle of the viewport hit-box.

Parameters
ppThe painting parameters object to paint with.
Returns
Returns the rectangle of the hit-box.
Remarks
The default implementation returns an empty hit-box.

Reimplemented from pv::views::trace::ViewItem.

Definition at line 267 of file trace.cpp.

Here is the call graph for this function:

void pv::views::trace::Trace::hover_point_changed ( const QPoint &  hp)
virtual

Reimplemented from pv::views::trace::ViewItem.

Reimplemented in pv::views::trace::DecodeTrace, and pv::views::trace::AnalogSignal.

Definition at line 291 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool pv::views::trace::Trace::is_draggable ( QPoint  pos) const
virtual

Returns true if the item may be dragged/moved.

Reimplemented from pv::views::trace::ViewItem.

Definition at line 95 of file trace.cpp.

Here is the call graph for this function:

bool pv::views::trace::Trace::is_selectable ( QPoint  pos) const
virtual

Returns true if the item may be selected.

Reimplemented from pv::views::trace::ViewItem.

Definition at line 86 of file trace.cpp.

Here is the call graph for this function:

QRectF pv::views::trace::Trace::label_rect ( const QRectF &  rect) const
virtual

Computes the outline rectangle of a label.

Parameters
rectthe rectangle of the header area.
Returns
Returns the rectangle of the signal label.

Reimplemented from pv::views::trace::ViewItem.

Definition at line 251 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::on_color_changed ( const QColor &  color)
protectedvirtualslot

Definition at line 419 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::on_coloredit_changed ( const QColor &  color)
privateslot

Definition at line 449 of file trace.cpp.

Here is the caller graph for this function:

void pv::views::trace::Trace::on_create_marker_here ( ) const
privateslot

Definition at line 455 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::on_error_message_changed ( const QString &  msg)
protectedvirtualslot

Definition at line 428 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::on_name_changed ( const QString &  text)
protectedvirtualslot

Definition at line 408 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::on_nameedit_changed ( const QString &  name)
privateslot

Definition at line 442 of file trace.cpp.

Here is the caller graph for this function:

void pv::views::trace::Trace::on_popup_closed ( )
protectedslot

Definition at line 436 of file trace.cpp.

Here is the caller graph for this function:

void pv::views::trace::Trace::on_setting_changed ( const QString &  key,
const QVariant &  value 
)
virtual

Implements pv::GlobalSettingsInterface.

Definition at line 114 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::paint_axis ( QPainter &  p,
ViewItemPaintParams pp,
int  y 
)
protected

Paints a zero axis across the viewport.

Parameters
pthe QPainter to paint into.
ppthe painting parameters object to paint with.
ythe y-offset of the axis.

Definition at line 316 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::paint_back ( QPainter &  p,
ViewItemPaintParams pp 
)
protectedvirtual

Paints the background layer of the signal with a QPainter.

Parameters
pThe QPainter to paint into.
ppThe painting parameters object to paint with.

Reimplemented from pv::views::trace::ViewItem.

Reimplemented in pv::views::trace::DecodeTrace, pv::views::trace::Signal, and pv::views::trace::AnalogSignal.

Definition at line 299 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::paint_error ( QPainter &  p,
const ViewItemPaintParams pp 
)
virtual

Paints the signal's current error message text.

Parameters
pthe QPainter to paint into.
ppThe painting parameters object to paint with.

Definition at line 181 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::paint_hover_marker ( QPainter &  p)
protected

Draw a hover marker under the cursor position.

Parameters
pThe painter to draw into.

Definition at line 341 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::paint_label ( QPainter &  p,
const QRect &  rect,
bool  hover 
)
virtual

Paints the signal label.

Parameters
pthe QPainter to paint into.
rectthe rectangle of the header area.
hovertrue if the label is being hovered over by the mouse.

Reimplemented from pv::views::trace::ViewItem.

Definition at line 124 of file trace.cpp.

Here is the call graph for this function:

void pv::views::trace::Trace::populate_popup_form ( QWidget *  parent,
QFormLayout *  form 
)
protectedvirtual

Reimplemented in pv::views::trace::DecodeTrace, pv::views::trace::AnalogSignal, pv::views::trace::LogicSignal, pv::views::trace::Signal, and pv::views::trace::MathSignal.

Definition at line 397 of file trace.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::views::trace::Trace::set_current_segment ( const int  segment)

Definition at line 281 of file trace.cpp.

void pv::views::trace::Trace::set_segment_display_mode ( SegmentDisplayMode  mode)
virtual

Configures the segment display mode to use.

Definition at line 106 of file trace.cpp.

Here is the call graph for this function:

Member Data Documentation

QPen pv::views::trace::Trace::axis_pen_
protected

Definition at line 209 of file trace.hpp.

const QPen pv::views::trace::Trace::AxisPen
staticprivate

Definition at line 89 of file trace.hpp.

shared_ptr<data::SignalBase> pv::views::trace::Trace::base_
protected

Definition at line 208 of file trace.hpp.

const QColor pv::views::trace::Trace::BrightGrayBGColor = QColor(0, 0, 0, 10 * 255 / 100)
staticprivate

Definition at line 92 of file trace.hpp.

uint32_t pv::views::trace::Trace::context_menu_x_pos_
protected

Definition at line 214 of file trace.hpp.

int pv::views::trace::Trace::current_segment_
protected

The ID of the currently displayed segment.

Definition at line 217 of file trace.hpp.

const QColor pv::views::trace::Trace::DarkGrayBGColor = QColor(0, 0, 0, 15 * 255 / 100)
staticprivate

Definition at line 93 of file trace.hpp.

const QColor pv::views::trace::Trace::ErrorBgColor = QColor(0xEF, 0x29, 0x29)
staticprivate

Definition at line 94 of file trace.hpp.

const int pv::views::trace::Trace::LabelHitPadding = 2
staticprivate

Definition at line 90 of file trace.hpp.

pv::widgets::Popup* pv::views::trace::Trace::popup_
private

Definition at line 220 of file trace.hpp.

QFormLayout* pv::views::trace::Trace::popup_form_
private

Definition at line 221 of file trace.hpp.

SegmentDisplayMode pv::views::trace::Trace::segment_display_mode_
protected

Definition at line 211 of file trace.hpp.

bool pv::views::trace::Trace::show_hover_marker_
protected

Definition at line 212 of file trace.hpp.


The documentation for this class was generated from the following files: