69 QLabel::paintEvent(event);
70 QPainter painter(
this);
71 painter.fillRect(0, 0, this->width(), this->height(), this->
palette().dark().color());
72 painter.setPen(this->
palette().light().color());
75 for (
int i = 0; i <= NGRID; ++i) {
76 painter.drawLine(this->width()*i / NGRID, 0., this->width()*i / NGRID, this->height());
77 painter.drawLine(0., this->height()*i / NGRID, this->width(), this->height()*i / NGRID);
82 unsigned int highest = 0;
84 for (
int chan = 0; chan < channels.size(); chan++) {
88 int nthPercentile = 2 * histogramTemp.size() / 100;
90 std::nth_element(histogramTemp.begin(),
91 histogramTemp.begin() + nthPercentile, histogramTemp.end(), std::greater<int>());
92 unsigned int max = *(histogramTemp.begin() + nthPercentile);
94 highest = std::max(max, highest);
98 painter.setWindow(QRect(-1, 0, nBins + 1, highest));
99 painter.setCompositionMode(QPainter::CompositionMode_Plus);
101 for (
int chan = 0; chan < (int)nChannels; chan++) {
103 QColor color = channels.at(chan)->color();
107 color = QColor(Qt::gray);
110 QColor fill_color = color;
111 fill_color.setAlphaF(.25);
112 painter.setBrush(fill_color);
113 QPen pen = QPen(color);
119 path.moveTo(QPointF(-1, highest));
120 for (qint32 i = 0; i < nBins; ++i) {
122 path.lineTo(QPointF(i,
v));
125 path.lineTo(QPointF(nBins + 1, highest));
127 painter.drawPath(path);
131 for (qint32 i = 0; i < nBins; ++i) {
133 painter.drawLine(QPointF(i, highest), QPointF(i,
v));