Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
}
+QColor SelectableItem::select_text_colour(QColor background)
+{
+ return (background.lightness() > 64) ? Qt::black : Qt::white;
+}
+
} // namespace view
} // namespace pv
*/
virtual QPoint point() const = 0;
+public:
+ /**
+ * Gets the text colour.
+ * @remarks This colour is computed by comparing the lightness
+ * of the trace colour against a threshold to determine whether
+ * white or black would be more visible.
+ */
+ static QColor select_text_colour(QColor background);
+
public:
virtual QMenu* create_context_menu(QWidget *parent);
p.drawPolygon(points, countof(points));
// Paint the text
- p.setPen(get_text_colour());
+ p.setPen(select_text_colour(colour_));
p.setFont(QApplication::font());
p.drawText(QRectF(r.x(), r.y(),
r.width() - label_arrow_length, r.height()),
label_size.height());
}
-QColor Trace::get_text_colour() const
-{
- return (colour_.lightness() > 64) ? Qt::black : Qt::white;
-}
-
void Trace::paint_axis(QPainter &p, const RowItemPaintParams &pp, int y)
{
p.setPen(AxisPen);
QRectF label_rect(int right) const;
protected:
-
- /**
- * Gets the text colour.
- * @remarks This colour is computed by comparing the lightness
- * of the trace colour against a threshold to determine whether
- * white or black would be more visible.
- */
- QColor get_text_colour() const;
-
/**
* Paints a zero axis across the viewport.
* @param p the QPainter to paint into.