- vector< shared_ptr<RowItem> > row_items(_view.begin(), _view.end());
- stable_sort(row_items.begin(), row_items.end(),
- [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
- return a->v_offset() < b->v_offset(); });
-
- QPainter p(this);
- p.setRenderHint(QPainter::Antialiasing);
-
- if (_view.cursors_shown())
- _view.cursors().draw_viewport_background(p, rect());
-
- // Plot the signal
- for (const shared_ptr<RowItem> r : row_items)
- {
- assert(r);
- r->paint_back(p, 0, width());
- }
-
- for (const shared_ptr<RowItem> r : row_items)
- r->paint_mid(p, 0, width());
-
- for (const shared_ptr<RowItem> r : row_items)
- r->paint_fore(p, 0, width());
-
- if (_view.cursors_shown())
- _view.cursors().draw_viewport_foreground(p, rect());
-
- p.end();
-}
-
-bool Viewport::event(QEvent *event)
-{
- switch (event->type()) {
- case QEvent::TouchBegin:
- case QEvent::TouchUpdate:
- case QEvent::TouchEnd:
- if (touchEvent(static_cast<QTouchEvent *>(event)))
- return true;
- break;
-
- default:
- break;
- }
-
- return QWidget::event(event);
-}
-
-void Viewport::mousePressEvent(QMouseEvent *event)
-{
- assert(event);
-
- if (event->button() == Qt::LeftButton) {
- _mouse_down_point = event->pos();
- _mouse_down_offset = _view.offset();
- _mouse_down_valid = true;
- }