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

Method paintEvent

src/openms_gui/source/VISUAL/HistogramWidget.cpp:170–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168 }
169
170 void HistogramWidget::paintEvent(QPaintEvent * /*e*/)
171 {
172 //histogram from buffer
173 QPainter painter2(this);
174 painter2.drawPixmap(margin_, 0, buffer_);
175
176 //y-axis label
177 painter2.rotate(270);
178 painter2.setPen(Qt::black);
179 QString label = "count";
180 if (log_mode_)
181 {
182 label = "log ( count )";
183 }
184 painter2.drawText(0, 0, -height(), margin_, Qt::AlignHCenter | Qt::AlignVCenter, label);
185 painter2.end();
186
187 //draw splitters
188 if (show_splitters_)
189 {
190 QPainter painter(this);
191 painter.setPen(Qt::black);
192 QFont label_font;
193 label_font.setPointSize(8);
194
195 //cout << "Left splitter: " << left_splitter_<< " dist: " << dist_.minBound() << endl;
196 //cout << "Right splitter: " << right_splitter_<< " dist: " << dist_.maxBound() << endl;
197
198 //left
199 UInt p = UInt(((left_splitter_ - dist_.minBound()) / (dist_.maxBound() - dist_.minBound())) * (width() - 2 * margin_)) + margin_;
200 //cout << "Left splitter position: " << p << endl;
201 painter.drawLine(p, margin_ - 8, p, height() - bottom_axis_->height());
202 painter.drawLine(p, margin_ - 8, p + 5, margin_ - 8);
203 painter.drawLine(p + 5, margin_ - 8, p, margin_ - 3);
204 painter.setFont(label_font);
205 painter.drawText(p, margin_ - 8, "lower boundary");
206 painter.setFont(QFont());
207
208 //right
209 p = UInt(((right_splitter_ - dist_.minBound()) / (dist_.maxBound() - dist_.minBound())) * (width() - 2 * margin_)) + margin_;
210 painter.drawLine(p, margin_ - 8, p, height() - bottom_axis_->height());
211 painter.drawLine(p, margin_ - 8, p - 5, margin_ - 8);
212 painter.drawLine(p - 5, margin_ - 8, p, margin_ - 3);
213 painter.setFont(label_font);
214 painter.drawText(p, margin_ - 8, "upper boundary");
215 painter.setFont(QFont());
216 }
217 }
218
219 void HistogramWidget::resizeEvent(QResizeEvent * /*e*/)
220 {

Callers

nothing calls this directly

Calls 5

drawTextMethod · 0.80
minBoundMethod · 0.80
maxBoundMethod · 0.80
heightMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected