MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / paint

Method paint

src/openms_gui/source/VISUAL/Plot1DCanvas.cpp:618–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616 }
617
618 void Plot1DCanvas::paint(QPainter* painter, QPaintEvent* e)
619 {
620 QElapsedTimer timer;
621 timer.start();
622
623 // clear
624 painter->fillRect(0, 0, this->width(), this->height(),
625 QColor(String(param_.getValue("background_color").toString()).toQString()));
626
627 // we are done if no layer is present
628 if (getLayerCount() == 0)
629 {
630 e->accept();
631 return;
632 }
633
634 // gridlines
635 paintGridLines_(*painter);
636
637 // paint each layer
638 for (Size i = 0; i < getLayerCount(); ++i)
639 {
640 recalculatePercentageFactor_(i);
641 auto paint_1d = getLayer(i).getPainter1D();
642 paint_1d->paint(painter, this, (int)i);
643 }
644
645 if (show_alignment_)
646 {
647 drawAlignment_(*painter);
648 }
649
650 if (mirror_mode_)
651 {
652 painter->save();
653
654 if (!show_alignment_)
655 {
656 // draw x-axis
657 painter->setPen(Qt::black);
658 painter->drawLine(0, height() / 2, width(), height() / 2);
659 }
660 else
661 {
662 // two x-axes:
663 painter->setPen(Qt::black);
664 painter->drawLine(0, height() / 2 + 5, width(), height() / 2 + 5);
665 painter->drawLine(0, height() / 2 - 5, width(), height() / 2 - 5);
666 }
667 painter->restore();
668 }
669
670
671 // draw measuring line when in measure mode and valid measurement start peak selected
672 if (action_mode_ == AM_MEASURE && measurement_start_.isValid())
673 {
674 // use start-point + mouse position of non-gravity axis
675 QPoint measurement_end_point_px = gr_.swap().gravitateTo(measurement_start_point_px_, last_mouse_pos_);

Callers

nothing calls this directly

Calls 15

QColorClass · 0.85
getLayerCountFunction · 0.85
numberFunction · 0.85
getCurrentLayerIndexFunction · 0.85
widthMethod · 0.80
heightMethod · 0.80
gravitateToMethod · 0.80
gravityDiffMethod · 0.80
translateMethod · 0.80
StringClass · 0.50
startMethod · 0.45

Tested by

no test coverage detected