projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RowItem: Combined appearance change signals into appearance_changed()
[pulseview.git]
/
pv
/
view
/
viewport.cpp
diff --git
a/pv/view/viewport.cpp
b/pv/view/viewport.cpp
index c987c3683164e598d9c1f94e8b0a88560ad33920..221714051504a81a7e48b47056217d98f67e05cb 100644
(file)
--- a/
pv/view/viewport.cpp
+++ b/
pv/view/viewport.cpp
@@
-20,6
+20,7
@@
#include <cassert>
#include <cmath>
#include <cassert>
#include <cmath>
+#include <algorithm>
#include "view.h"
#include "viewport.h"
#include "view.h"
#include "viewport.h"
@@
-33,6
+34,7
@@
using std::abs;
using std::max;
using std::min;
using std::shared_ptr;
using std::max;
using std::min;
using std::shared_ptr;
+using std::stable_sort;
using std::vector;
namespace pv {
using std::vector;
namespace pv {
@@
-55,27
+57,22
@@
Viewport::Viewport(View &parent) :
connect(&_view, SIGNAL(signals_moved()),
this, SLOT(on_signals_moved()));
connect(&_view, SIGNAL(signals_moved()),
this, SLOT(on_signals_moved()));
-
- // Trigger the initial event manually. The default device has signals
- // which were created before this object came into being
- on_signals_changed();
}
int Viewport::get_total_height() const
{
int h = 0;
}
int Viewport::get_total_height() const
{
int h = 0;
- const vector< shared_ptr<RowItem> > row_items(_view.child_items());
- for (const shared_ptr<RowItem> r : row_items) {
- assert(r);
- h = max(r->v_offset() + View::SignalHeight, h);
- }
-
+ for (auto &i : _view)
+ h = max(i->v_offset() + View::SignalHeight, h);
return h;
}
void Viewport::paintEvent(QPaintEvent*)
{
return h;
}
void Viewport::paintEvent(QPaintEvent*)
{
- const vector< shared_ptr<RowItem> > row_items(_view.child_items());
+ 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);
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
@@
-230,10
+227,9
@@
bool Viewport::touchEvent(QTouchEvent *event)
void Viewport::on_signals_changed()
{
void Viewport::on_signals_changed()
{
- const vector< shared_ptr<RowItem> > row_items(_view.child_items());
- for (shared_ptr<RowItem> r : row_items) {
+ for (shared_ptr<RowItem> r : _view) {
assert(r);
assert(r);
- connect(r.get(), SIGNAL(
visibility
_changed()),
+ connect(r.get(), SIGNAL(
appearance
_changed()),
this, SLOT(update()));
}
}
this, SLOT(update()));
}
}