MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / onDoubleClicked

Method onDoubleClicked

src/pluginlistview.cpp:262–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void PluginListView::onDoubleClicked(const QModelIndex& index)
263{
264 if (!index.isValid()) {
265 return;
266 }
267
268 if (m_core->pluginList()->timeElapsedSinceLastChecked() <=
269 QApplication::doubleClickInterval()) {
270 // don't interpret double click if we only just checked a plugin
271 return;
272 }
273
274 try {
275 if (selectionModel()->hasSelection() &&
276 selectionModel()->selectedRows().count() == 1) {
277
278 QModelIndex idx = selectionModel()->currentIndex();
279 QString fileName = idx.data().toString();
280
281 if (ModInfo::getIndex(m_core->pluginList()->origin(fileName)) == UINT_MAX) {
282 return;
283 }
284
285 auto modIndex = ModInfo::getIndex(m_core->pluginList()->origin(fileName));
286 ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex);
287
288 if (modInfo->isRegular() || modInfo->isOverwrite()) {
289
290 Qt::KeyboardModifiers modifiers = QApplication::queryKeyboardModifiers();
291 if (modifiers.testFlag(Qt::ControlModifier)) {
292 m_modActions->openExplorer({m_core->modList()->index(modIndex, 0)});
293 } else {
294 m_modActions->displayModInformation(
295 ModInfo::getIndex(m_core->pluginList()->origin(fileName)));
296 }
297
298 // workaround to cancel the editor that might have opened because of
299 // selection-click
300 closePersistentEditor(index);
301 }
302 }
303 } catch (const std::exception& e) {
304 reportError(e.what());
305 }
306}
307
308bool PluginListView::moveSelection(int key)
309{

Callers

nothing calls this directly

Calls 14

countMethod · 0.80
openExplorerMethod · 0.80
isValidMethod · 0.45
pluginListMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
originMethod · 0.45
isRegularMethod · 0.45
isOverwriteMethod · 0.45
indexMethod · 0.45
modListMethod · 0.45

Tested by

no test coverage detected