MCPcopy Create free account
hub / github.com/IENT/YUView / drawAxisTicks

Method drawAxisTicks

YUViewLib/src/ui/views/PlotViewWidget.cpp:387–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void PlotViewWidget::drawAxisTicks(QPainter & painter,
388 const PlotViewWidget::AxisProperties & properties,
389 const QList<PlotViewWidget::TickValue> &ticks) const
390{
391 if (ticks.isEmpty() || this->model == nullptr)
392 return;
393
394 const auto tickLine =
395 (properties.axis == Axis::X) ? QPointF(0, tickLength) : QPointF(-tickLength, 0);
396
397 painter.setPen(QPen(Qt::black, 1));
398 for (auto tick : ticks)
399 {
400 QPointF p = properties.line.p1();
401 if (properties.axis == Axis::X)
402 p.setX(tick.pixelPosInWidget);
403 else
404 p.setY(tick.pixelPosInWidget);
405 painter.drawLine(p, p + tickLine);
406 }
407}
408
409void PlotViewWidget::drawAxisTickLabels(QPainter & painter,
410 const PlotViewWidget::AxisProperties & properties,

Callers 1

paintEventMethod · 0.95

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected