PulseView  0.3.0
A Qt-based sigrok GUI
pv::view::ViewItem Class Referenceabstract

#include <viewitem.hpp>

Inheritance diagram for pv::view::ViewItem:
Collaboration diagram for pv::view::ViewItem:

Public Member Functions

 ViewItem ()
 
virtual bool enabled () const =0
 
bool selected () const
 
virtual void select (bool select=true)
 
virtual bool is_draggable () const
 
bool dragging () const
 
void drag ()
 
virtual void drag_release ()
 
virtual void drag_by (const QPoint &delta)=0
 
virtual QPoint 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, const ViewItemPaintParams &pp)
 
virtual void paint_mid (QPainter &p, const ViewItemPaintParams &pp)
 
virtual void paint_fore (QPainter &p, const ViewItemPaintParams &pp)
 
virtual QMenu * create_context_menu (QWidget *parent)
 
virtual pv::widgets::Popupcreate_popup (QWidget *parent)
 
virtual void delete_pressed ()
 

Static Public Member Functions

static QColor select_text_colour (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 44 of file viewitem.hpp.

Constructor & Destructor Documentation

pv::view::ViewItem::ViewItem ( )

Definition at line 35 of file viewitem.cpp.

Member Function Documentation

QMenu * pv::view::ViewItem::create_context_menu ( QWidget *  parent)
virtual

Reimplemented in pv::view::DecodeTrace, pv::view::TraceGroup, pv::view::Trace, pv::view::Signal, and pv::view::Flag.

Definition at line 85 of file viewitem.cpp.

Here is the caller graph for this function:

widgets::Popup * pv::view::ViewItem::create_popup ( QWidget *  parent)
virtual
void pv::view::ViewItem::delete_pressed ( )
virtual

Reimplemented in pv::view::DecodeTrace, pv::view::Signal, and pv::view::Flag.

Definition at line 97 of file viewitem.cpp.

void pv::view::ViewItem::drag ( )

Sets this item into the dragged state.

Definition at line 62 of file viewitem.cpp.

Here is the call graph for this function:

virtual void pv::view::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::view::TraceTreeItem, pv::view::SignalScaleHandle, and pv::view::TimeItem.

void pv::view::ViewItem::drag_release ( )
virtual

Sets this item into the un-dragged state.

Reimplemented in pv::view::SignalScaleHandle.

Definition at line 68 of file viewitem.cpp.

Here is the caller graph for this function:

bool pv::view::ViewItem::dragging ( ) const

Returns true if the item is being dragged.

Definition at line 57 of file viewitem.cpp.

virtual bool pv::view::ViewItem::enabled ( ) const
pure virtual

Returns true if the item is visible and enabled.

Implemented in pv::view::DecodeTrace, pv::view::Signal, pv::view::Flag, pv::view::Cursor, pv::view::CursorPair, pv::view::TriggerMarker, pv::view::TraceGroup, and pv::view::SignalScaleHandle.

Here is the caller graph for this function:

QPen pv::view::ViewItem::highlight_pen ( )
staticprotected

Definition at line 101 of file viewitem.cpp.

Here is the caller graph for this function:

QRectF pv::view::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::view::TimeMarker, and pv::view::SignalScaleHandle.

Definition at line 79 of file viewitem.cpp.

bool pv::view::ViewItem::is_draggable ( ) const
virtual

Returns true if the item may be dragged/moved.

Reimplemented in pv::view::TriggerMarker.

Definition at line 52 of file viewitem.cpp.

Here is the caller graph for this function:

QRectF pv::view::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::view::Trace, pv::view::TraceGroup, pv::view::TimeMarker, pv::view::CursorPair, and pv::view::Cursor.

Definition at line 73 of file viewitem.cpp.

void pv::view::ViewItem::paint_back ( QPainter &  p,
const 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::view::Trace, pv::view::DecodeTrace, pv::view::CursorPair, pv::view::AnalogSignal, and pv::view::Signal.

Definition at line 115 of file viewitem.cpp.

void pv::view::ViewItem::paint_fore ( QPainter &  p,
const 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::view::DecodeTrace, pv::view::TimeMarker, pv::view::LogicSignal, pv::view::SignalScaleHandle, and pv::view::TriggerMarker.

Definition at line 127 of file viewitem.cpp.

void pv::view::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::view::TimeMarker, pv::view::Trace, pv::view::CursorPair, and pv::view::TraceGroup.

Definition at line 108 of file viewitem.cpp.

void pv::view::ViewItem::paint_mid ( QPainter &  p,
const 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::view::DecodeTrace, pv::view::LogicSignal, and pv::view::AnalogSignal.

Definition at line 121 of file viewitem.cpp.

virtual QPoint pv::view::ViewItem::point ( const QRect &  rect) const
pure virtual

Get the drag point.

Parameters
rectthe rectangle of the widget area.

Implemented in pv::view::TraceTreeItem, pv::view::TimeMarker, pv::view::CursorPair, pv::view::SignalScaleHandle, and pv::view::TriggerMarker.

Here is the caller graph for this function:

void pv::view::ViewItem::select ( bool  select = true)
virtual

Selects or deselects the signal.

Reimplemented in pv::view::TraceTreeItem, and pv::view::SignalScaleHandle.

Definition at line 47 of file viewitem.cpp.

Here is the caller graph for this function:

QColor pv::view::ViewItem::select_text_colour ( QColor  background)
static

Gets the text colour.

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

Definition at line 133 of file viewitem.cpp.

Here is the caller graph for this function:

bool pv::view::ViewItem::selected ( ) const

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

Definition at line 42 of file viewitem.cpp.

Here is the caller graph for this function:

Member Data Documentation

QWidget* pv::view::ViewItem::context_parent_
protected

Definition at line 168 of file viewitem.hpp.

QPoint pv::view::ViewItem::drag_point_
protected

Definition at line 169 of file viewitem.hpp.

const int pv::view::ViewItem::HighlightRadius = 3
static

Definition at line 50 of file viewitem.hpp.

const QSizeF pv::view::ViewItem::LabelPadding
static

Definition at line 49 of file viewitem.hpp.

bool pv::view::ViewItem::selected_
private

Definition at line 172 of file viewitem.hpp.


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