MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / mouseReleaseEvent

Method mouseReleaseEvent

launcher/ui/instanceview/InstanceView.cpp:361–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359}
360
361void InstanceView::mouseReleaseEvent(QMouseEvent* event)
362{
363 executeDelayedItemsLayout();
364
365 QPoint visualPos = event->pos();
366 QPoint geometryPos = event->pos() + offset();
367 QPersistentModelIndex index = indexAt(visualPos);
368
369 VisualGroup::HitResults hitResult;
370
371 if (event->button() == Qt::LeftButton && m_pressedCategory != nullptr && m_pressedCategory == categoryAt(geometryPos, hitResult)) {
372 if (state() == ExpandingState) {
373 m_pressedCategory->collapsed = false;
374 emit groupStateChanged(m_pressedCategory->text, false);
375
376 updateGeometries();
377 viewport()->update();
378 event->accept();
379 m_pressedCategory = nullptr;
380 setState(NoState);
381 return;
382 } else if (state() == CollapsingState) {
383 m_pressedCategory->collapsed = true;
384 emit groupStateChanged(m_pressedCategory->text, true);
385
386 updateGeometries();
387 viewport()->update();
388 event->accept();
389 m_pressedCategory = nullptr;
390 setState(NoState);
391 return;
392 }
393 }
394
395 m_ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
396
397 setState(NoState);
398
399 if (index == m_pressedIndex && index.isValid()) {
400 if (event->button() == Qt::LeftButton) {
401 emit clicked(index);
402 }
403#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
404 QStyleOptionViewItem option;
405 initViewItemOption(&option);
406#else
407 QStyleOptionViewItem option = viewOptions();
408#endif
409 if (m_pressedAlreadySelected) {
410 option.state |= QStyle::State_Selected;
411 }
412 if ((model()->flags(index) & Qt::ItemIsEnabled) &&
413 style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)) {
414 emit activated(index);
415 }
416 }
417}
418

Callers

nothing calls this directly

Calls 5

styleHintMethod · 0.80
updateMethod · 0.45
acceptMethod · 0.45
isValidMethod · 0.45
flagsMethod · 0.45

Tested by

no test coverage detected