+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.setRenderHint(QPainter::Antialiasing, false);
+
+ p.setPen(QPen(GridMajorColor, 1, Qt::DashLine));
+ for (int i = 1; i <= vdivs_; i++) {
+ const float dy = i * div_height_;
+ p.drawLine(QLineF(left, y - dy, right, y - dy));
+ p.drawLine(QLineF(left, y + dy, right, y + dy));
+ }
+
+ p.setPen(QPen(GridMinorColor, 1, Qt::DashLine));
+ for (int i = 0; i < vdivs_; i++) {
+ const float dy = i * div_height_;
+ const float dy25 = dy + (0.25 * div_height_);
+ const float dy50 = dy + (0.50 * div_height_);
+ const float dy75 = dy + (0.75 * div_height_);
+ p.drawLine(QLineF(left, y - dy25, right, y - dy25));
+ p.drawLine(QLineF(left, y + dy25, right, y + dy25));
+ p.drawLine(QLineF(left, y - dy50, right, y - dy50));
+ p.drawLine(QLineF(left, y + dy50, right, y + dy50));
+ p.drawLine(QLineF(left, y - dy75, right, y - dy75));
+ p.drawLine(QLineF(left, y + dy75, right, y + dy75));
+ }
+
+ p.setRenderHint(QPainter::Antialiasing, true);
+}
+