mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-29 13:20:18 +02:00
Merge pull request #1821 from TheKodeToad/group-click-fix
Only open/close groups on left button
This commit is contained in:
commit
913d81e371
@ -278,12 +278,14 @@ void InstanceView::mousePressEvent(QMouseEvent* event)
|
|||||||
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
|
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
|
||||||
m_pressedPosition = geometryPos;
|
m_pressedPosition = geometryPos;
|
||||||
|
|
||||||
VisualGroup::HitResults hitResult;
|
if (event->button() == Qt::LeftButton) {
|
||||||
m_pressedCategory = categoryAt(geometryPos, hitResult);
|
VisualGroup::HitResults hitResult;
|
||||||
if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
|
m_pressedCategory = categoryAt(geometryPos, hitResult);
|
||||||
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
|
if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
|
||||||
event->accept();
|
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
|
||||||
return;
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) {
|
if (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) {
|
||||||
@ -366,10 +368,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
VisualGroup::HitResults hitResult;
|
VisualGroup::HitResults hitResult;
|
||||||
|
|
||||||
bool click =
|
if (event->button() == Qt::LeftButton && m_pressedCategory != nullptr && m_pressedCategory == categoryAt(geometryPos, hitResult)) {
|
||||||
(index == m_pressedIndex && index.isValid()) || (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitResult));
|
|
||||||
|
|
||||||
if (click && m_pressedCategory) {
|
|
||||||
if (state() == ExpandingState) {
|
if (state() == ExpandingState) {
|
||||||
m_pressedCategory->collapsed = false;
|
m_pressedCategory->collapsed = false;
|
||||||
emit groupStateChanged(m_pressedCategory->text, false);
|
emit groupStateChanged(m_pressedCategory->text, false);
|
||||||
@ -397,7 +396,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
setState(NoState);
|
setState(NoState);
|
||||||
|
|
||||||
if (click) {
|
if (index == m_pressedIndex && index.isValid()) {
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
emit clicked(index);
|
emit clicked(index);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user