Qt: only allow double leftclick in screenshot manager

This commit is contained in:
Megamouse 2023-12-04 19:29:03 +01:00
parent 69ef9c8a6a
commit a4011376e0
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ void screenshot_manager_dialog::showEvent(QShowEvent* event)
bool screenshot_manager_dialog::eventFilter(QObject* watched, QEvent* event) bool screenshot_manager_dialog::eventFilter(QObject* watched, QEvent* event)
{ {
if (event && event->type() == QEvent::MouseButtonDblClick) if (event && event->type() == QEvent::MouseButtonDblClick && static_cast<QMouseEvent*>(event)->button() == Qt::LeftButton)
{ {
if (screenshot_item* item = static_cast<screenshot_item*>(watched)) if (screenshot_item* item = static_cast<screenshot_item*>(watched))
{ {

View File

@ -29,7 +29,7 @@ screenshot_preview::screenshot_preview(const QString& filepath, QWidget* parent)
connect(this, &screenshot_preview::customContextMenuRequested, this, &screenshot_preview::show_context_menu); connect(this, &screenshot_preview::customContextMenuRequested, this, &screenshot_preview::show_context_menu);
} }
void screenshot_preview::show_context_menu(const QPoint & pos) void screenshot_preview::show_context_menu(const QPoint& pos)
{ {
QMenu* menu = new QMenu(); QMenu* menu = new QMenu();
menu->addAction(tr("&Copy"), [this]() { QGuiApplication::clipboard()->setImage(m_image); }); menu->addAction(tr("&Copy"), [this]() { QGuiApplication::clipboard()->setImage(m_image); });