| 385 | } |
| 386 | |
| 387 | void 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 | |
| 409 | void PlotViewWidget::drawAxisTickLabels(QPainter & painter, |
| 410 | const PlotViewWidget::AxisProperties & properties, |