From e969ef30733599982a31c84d2c039a09198d0f60 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Mon, 14 Aug 2023 11:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner2/HGImgThumb.cpp | 6 +++++- app/scanner2/HGImgThumb.h | 1 + app/scanner2/mainwindow.cpp | 6 ++++++ app/scanner2/mainwindow.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/scanner2/HGImgThumb.cpp b/app/scanner2/HGImgThumb.cpp index 434b8230..e2116df5 100644 --- a/app/scanner2/HGImgThumb.cpp +++ b/app/scanner2/HGImgThumb.cpp @@ -2965,7 +2965,7 @@ void HGImgThumb::keyPressEvent(QKeyEvent *e) if (e->key() != Qt::Key_Left && e->key() != Qt::Key_Right && e->key() != Qt::Key_Up && e->key() != Qt::Key_Down && e->key() != Qt::Key_Home && e->key() != Qt::Key_End - && e->key() != Qt::Key_A) + && e->key() != Qt::Key_A && e->key() != Qt::Key_Delete) { return; } @@ -3365,6 +3365,10 @@ void HGImgThumb::keyPressEvent(QKeyEvent *e) } } } + else if (e->key() == Qt::Key_Delete) + { + emit keyDeleteDown(); + } if (-1 != m_curItemIndex) { diff --git a/app/scanner2/HGImgThumb.h b/app/scanner2/HGImgThumb.h index 40bc3984..aaa5b54a 100644 --- a/app/scanner2/HGImgThumb.h +++ b/app/scanner2/HGImgThumb.h @@ -78,6 +78,7 @@ public: void notify_mouse_leave(void); signals: + void keyDeleteDown(); void currItemChanged(int index); void itemDoubleClicked(int index); void itemCountChanged(int count); diff --git a/app/scanner2/mainwindow.cpp b/app/scanner2/mainwindow.cpp index 93df7d2c..99490852 100644 --- a/app/scanner2/mainwindow.cpp +++ b/app/scanner2/mainwindow.cpp @@ -234,6 +234,7 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent) connect(m_view, SIGNAL(mousePos(int, int)), this, SLOT(on_viewerMousePos(int, int))); connect(m_view, SIGNAL(drop(const QObject*, const QStringList &)), this, SLOT(on_viewerDrop(const QObject*, const QStringList &))); connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick())); + connect(m_thumb, SIGNAL(keyDeleteDown()), this, SLOT(on_keyDeleteDown())); connect(m_thumb, SIGNAL(itemCountChanged(int)), this, SLOT(on_itemCountChanged(int))); connect(m_thumb, SIGNAL(itemSelectingChanged()), this, SLOT(on_itemSelectingChanged())); connect(m_thumb, SIGNAL(currItemChanged(int)), this, SLOT(on_currItemChanged(int))); @@ -682,6 +683,11 @@ void MainWindow::on_m_acquireIntoCfg_changed(QString schemeName) dlg.setConfig(selectedCfgName); } +void MainWindow::on_keyDeleteDown() +{ + on_act_deleteFile_triggered(); +} + void MainWindow::on_itemCountChanged(int count) { m_wndStatusBar->setPageInfo(count, m_currIndex); diff --git a/app/scanner2/mainwindow.h b/app/scanner2/mainwindow.h index 3c98190a..d35c68fa 100644 --- a/app/scanner2/mainwindow.h +++ b/app/scanner2/mainwindow.h @@ -100,6 +100,7 @@ private slots: void on_AcquireInto2(); void on_reloadAcquireIntoCfg(); void on_m_acquireIntoCfg_changed(QString schemeName); + void on_keyDeleteDown(); void on_itemCountChanged(int count); void on_itemSelectingChanged(); void on_currItemChanged(int index);