From a5ca0e54a4b2748ddd599fd6ef3bf3034667c62a Mon Sep 17 00:00:00 2001 From: liuminghang Date: Mon, 2 Aug 2021 10:22:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbug85736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 解决ocr提示不清晰问题,换用一种dtk生成pixmap的方法 Log: 解决ocr提示不清晰问题,换用一种dtk生成pixmap的方法 Bug: https://pms.uniontech.com/zentao/bug-view-85736.html Change-Id: If8e44f8084966f6494c64af1ae83631f77b5416b --- src/mainwidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index b8caabf..1f7dbac 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #define App (static_cast(QCoreApplication::instance())) MainWidget::MainWidget(QWidget *parent) : @@ -399,6 +400,7 @@ void MainWidget::openImage(const QImage &img, const QString &name) void MainWidget::loadHtml(const QString &html) { if (!html.isEmpty()) { + m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_resultWidget->setCurrentWidget(m_plainTextEdit); m_plainTextEdit->appendHtml(html); } else { @@ -409,6 +411,7 @@ void MainWidget::loadHtml(const QString &html) void MainWidget::loadString(const QString &string) { if (!string.isEmpty()) { + m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_resultWidget->setCurrentWidget(m_plainTextEdit); m_plainTextEdit->appendPlainText(string); //读取完了显示在最上方 @@ -428,6 +431,8 @@ void MainWidget::loadString(const QString &string) void MainWidget::resultEmpty() { + //修复未识别到文字没有居中对齐的问题 + m_frameStackLayout->setContentsMargins(20, 0, 20, 0); m_resultWidget->setCurrentWidget(m_noResult); //新增如果未识别到,按钮置灰 if (m_copyBtn) { @@ -560,11 +565,13 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType) m_frameStack->setPalette(pal); } if (m_tipIconLabel) { - m_tipIconLabel->setPixmap(QPixmap(":/assets/tip_dark.svg")); + QPixmap m_tipImage = DHiDPIHelper::loadNxPixmap(":/assets/tip_dark.svg"); + m_tipIconLabel->setPixmap(m_tipImage); m_tipIconLabel->setFixedSize(QSize(14, 14)); } if (m_copyBtn) { + QPixmap m_shadowImg = DHiDPIHelper::loadNxPixmap(":/mpimage/light/shadow.svg"); m_copyBtn->setIcon(QIcon(":/assets/copy_dark.svg")); m_copyBtn->setIconSize(QSize(36, 36)); } @@ -624,7 +631,9 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType) m_frameStack->setPalette(pal); } if (m_tipIconLabel) { - m_tipIconLabel->setPixmap(QPixmap(":/assets/tip_light.svg")); + QPixmap m_tipImage = DHiDPIHelper::loadNxPixmap(":/assets/tip_light.svg"); + m_tipIconLabel->setPixmap(m_tipImage); +// m_tipIconLabel->setPixmap(QPixmap(":/assets/tip_light.svg")); m_tipIconLabel->setFixedSize(QSize(14, 14)); }