![]() |
PulseView
unreleased development snapshot
A Qt-based sigrok GUI
|
#include <ruler.hpp>
Public Member Functions | |
Ruler (View &parent) | |
QSize | sizeHint () const override |
QSize | extended_size_hint () const override |
pv::util::Timestamp | get_absolute_time_from_x_pos (uint32_t x) const |
pv::util::Timestamp | get_ruler_time_from_x_pos (uint32_t x) const |
pv::util::Timestamp | get_ruler_time_from_absolute_time (const pv::util::Timestamp &abs_time) const |
pv::util::Timestamp | get_absolute_time_from_ruler_time (const pv::util::Timestamp &ruler_time) const |
shared_ptr< TimeItem > | get_reference_item () const |
![]() | |
MarginWidget (View &parent) | |
Static Public Member Functions | |
static QString | format_time_with_distance (const pv::util::Timestamp &distance, const pv::util::Timestamp &t, pv::util::SIPrefix prefix=pv::util::SIPrefix::unspecified, pv::util::TimeUnit unit=pv::util::TimeUnit::Time, unsigned precision=0, bool sign=true) |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *event) override |
void | resizeEvent (QResizeEvent *) override |
virtual void | item_hover (const shared_ptr< ViewItem > &item, QPoint pos) override |
![]() | |
virtual void | item_clicked (const shared_ptr< ViewItem > &item) |
void | show_popup (const shared_ptr< ViewItem > &item) |
![]() | |
ViewWidget (View &parent) | |
bool | accept_drag () const |
bool | mouse_down () const |
void | drag_items (const QPoint &delta) |
virtual void | drag () |
virtual void | drag_by (const QPoint &delta) |
virtual void | drag_release () |
void | mouse_left_press_event (QMouseEvent *event) |
void | mouse_left_release_event (QMouseEvent *event) |
virtual bool | touch_event (QTouchEvent *event) |
bool | event (QEvent *event) |
void | mousePressEvent (QMouseEvent *event) |
void | mouseReleaseEvent (QMouseEvent *event) |
void | mouseMoveEvent (QMouseEvent *event) |
void | keyPressEvent (QKeyEvent *event) |
void | keyReleaseEvent (QKeyEvent *event) |
void | leaveEvent (QEvent *event) |
Private Slots | |
void | on_hover_point_changed (const QWidget *widget, const QPoint &hp) |
void | invalidate_tick_position_cache () |
void | on_createMarker () |
void | on_setZeroPosition () |
void | on_resetZeroPosition () |
void | on_toggleHoverMarker () |
Private Member Functions | |
vector< shared_ptr< ViewItem > > | items () override |
shared_ptr< ViewItem > | get_mouse_over_item (const QPoint &pt) override |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
void | paintEvent (QPaintEvent *event) override |
void | draw_hover_mark (QPainter &p, int text_height) |
int | calculate_text_height () const |
Static Private Member Functions | |
static TickPositions | calculate_tick_positions (const pv::util::Timestamp &major_period, const pv::util::Timestamp &offset, const double scale, const int width, const unsigned int minor_tick_count, function< QString(const pv::util::Timestamp &)> format_function) |
Private Attributes | |
boost::optional< TickPositions > | tick_position_cache_ |
shared_ptr< TimeItem > | hover_item_ |
uint32_t | context_menu_x_pos_ |
Static Private Attributes | |
static const float | RulerHeight = 2.5f |
Height of the ruler in multipes of the text height. More... | |
static const float | HoverArrowSize = 0.5f |
Height of the hover arrow in multiples of the text height. More... | |
Friends | |
struct | RulerTest::tick_position_test_0 |
struct | RulerTest::tick_position_test_1 |
struct | RulerTest::tick_position_test_2 |
Additional Inherited Members | |
![]() | |
void | clear_selection () |
![]() | |
void | selection_changed () |
![]() | |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | on_popup_closed () |
![]() | |
pv::views::trace::View & | view_ |
QPoint | mouse_point_ |
QPoint | mouse_down_point_ |
pv::util::Timestamp | mouse_down_offset_ |
shared_ptr< ViewItem > | mouse_down_item_ |
Qt::KeyboardModifiers | mouse_modifiers_ |
Keyboard modifiers that were active when mouse was last moved or clicked. More... | |
bool | item_dragging_ |
The Ruler class manages and displays the time scale above the trace canvas. It may also contain TimeItem instances used to identify or highlight time-related information.
pv::views::trace::Ruler::Ruler | ( | View & | parent | ) |
|
private |
|
staticprivate |
Calculates the major and minor tick positions.
major_period | The period between the major ticks. |
offset | The virtual time at the left border of the ruler. |
scale | The scale in seconds per pixel. |
width | the Width of the ruler. |
format_function | A function used to format the major tick times. |
Definition at line 349 of file ruler.cpp.
|
overrideprotectedvirtual |
Reimplemented from pv::views::trace::MarginWidget.
Definition at line 141 of file ruler.cpp.
|
private |
|
overridevirtual |
The extended area that the header widget would like to be sized to.
Implements pv::views::trace::MarginWidget.
Definition at line 74 of file ruler.cpp.
|
static |
Formats a timestamp depending on its distance to another timestamp.
Heuristic function, useful when multiple timestamps should be put side by side. The function procedes in the following order:
distance | The distance between the timestamp to format and an adjacent one. |
t | The value to format |
prefix | The SI prefix to use. |
unit | The representation of the timestamp value. |
precision | The number of digits after the decimal separator. |
sign | Whether or not to add a sign also for positive numbers. |
Definition at line 84 of file ruler.cpp.
pv::util::Timestamp pv::views::trace::Ruler::get_absolute_time_from_ruler_time | ( | const pv::util::Timestamp & | ruler_time | ) | const |
pv::util::Timestamp pv::views::trace::Ruler::get_absolute_time_from_x_pos | ( | uint32_t | x | ) | const |
|
overrideprivatevirtual |
Gets the first view item which has a label that contains pt
.
pt | the point to search with. |
shared_ptr
if no item was found. Implements pv::views::trace::ViewWidget.
Definition at line 232 of file ruler.cpp.
shared_ptr< TimeItem > pv::views::trace::Ruler::get_reference_item | ( | ) | const |
pv::util::Timestamp pv::views::trace::Ruler::get_ruler_time_from_absolute_time | ( | const pv::util::Timestamp & | abs_time | ) | const |
pv::util::Timestamp pv::views::trace::Ruler::get_ruler_time_from_x_pos | ( | uint32_t | x | ) | const |
|
privateslot |
|
overrideprotectedvirtual |
Indicates when a view item is being hovered over.
item | The item that is being hovered over, or nullptr if no view item is being hovered over. |
Reimplemented from pv::views::trace::ViewWidget.
|
overrideprivatevirtual |
Gets the time items.
Implements pv::views::trace::ViewWidget.
Definition at line 187 of file ruler.cpp.
|
overrideprivate |
|
privateslot |
|
privateslot |
|
privateslot |
|
privateslot |
|
privateslot |
|
overrideprivate |
|
overrideprotected |
|
override |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
Holds the tick positions so that they don't have to be recalculated on every redraw. Set by 'paintEvent()' when needed.