projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MarginWidget: Moved in mouseMoveEvent
[pulseview.git]
/
pv
/
view
/
cursorpair.cpp
diff --git
a/pv/view/cursorpair.cpp
b/pv/view/cursorpair.cpp
index f9f7ba21ea93faa865653914086e2b4718d3b23b..ea60b6ce1191415f6c6ef449c19846e4145193f3 100644
(file)
--- a/
pv/view/cursorpair.cpp
+++ b/
pv/view/cursorpair.cpp
@@
-36,6
+36,7
@@
namespace pv {
namespace view {
const int CursorPair::DeltaPadding = 8;
namespace view {
const int CursorPair::DeltaPadding = 8;
+const QColor CursorPair::ViewportFillColour(220, 231, 243);
CursorPair::CursorPair(View &view) :
TimeItem(view),
CursorPair::CursorPair(View &view) :
TimeItem(view),
@@
-70,9
+71,9
@@
float CursorPair::get_x() const
return (first_->get_x() + second_->get_x()) / 2.0f;
}
return (first_->get_x() + second_->get_x()) / 2.0f;
}
-QPoint CursorPair::point() const
+QPoint CursorPair::point(
const QRect &rect
) const
{
{
- return first_->point();
+ return first_->point(
rect
);
}
pv::widgets::Popup* CursorPair::create_popup(QWidget *parent)
}
pv::widgets::Popup* CursorPair::create_popup(QWidget *parent)
@@
-83,9
+84,7
@@
pv::widgets::Popup* CursorPair::create_popup(QWidget *parent)
QRectF CursorPair::label_rect(const QRectF &rect) const
{
QRectF CursorPair::label_rect(const QRectF &rect) const
{
- const QSizeF label_size(
- text_size_.width() + View::LabelPadding.width() * 2,
- text_size_.height() + View::LabelPadding.height() * 2);
+ const QSizeF label_size(text_size_ + LabelPadding * 2);
const pair<float, float> offsets(get_cursor_offsets());
const pair<float, float> normal_offsets(
(offsets.first < offsets.second) ? offsets :
const pair<float, float> offsets(get_cursor_offsets());
const pair<float, float> normal_offsets(
(offsets.first < offsets.second) ? offsets :
@@
-97,17
+96,23
@@
QRectF CursorPair::label_rect(const QRectF &rect) const
(float)rect.width() + height);
return QRectF(left, rect.height() - label_size.height() -
(float)rect.width() + height);
return QRectF(left, rect.height() - label_size.height() -
- TimeMarker::ArrowSize -
TimeMarker::Offset -
0.5f,
+ TimeMarker::ArrowSize - 0.5f,
right - left, height);
}
right - left, height);
}
-void CursorPair::
draw_markers(QPainter &p, const QRect &rect
)
+void CursorPair::
paint_label(QPainter &p, const QRect &rect, bool hover
)
{
assert(first_);
assert(second_);
{
assert(first_);
assert(second_);
+ if (!enabled())
+ return;
+
const unsigned int prefix = view_.tick_prefix();
const unsigned int prefix = view_.tick_prefix();
+ const QColor text_colour =
+ ViewItem::select_text_colour(Cursor::FillColour);
+ p.setPen(text_colour);
compute_text_size(p, prefix);
QRectF delta_rect(label_rect(rect));
compute_text_size(p, prefix);
QRectF delta_rect(label_rect(rect));
@@
-118,7
+123,14
@@
void CursorPair::draw_markers(QPainter &p, const QRect &rect)
{
const int highlight_radius = delta_rect.height() / 2 - 2;
{
const int highlight_radius = delta_rect.height() / 2 - 2;
- p.setBrush(Cursor::FillColour);
+ if (selected()) {
+ p.setBrush(Qt::transparent);
+ p.setPen(highlight_pen());
+ p.drawRoundedRect(delta_rect, radius, radius);
+ }
+
+ p.setBrush(hover ? Cursor::FillColour.lighter() :
+ Cursor::FillColour);
p.setPen(Cursor::FillColour.darker());
p.drawRoundedRect(delta_rect, radius, radius);
p.setPen(Cursor::FillColour.darker());
p.drawRoundedRect(delta_rect, radius, radius);
@@
-126,40
+138,26
@@
void CursorPair::draw_markers(QPainter &p, const QRect &rect)
p.setPen(Cursor::FillColour.lighter());
p.drawRoundedRect(delta_rect, highlight_radius, highlight_radius);
p.setPen(Cursor::FillColour.lighter());
p.drawRoundedRect(delta_rect, highlight_radius, highlight_radius);
- p.setPen(SelectableItem::select_text_colour(
- Cursor::FillColour));
+ p.setPen(text_colour);
p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
pv::util::format_time(second_->time() - first_->time(), prefix, 2));
}
p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
pv::util::format_time(second_->time() - first_->time(), prefix, 2));
}
-
- // Paint the cursor markers
- first_->paint_label(p, rect);
- second_->paint_label(p, rect);
}
}
-void CursorPair::draw_viewport_background(QPainter &p,
- const QRect &rect)
-{
+void CursorPair::paint_back(QPainter &p, const ViewItemPaintParams &pp) {
+ if (!enabled())
+ return;
+
p.setPen(Qt::NoPen);
p.setPen(Qt::NoPen);
- p.setBrush(QBrush(View
::CursorArea
Colour));
+ p.setBrush(QBrush(View
portFill
Colour));
const pair<float, float> offsets(get_cursor_offsets());
const int l = (int)max(min(
offsets.first, offsets.second), 0.0f);
const int r = (int)min(max(
const pair<float, float> offsets(get_cursor_offsets());
const int l = (int)max(min(
offsets.first, offsets.second), 0.0f);
const int r = (int)min(max(
- offsets.first, offsets.second), (float)rect.width());
-
- p.drawRect(l, 0, r - l, rect.height());
-}
-
-void CursorPair::draw_viewport_foreground(QPainter &p,
- const QRect &rect)
-{
- assert(first_);
- assert(second_);
+ offsets.first, offsets.second), (float)pp.width());
- first_->paint(p, rect);
- second_->paint(p, rect);
+ p.drawRect(l, pp.top(), r - l, pp.height());
}
void CursorPair::compute_text_size(QPainter &p, unsigned int prefix)
}
void CursorPair::compute_text_size(QPainter &p, unsigned int prefix)