From 8253d34b9504ac00284010ccfdf6ffe419e5050c Mon Sep 17 00:00:00 2001 From: iaom Date: Thu, 17 Nov 2022 11:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AE=B9=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=AF=A6=E6=83=85=E9=A1=B5=E5=8A=A0=E8=BD=BD=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/index/file-search-plugin.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libsearch/index/file-search-plugin.cpp b/libsearch/index/file-search-plugin.cpp index 945ec17..e03d6b9 100644 --- a/libsearch/index/file-search-plugin.cpp +++ b/libsearch/index/file-search-plugin.cpp @@ -6,7 +6,7 @@ #include #define OCR_ICONLABLE_WITH 352 -#define OCR_ICONLABLE_HEIGHT 256 +#define OCR_ICONLABLE_HEIGHT 247 using namespace UkuiSearch; FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent) @@ -476,15 +476,16 @@ QWidget *FileContengSearchPlugin::detailPage(const ResultInfo &ri) { if (1 == ri.type) { QPixmap pixmap; - pixmap.load(ri.actionKey); - if (pixmap.width()/OCR_ICONLABLE_WITH > pixmap.height()/OCR_ICONLABLE_HEIGHT) { - pixmap = pixmap.scaled(OCR_ICONLABLE_WITH, (pixmap.height()*OCR_ICONLABLE_WITH)/pixmap.width(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + if(pixmap.load(ri.actionKey)) { + pixmap = pixmap.scaled(OCR_ICONLABLE_WITH, OCR_ICONLABLE_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation); + m_detailLyt->setContentsMargins(8, (OCR_ICONLABLE_HEIGHT-pixmap.height())/2 + 8, 16, 0); } else { - pixmap = pixmap.scaled((pixmap.width()*OCR_ICONLABLE_HEIGHT)/pixmap.height(), OCR_ICONLABLE_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation); + pixmap = ri.icon.pixmap(120, 120); + m_detailLyt->setContentsMargins(8, 50, 16, 0); } + m_iconLabel->setPixmap(pixmap); m_pluginLabel->setText(tr("OCR")); - m_detailLyt->setContentsMargins(8, (OCR_ICONLABLE_HEIGHT-pixmap.height())/2+8, 16, 0); m_snippetLabel->hide(); } else { m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));