#include <QGridLayout>
#include <QLabel>
#include <QSpinBox>
+#include <QString>
#include "analogsignal.hpp"
#include "pv/data/analog.hpp"
const int AnalogSignal::MinScaleIndex = -6;
const int AnalogSignal::MaxScaleIndex = 7;
+const int AnalogSignal::InfoTextMarginRight = 20;
+const int AnalogSignal::InfoTextMarginBottom = 5;
+
AnalogSignal::AnalogSignal(
pv::Session &session,
shared_ptr<Channel> channel,
pixels_offset, samples_per_pixel);
}
+void AnalogSignal::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
+{
+ if (!enabled())
+ return;
+
+ const int y = get_visual_y();
+
+ // Show the info section on the right side of the trace
+ const QString infotext = QString("%1 V/div").arg(resolution_);
+
+ p.setPen(colour_);
+ p.setFont(QApplication::font());
+
+ const QRectF bounding_rect = QRectF(pp.left(),
+ y + v_extents().first,
+ pp.width() - InfoTextMarginRight,
+ v_extents().second - v_extents().first - InfoTextMarginBottom);
+
+ p.drawText(bounding_rect, Qt::AlignRight | Qt::AlignBottom, infotext);
+}
+
void AnalogSignal::paint_grid(QPainter &p, int y, int left, int right)
{
p.setPen(QPen(GridMajorColor, 0.5, Qt::DashLine));
static const int MaximumVDivs;
static const int MaxScaleIndex, MinScaleIndex;
+ static const int InfoTextMarginRight, InfoTextMarginBottom;
public:
AnalogSignal(pv::Session &session,
*/
void paint_mid(QPainter &p, const ViewItemPaintParams &pp);
+ /**
+ * Paints the foreground layer of the item with a QPainter
+ * @param p the QPainter to paint into.
+ * @param pp the painting parameters object to paint with.
+ */
+ void paint_fore(QPainter &p, const ViewItemPaintParams &pp);
+
private:
void paint_grid(QPainter &p, int y, int left, int right);