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

Method contextMenu

gui/qt/debugger/visualizerdisplaywidget.cpp:117–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void VisualizerDisplayWidget::contextMenu(const QPoint& posa) {
118 QString copyStr = tr("Copy Address");
119 QString coordStr = tr("Coordinate: ");
120
121 QTransform tr;
122 tr.scale(m_width * 1.0 / width(), m_height * 1.0 / height());
123 QPoint point = tr.map(posa);
124 uint32_t x = static_cast<uint32_t>(point.x());
125 uint32_t y = static_cast<uint32_t>(point.y());
126
127 QString addr = int2hex(m_upbase + (static_cast<uint32_t>(std::floor((static_cast<float>(x)) / m_bppstep))) +
128 (static_cast<unsigned int>(m_width) * y), 6);
129
130 coordStr += QString::number(x) + QStringLiteral("x") + QString::number(y);
131 copyStr += QStringLiteral(" '") + addr + QStringLiteral("'");
132
133 QMenu menu;
134 QAction *copy = menu.addAction(copyStr);
135 menu.addSeparator();
136 QAction *coord = menu.addAction(coordStr);
137 coord->setEnabled(false);
138
139 QAction *item = menu.exec(mapToGlobal(posa));
140 if (item == copy) {
141 QClipboard *clipboard = QApplication::clipboard();
142 clipboard->setText(addr.toLatin1());
143 }
144}

Callers

nothing calls this directly

Calls 1

int2hexFunction · 0.85

Tested by

no test coverage detected