fix: 修复bug85736

Description: 解决ocr提示不清晰问题,换用一种dtk生成pixmap的方法

Log: 解决ocr提示不清晰问题,换用一种dtk生成pixmap的方法
Bug: https://pms.uniontech.com/zentao/bug-view-85736.html
Change-Id: If8e44f8084966f6494c64af1ae83631f77b5416b
This commit is contained in:
liuminghang 2021-08-02 10:22:06 +08:00
parent c4c880a5d1
commit a5ca0e54a4

View File

@ -25,6 +25,7 @@
#include <DFloatingWidget>
#include <DAnchors>
#include <DFontSizeManager>
#include <DHiDPIHelper>
#define App (static_cast<QApplication*>(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));
}