MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / paintEvent

Method paintEvent

gui/qt/debugger/visualizerdisplaywidget.cpp:37–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void VisualizerDisplayWidget::paintEvent(QPaintEvent*) {
38 if (!guiEmuValid) {
39 return;
40 }
41
42 QPainter c(this);
43 const QRect& cw = c.window();
44
45 c.setRenderHint(QPainter::SmoothPixmapTransform, cw.width() < m_width);
46 if (m_image != Q_NULLPTR) {
47 c.drawImage(cw, *m_image);
48
49 // only draw grid if width/height scale >= 200%
50 if (m_grid && (cw.width() >= (m_width * 2) && cw.height() >= (m_height * 2))) {
51 QVarLengthArray<QLineF, 100> lines;
52
53 for (qreal x = cw.left(); x < cw.right(); x += (cw.width() / m_width)) {
54 lines.append(QLineF(x, cw.top(), x, cw.bottom()));
55 }
56 for (qreal y = cw.top(); y < cw.bottom(); y += (cw.height() / m_height)) {
57 lines.append(QLineF(cw.left(), y, cw.right(), y));
58 }
59
60 c.drawLines(lines.data(), lines.size());
61 }
62 }
63}
64
65void VisualizerDisplayWidget::mousePressEvent(QMouseEvent *e) {
66 if (e->button() == Qt::LeftButton) {

Callers

nothing calls this directly

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected