Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only open/close groups using primary mouse button #1821

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions launcher/ui/instanceview/InstanceView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,14 @@ void InstanceView::mousePressEvent(QMouseEvent* event)
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
m_pressedPosition = geometryPos;

VisualGroup::HitResults hitResult;
m_pressedCategory = categoryAt(geometryPos, hitResult);
if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
event->accept();
return;
if (event->button() == Qt::LeftButton) {
VisualGroup::HitResults hitResult;
m_pressedCategory = categoryAt(geometryPos, hitResult);
if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
event->accept();
return;
}
}

if (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) {
Expand Down Expand Up @@ -366,10 +368,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)

VisualGroup::HitResults hitResult;

bool click =
(index == m_pressedIndex && index.isValid()) || (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitResult));

if (click && m_pressedCategory) {
if (event->button() == Qt::LeftButton && m_pressedCategory != nullptr && m_pressedCategory == categoryAt(geometryPos, hitResult)) {
if (state() == ExpandingState) {
m_pressedCategory->collapsed = false;
emit groupStateChanged(m_pressedCategory->text, false);
Expand Down Expand Up @@ -397,7 +396,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)

setState(NoState);

if (click) {
if (index == m_pressedIndex && index.isValid()) {
if (event->button() == Qt::LeftButton) {
emit clicked(index);
}
Expand Down