fix: 解决bug84933
Description: 增加了快捷键进行缩放 Log: 快捷键进行缩放 Bug: https://pms.uniontech.com/zentao/bug-view-84933.html Change-Id: I81231f31f94acbacf0ded7ccbe3965161d9bb9cf
This commit is contained in:
parent
2036239a4f
commit
558274fd80
|
@ -14,6 +14,7 @@
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
#include <DGuiApplicationHelper>
|
#include <DGuiApplicationHelper>
|
||||||
#include <DMainWindow>
|
#include <DMainWindow>
|
||||||
|
@ -193,6 +194,7 @@ void MainWidget::setupUi(QWidget *Widget)
|
||||||
|
|
||||||
void MainWidget::setupConnect()
|
void MainWidget::setupConnect()
|
||||||
{
|
{
|
||||||
|
initShortcut();
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::paletteTypeChanged, this, &MainWidget::setIcons);
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::paletteTypeChanged, this, &MainWidget::setIcons);
|
||||||
connect(m_exportBtn, &DIconButton::clicked, this, &MainWidget::slotExport);
|
connect(m_exportBtn, &DIconButton::clicked, this, &MainWidget::slotExport);
|
||||||
connect(m_copyBtn, &DIconButton::clicked, this, &MainWidget::slotCopy);
|
connect(m_copyBtn, &DIconButton::clicked, this, &MainWidget::slotCopy);
|
||||||
|
@ -258,6 +260,28 @@ void MainWidget::loadingUi()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::initShortcut()
|
||||||
|
{
|
||||||
|
m_scAddView = new QShortcut(QKeySequence("Ctrl++"), this);
|
||||||
|
m_scAddView->setContext(Qt::WindowShortcut);
|
||||||
|
connect(m_scAddView, &QShortcut::activated, this, [ = ] {
|
||||||
|
if (m_imageview)
|
||||||
|
{
|
||||||
|
m_imageview->setScaleValue(1.1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
m_scReduceView = new QShortcut(QKeySequence("Ctrl+-"), this);
|
||||||
|
m_scReduceView->setContext(Qt::WindowShortcut);
|
||||||
|
connect(m_scReduceView, &QShortcut::activated, this, [ = ] {
|
||||||
|
if (m_imageview)
|
||||||
|
{
|
||||||
|
m_imageview->setScaleValue(0.9);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::openImage(const QString &path)
|
void MainWidget::openImage(const QString &path)
|
||||||
{
|
{
|
||||||
if (m_imageview) {
|
if (m_imageview) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class QGridLayout;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class ImageView;
|
class ImageView;
|
||||||
class loadingWidget;
|
class loadingWidget;
|
||||||
|
class QShortcut;
|
||||||
DWIDGET_USE_NAMESPACE
|
DWIDGET_USE_NAMESPACE
|
||||||
|
|
||||||
class MainWidget : public DWidget
|
class MainWidget : public DWidget
|
||||||
|
@ -39,10 +39,11 @@ public:
|
||||||
void createLoadingUi();
|
void createLoadingUi();
|
||||||
void deleteLoadingUi();
|
void deleteLoadingUi();
|
||||||
void loadingUi();
|
void loadingUi();
|
||||||
|
//初始化快捷键
|
||||||
|
void initShortcut();
|
||||||
|
|
||||||
|
void openImage(const QString &path);
|
||||||
void openImage(const QString &path );
|
void openImage(const QImage &img, const QString &name = "");
|
||||||
void openImage(const QImage &img,const QString & name="");
|
|
||||||
|
|
||||||
void loadHtml(const QString &html);
|
void loadHtml(const QString &html);
|
||||||
void loadString(const QString &string);
|
void loadString(const QString &string);
|
||||||
|
@ -84,6 +85,8 @@ private:
|
||||||
DStackedWidget *m_resultWidget{nullptr};
|
DStackedWidget *m_resultWidget{nullptr};
|
||||||
DLabel *m_noResult{nullptr};
|
DLabel *m_noResult{nullptr};
|
||||||
loadingWidget *m_loadingOcr{nullptr};
|
loadingWidget *m_loadingOcr{nullptr};
|
||||||
|
QShortcut *m_scAddView = nullptr;
|
||||||
|
QShortcut *m_scReduceView = nullptr;
|
||||||
signals:
|
signals:
|
||||||
void sigResult(const QString &);
|
void sigResult(const QString &);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user