| 241 | } |
| 242 | |
| 243 | void RegisterView::customMenuRequested(QPoint pos) |
| 244 | { |
| 245 | if (!cpu().isAlive()) |
| 246 | return; |
| 247 | |
| 248 | if (m_selectedRow > m_rowEnd) // Unsigned underflow; selectedRow will be > m_rowEnd (technically negative) |
| 249 | return; |
| 250 | |
| 251 | QMenu* menu = new QMenu(this); |
| 252 | menu->setAttribute(Qt::WA_DeleteOnClose); |
| 253 | |
| 254 | const int categoryIndex = ui.registerTabs->currentIndex(); |
| 255 | |
| 256 | if (categoryIndex == EECAT_FPR) |
| 257 | { |
| 258 | QAction* action = menu->addAction(tr("Show as Float")); |
| 259 | action->setCheckable(true); |
| 260 | action->setChecked(m_showFPRFloat); |
| 261 | connect(action, &QAction::triggered, this, [this]() { |
| 262 | m_showFPRFloat = !m_showFPRFloat; |
| 263 | update(); |
| 264 | }); |
| 265 | |
| 266 | menu->addSeparator(); |
| 267 | } |
| 268 | |
| 269 | if (categoryIndex == EECAT_VU0F) |
| 270 | { |
| 271 | QAction* action = menu->addAction(tr("Show as Float")); |
| 272 | action->setCheckable(true); |
| 273 | action->setChecked(m_showVU0FFloat); |
| 274 | connect(action, &QAction::triggered, this, [this]() { |
| 275 | m_showVU0FFloat = !m_showVU0FFloat; |
| 276 | update(); |
| 277 | }); |
| 278 | |
| 279 | menu->addSeparator(); |
| 280 | } |
| 281 | |
| 282 | if (cpu().getRegisterSize(categoryIndex) == 128) |
| 283 | { |
| 284 | connect(menu->addAction(tr("Copy Top Half")), &QAction::triggered, this, &RegisterView::contextCopyTop); |
| 285 | connect(menu->addAction(tr("Copy Bottom Half")), &QAction::triggered, this, &RegisterView::contextCopyBottom); |
| 286 | connect(menu->addAction(tr("Copy Segment")), &QAction::triggered, this, &RegisterView::contextCopySegment); |
| 287 | } |
| 288 | else |
| 289 | { |
| 290 | connect(menu->addAction(tr("Copy Value")), &QAction::triggered, this, &RegisterView::contextCopyValue); |
| 291 | } |
| 292 | |
| 293 | menu->addSeparator(); |
| 294 | |
| 295 | if (cpu().getRegisterSize(categoryIndex) == 128) |
| 296 | { |
| 297 | connect(menu->addAction(tr("Change Top Half")), &QAction::triggered, |
| 298 | this, &RegisterView::contextChangeTop); |
| 299 | connect(menu->addAction(tr("Change Bottom Half")), &QAction::triggered, |
| 300 | this, &RegisterView::contextChangeBottom); |
nothing calls this directly
no test coverage detected