PulseView  unreleased development snapshot
A Qt-based sigrok GUI
pv::views::trace::ViewItem Class Referenceabstract

#include <viewitem.hpp>

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

Public Member Functions

 ViewItem ()
 
virtual bool enabled () const =0
 
virtual bool is_selectable (QPoint pos) const
 
bool selected () const
 
virtual void select (bool select=true)
 
virtual bool is_draggable (QPoint pos) const
 
bool dragging () const
 
void drag ()
 
virtual void drag_release ()
 
virtual void drag_by (const QPoint &delta)=0
 
virtual QPoint drag_point (const QRect &rect) const =0
 
virtual QRectF label_rect (const QRectF &rect) const
 
virtual QRectF hit_box_rect (const ViewItemPaintParams &pp) const
 
virtual void paint_label (QPainter &p, const QRect &rect, bool hover)
 
virtual void paint_back (QPainter &p, ViewItemPaintParams &pp)
 
virtual void paint_mid (QPainter &p, ViewItemPaintParams &pp)
 
virtual void paint_fore (QPainter &p, ViewItemPaintParams &pp)
 
virtual QMenu * create_header_context_menu (QWidget *parent)
 
virtual QMenu * create_view_context_menu (QWidget *parent, QPoint &click_pos)
 
virtual pv::widgets::Popupcreate_popup (QWidget *parent)
 
virtual void delete_pressed ()
 
virtual void hover_point_changed (const QPoint &hp)
 
virtual void mouse_left_press_event (const QMouseEvent *event)
 

Static Public Member Functions

static QColor select_text_color (QColor background)
 

Static Public Attributes

static const QSizeF LabelPadding
 
static const int HighlightRadius = 3
 

Static Protected Member Functions

static QPen highlight_pen ()
 

Protected Attributes

QWidget * context_parent_
 
QPoint drag_point_
 

Private Attributes

bool selected_
 

Detailed Description

Definition at line 46 of file viewitem.hpp.

Constructor & Destructor Documentation

pv::views::trace::ViewItem::ViewItem ( )

Definition at line 35 of file viewitem.cpp.

Member Function Documentation

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

Reimplemented in pv::views::trace::DecodeTrace, pv::views::trace::Trace, pv::views::trace::TraceGroup, pv::views::trace::Signal, pv::views::trace::CursorPair, pv::views::trace::Flag, and pv::views::trace::Cursor.

Definition at line 91 of file viewitem.cpp.

Here is the caller graph for this function:

widgets::Popup * pv::views::trace::ViewItem::create_popup ( QWidget *  parent)
virtual
QMenu * pv::views::trace::ViewItem::create_view_context_menu ( QWidget *  parent,
QPoint &  click_pos 
)
virtual

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

Definition at line 97 of file viewitem.cpp.

Here is the caller graph for this function:

void pv::views::trace::ViewItem::delete_pressed ( )
virtual
void pv::views::trace::ViewItem::drag ( )

Sets this item into the dragged state.

Definition at line 69 of file viewitem.cpp.

Here is the call graph for this function:

virtual void pv::views::trace::ViewItem::drag_by ( const QPoint &  delta)
pure virtual

Drags the item to a delta relative to the drag point.

Parameters
deltathe offset from the drag point.

Implemented in pv::views::trace::TraceTreeItem, and pv::views::trace::TimeItem.

virtual QPoint pv::views::trace::ViewItem::drag_point ( const QRect &  rect) const
pure virtual

Get the drag point.

Parameters
rectthe rectangle of the widget area.

Implemented in pv::views::trace::TraceTreeItem, pv::views::trace::CursorPair, pv::views::trace::TimeMarker, and pv::views::trace::TriggerMarker.

Here is the caller graph for this function:

void pv::views::trace::ViewItem::drag_release ( )
virtual

Sets this item into the un-dragged state.

Definition at line 74 of file viewitem.cpp.

bool pv::views::trace::ViewItem::dragging ( ) const

Returns true if the item is being dragged.

Definition at line 64 of file viewitem.cpp.

virtual bool pv::views::trace::ViewItem::enabled ( ) const
pure virtual

Returns true if the item is visible and enabled.

Implemented in pv::views::trace::DecodeTrace, pv::views::trace::Signal, pv::views::trace::Flag, pv::views::trace::CursorPair, pv::views::trace::TriggerMarker, pv::views::trace::Cursor, and pv::views::trace::TraceGroup.

Here is the caller graph for this function:

QPen pv::views::trace::ViewItem::highlight_pen ( )
staticprotected

Definition at line 114 of file viewitem.cpp.

Here is the caller graph for this function:

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

Computes the outline rectangle of the viewport hit-box.

Parameters
rectthe rectangle of the viewport area.
Returns
Returns the rectangle of the hit-box.
Remarks
The default implementation returns an empty hit-box.

Reimplemented in pv::views::trace::Trace, and pv::views::trace::TimeMarker.

Definition at line 85 of file viewitem.cpp.

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

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

Definition at line 151 of file viewitem.cpp.

Here is the caller graph for this function:

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

Returns true if the item may be dragged/moved.

Reimplemented in pv::views::trace::Trace, and pv::views::trace::TriggerMarker.

Definition at line 58 of file viewitem.cpp.

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

Returns true if the item may be selected.

Reimplemented in pv::views::trace::Trace.

Definition at line 42 of file viewitem.cpp.

QRectF pv::views::trace::ViewItem::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.
Remarks
The default implementation returns an empty rectangle.

Reimplemented in pv::views::trace::Trace, pv::views::trace::TraceGroup, pv::views::trace::CursorPair, pv::views::trace::TimeMarker, pv::views::trace::Flag, and pv::views::trace::Cursor.

Definition at line 79 of file viewitem.cpp.

void pv::views::trace::ViewItem::mouse_left_press_event ( const QMouseEvent *  event)
virtual

Handles left mouse button press events.

Parameters
eventthe mouse event that triggered this handler.

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

Definition at line 156 of file viewitem.cpp.

void pv::views::trace::ViewItem::paint_back ( QPainter &  p,
ViewItemPaintParams pp 
)
virtual

Paints the background layer of the item with a QPainter

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

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

Definition at line 128 of file viewitem.cpp.

Here is the caller graph for this function:

void pv::views::trace::ViewItem::paint_fore ( QPainter &  p,
ViewItemPaintParams pp 
)
virtual

Paints the foreground layer of the item with a QPainter

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

Reimplemented in pv::views::trace::DecodeTrace, pv::views::trace::TimeMarker, pv::views::trace::AnalogSignal, pv::views::trace::LogicSignal, and pv::views::trace::TriggerMarker.

Definition at line 140 of file viewitem.cpp.

Here is the caller graph for this function:

void pv::views::trace::ViewItem::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 in pv::views::trace::Trace, pv::views::trace::TimeMarker, pv::views::trace::CursorPair, and pv::views::trace::TraceGroup.

Definition at line 121 of file viewitem.cpp.

void pv::views::trace::ViewItem::paint_mid ( QPainter &  p,
ViewItemPaintParams pp 
)
virtual

Paints the mid-layer of the item with a QPainter

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

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

Definition at line 134 of file viewitem.cpp.

Here is the caller graph for this function:

void pv::views::trace::ViewItem::select ( bool  select = true)
virtual

Selects or deselects the signal.

Reimplemented in pv::views::trace::TraceTreeItem.

Definition at line 53 of file viewitem.cpp.

Here is the caller graph for this function:

QColor pv::views::trace::ViewItem::select_text_color ( QColor  background)
static

Gets the text color.

Remarks
This color is computed by comparing the lightness of the trace color against a threshold to determine whether white or black would be more visible.

Definition at line 146 of file viewitem.cpp.

Here is the caller graph for this function:

bool pv::views::trace::ViewItem::selected ( ) const

Returns true if the item has been selected by the user.

Definition at line 48 of file viewitem.cpp.

Here is the caller graph for this function:

Member Data Documentation

QWidget* pv::views::trace::ViewItem::context_parent_
protected

Definition at line 183 of file viewitem.hpp.

QPoint pv::views::trace::ViewItem::drag_point_
protected

Definition at line 184 of file viewitem.hpp.

const int pv::views::trace::ViewItem::HighlightRadius = 3
static

Definition at line 52 of file viewitem.hpp.

const QSizeF pv::views::trace::ViewItem::LabelPadding
static

Definition at line 51 of file viewitem.hpp.

bool pv::views::trace::ViewItem::selected_
private

Definition at line 187 of file viewitem.hpp.


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