mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-09-17 16:05:42 -04:00
Implement middle click
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
9f768f76bb
commit
5832fb8b95
@ -81,6 +81,7 @@ ResourcePage::ResourcePage(ResourceDownloadDialog* parent, BaseInstance& base_in
|
|||||||
auto delegate = new ProjectItemDelegate(this);
|
auto delegate = new ProjectItemDelegate(this);
|
||||||
m_ui->packView->setItemDelegate(delegate);
|
m_ui->packView->setItemDelegate(delegate);
|
||||||
m_ui->packView->installEventFilter(this);
|
m_ui->packView->installEventFilter(this);
|
||||||
|
m_ui->packView->viewport()->installEventFilter(this);
|
||||||
|
|
||||||
connect(m_ui->packDescription, &QTextBrowser::anchorClicked, this, &ResourcePage::openUrl);
|
connect(m_ui->packDescription, &QTextBrowser::anchorClicked, this, &ResourcePage::openUrl);
|
||||||
|
|
||||||
@ -139,6 +140,13 @@ auto ResourcePage::eventFilter(QObject* watched, QEvent* event) -> bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (watched == m_ui->packView->viewport() && event->type() == QEvent::MouseButtonPress) {
|
||||||
|
auto* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
|
|
||||||
|
if (mouseEvent->button() == Qt::MiddleButton) {
|
||||||
|
onResourceToggle(m_ui->packView->indexAt(mouseEvent->pos()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QWidget::eventFilter(watched, event);
|
return QWidget::eventFilter(watched, event);
|
||||||
|
@ -142,6 +142,9 @@ bool ProjectItemDelegate::editorEvent(QEvent* event,
|
|||||||
|
|
||||||
auto mouseEvent = (QMouseEvent*)event;
|
auto mouseEvent = (QMouseEvent*)event;
|
||||||
|
|
||||||
|
if (mouseEvent->button() != Qt::LeftButton)
|
||||||
|
return false;
|
||||||
|
|
||||||
QStyleOptionViewItem opt(option);
|
QStyleOptionViewItem opt(option);
|
||||||
initStyleOption(&opt, index);
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user