| 332 | } |
| 333 | |
| 334 | bool PluginListView::event(QEvent* event) |
| 335 | { |
| 336 | if (event->type() == QEvent::KeyPress) { |
| 337 | QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); |
| 338 | |
| 339 | if (keyEvent->modifiers() == Qt::ControlModifier && |
| 340 | (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)) { |
| 341 | if (selectionModel()->hasSelection() && |
| 342 | selectionModel()->selectedRows().count() == 1) { |
| 343 | QModelIndex idx = selectionModel()->currentIndex(); |
| 344 | QString fileName = idx.data().toString(); |
| 345 | |
| 346 | if (ModInfo::getIndex(m_core->pluginList()->origin(fileName)) == UINT_MAX) { |
| 347 | return false; |
| 348 | } |
| 349 | |
| 350 | auto modIndex = ModInfo::getIndex(m_core->pluginList()->origin(fileName)); |
| 351 | m_modActions->openExplorer({m_core->modList()->index(modIndex, 0)}); |
| 352 | return true; |
| 353 | } |
| 354 | } else if (keyEvent->modifiers() == Qt::ControlModifier && |
| 355 | (sortColumn() == PluginList::COL_PRIORITY || |
| 356 | sortColumn() == PluginList::COL_MODINDEX) && |
| 357 | (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) { |
| 358 | return moveSelection(keyEvent->key()); |
| 359 | } else if (keyEvent->key() == Qt::Key_Space) { |
| 360 | return toggleSelectionState(); |
| 361 | } |
| 362 | return QTreeView::event(event); |
| 363 | } |
| 364 | return QTreeView::event(event); |
| 365 | } |
nothing calls this directly
no test coverage detected