projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
819e2e9
)
ViewItem: Moved in paint_label
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Thu, 18 Dec 2014 21:16:20 +0000
(21:16 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 28 Dec 2014 18:52:53 +0000
(18:52 +0000)
pv/view/cursorpair.cpp
patch
|
blob
|
history
pv/view/cursorpair.hpp
patch
|
blob
|
history
pv/view/rowitem.hpp
patch
|
blob
|
history
pv/view/ruler.cpp
patch
|
blob
|
history
pv/view/timeitem.hpp
patch
|
blob
|
history
pv/view/timemarker.cpp
patch
|
blob
|
history
pv/view/timemarker.hpp
patch
|
blob
|
history
pv/view/viewitem.hpp
patch
|
blob
|
history
diff --git
a/pv/view/cursorpair.cpp
b/pv/view/cursorpair.cpp
index c5a1bc9923beafb00c805eff8f331735a764bbdf..a14f458bedd96710304cb06ad262944e5a91278d 100644
(file)
--- a/
pv/view/cursorpair.cpp
+++ b/
pv/view/cursorpair.cpp
@@
-101,7
+101,7
@@
QRectF CursorPair::label_rect(const QRectF &rect) const
right - left, height);
}
right - left, height);
}
-void CursorPair::paint_label(QPainter &p, const QRect &rect)
+void CursorPair::paint_label(QPainter &p, const QRect &rect
, bool hover
)
{
assert(first_);
assert(second_);
{
assert(first_);
assert(second_);
@@
-130,7
+130,8
@@
void CursorPair::paint_label(QPainter &p, const QRect &rect)
p.drawRoundedRect(delta_rect, radius, radius);
}
p.drawRoundedRect(delta_rect, radius, radius);
}
- p.setBrush(Cursor::FillColour);
+ 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);
diff --git
a/pv/view/cursorpair.hpp
b/pv/view/cursorpair.hpp
index af7f5556c722bc83609e72664a5b610858072d08..fc9f0d1ba6f4a4edc718e869bfe61dd381588641 100644
(file)
--- a/
pv/view/cursorpair.hpp
+++ b/
pv/view/cursorpair.hpp
@@
-74,7
+74,13
@@
public:
public:
QRectF label_rect(const QRectF &rect) const;
public:
QRectF label_rect(const QRectF &rect) const;
- void paint_label(QPainter &p, const QRect &rect);
+ /**
+ * Paints the marker's label to the ruler.
+ * @param p The painter to draw with.
+ * @param rect The rectangle of the ruler client area.
+ * @param hover true if the label is being hovered over by the mouse.
+ */
+ void paint_label(QPainter &p, const QRect &rect, bool hover);
/**
* Paints the background layer of the item with a QPainter
/**
* Paints the background layer of the item with a QPainter
diff --git
a/pv/view/rowitem.hpp
b/pv/view/rowitem.hpp
index cf521ff0be88d2f030cab0c4cd4616de9728594b..d30227830e73782c4427dad7df1e19f76380297e 100644
(file)
--- a/
pv/view/rowitem.hpp
+++ b/
pv/view/rowitem.hpp
@@
-104,14
+104,6
@@
public:
*/
virtual std::pair<int, int> v_extents() const = 0;
*/
virtual std::pair<int, int> v_extents() const = 0;
- /**
- * Paints the signal label.
- * @param p the QPainter to paint into.
- * @param rect the rectangle of the header area.
- * @param hover true if the label is being hovered over by the mouse.
- */
- virtual void paint_label(QPainter &p, const QRect &rect, bool hover) = 0;
-
public:
virtual void hover_point_changed();
public:
virtual void hover_point_changed();
diff --git
a/pv/view/ruler.cpp
b/pv/view/ruler.cpp
index 7018c212db52f8b72f1449400b9160594a746dde..d08cfc43f3a1352c340f2a90b25cfbee3092da4b 100644
(file)
--- a/
pv/view/ruler.cpp
+++ b/
pv/view/ruler.cpp
@@
-138,8
+138,11
@@
void Ruler::paintEvent(QPaintEvent*)
// Draw the items
const vector< shared_ptr<TimeItem> > items(view_.time_items());
// Draw the items
const vector< shared_ptr<TimeItem> > items(view_.time_items());
- for (auto &i : items)
- i->paint_label(p, r);
+ for (auto &i : items) {
+ const bool highlight = !dragging_ &&
+ i->label_rect(r).contains(mouse_point_);
+ i->paint_label(p, r, highlight);
+ }
}
void Ruler::mouseMoveEvent(QMouseEvent *e)
}
void Ruler::mouseMoveEvent(QMouseEvent *e)
diff --git
a/pv/view/timeitem.hpp
b/pv/view/timeitem.hpp
index 8374244215807b5c34e4433c441c8f4a19582e6d..f988488409c18426aebab42b720dab2d54731987 100644
(file)
--- a/
pv/view/timeitem.hpp
+++ b/
pv/view/timeitem.hpp
@@
-48,13
+48,6
@@
public:
virtual float get_x() const = 0;
virtual float get_x() const = 0;
- /**
- * Paints the marker's label to the ruler.
- * @param p The painter to draw with.
- * @param rect The rectangle of the ruler client area.
- */
- virtual void paint_label(QPainter &p, const QRect &rect) = 0;
-
protected:
View &view_;
};
protected:
View &view_;
};
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index ed9df36064f74407b1a1ee81f80d11378adbc81c..399664675bd83b61c40ec484e8aa4842705625ad 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-100,7
+100,7
@@
QRectF TimeMarker::label_rect(const QRectF &rect) const
label_size.width(), height);
}
label_size.width(), height);
}
-void TimeMarker::paint_label(QPainter &p, const QRect &rect)
+void TimeMarker::paint_label(QPainter &p, const QRect &rect
, bool hover
)
{
if (!enabled())
return;
{
if (!enabled())
return;
@@
-136,7
+136,7
@@
void TimeMarker::paint_label(QPainter &p, const QRect &rect)
}
p.setPen(Qt::transparent);
}
p.setPen(Qt::transparent);
- p.setBrush(colour_);
+ p.setBrush(
hover ? colour_.lighter() :
colour_);
p.drawPolygon(points, countof(points));
p.setPen(colour_.lighter());
p.drawPolygon(points, countof(points));
p.setPen(colour_.lighter());
diff --git
a/pv/view/timemarker.hpp
b/pv/view/timemarker.hpp
index 9cab1fc6d0a96e666069e635c564a0d62ac80ab5..57d6c9b04ecc1bb7cb58d3c812688ecd31cfb2d5 100644
(file)
--- a/
pv/view/timemarker.hpp
+++ b/
pv/view/timemarker.hpp
@@
-88,8
+88,9
@@
public:
* Paints the marker's label to the ruler.
* @param p The painter to draw with.
* @param rect The rectangle of the ruler client area.
* Paints the marker's label to the ruler.
* @param p The painter to draw with.
* @param rect The rectangle of the ruler client area.
+ * @param hover true if the label is being hovered over by the mouse.
*/
*/
- void paint_label(QPainter &p, const QRect &rect);
+ void paint_label(QPainter &p, const QRect &rect
, bool hover
);
/**
* Paints the foreground layer of the item with a QPainter
/**
* Paints the foreground layer of the item with a QPainter
diff --git
a/pv/view/viewitem.hpp
b/pv/view/viewitem.hpp
index 12e1f44fc7659ac538ea6d8725ca60fcc3b4b116..3e6801fe3186dffe74c10263f27b4192e95ef871 100644
(file)
--- a/
pv/view/viewitem.hpp
+++ b/
pv/view/viewitem.hpp
@@
-97,6
+97,14
@@
public:
*/
virtual QRectF label_rect(const QRectF &rect) const = 0;
*/
virtual QRectF label_rect(const QRectF &rect) const = 0;
+ /**
+ * Paints the signal label.
+ * @param p the QPainter to paint into.
+ * @param rect the rectangle of the header area.
+ * @param hover true if the label is being hovered over by the mouse.
+ */
+ virtual void paint_label(QPainter &p, const QRect &rect, bool hover) = 0;
+
/**
* Paints the background layer of the item with a QPainter
* @param p the QPainter to paint into.
/**
* Paints the background layer of the item with a QPainter
* @param p the QPainter to paint into.