fix(app-search-plugin):修复在线应用右侧被遮挡的问题,优化在线应用描述界面ui

This commit is contained in:
JunjieBai 2023-10-30 16:10:47 +08:00
parent 4e7e2e3a8a
commit ee1af87ccd
7 changed files with 27 additions and 32 deletions

View File

@ -159,11 +159,11 @@ QWidget *AppSearchPlugin::detailPage(const ResultInfo &ri)
// QString showDesc = fontMetrics.elidedText(ri.description.at(0).key + " " + ri.description.at(0).value, Qt::ElideRight, 3114); //当字体长度超过215时显示为省略号 // QString showDesc = fontMetrics.elidedText(ri.description.at(0).key + " " + ri.description.at(0).value, Qt::ElideRight, 3114); //当字体长度超过215时显示为省略号
QString showDesc = FileUtils::getSnippetWithoutKeyword(ri.description.at(0).key + " " + ri.description.at(0).value, 10); QString showDesc = FileUtils::getSnippetWithoutKeyword(ri.description.at(0).key + " " + ri.description.at(0).value, 10);
m_descLabel->setText(FileUtils::escapeHtml(showDesc)); m_descLabel->setText(FileUtils::escapeHtml(showDesc));
m_descFrame->show(); m_descLabel->show();
m_line_2->show(); m_line_2->show();
} else { } else {
m_descFrame->hide(); m_descLabel->hide();
m_line_2->hide(); m_line_2->hide();
m_actionLabel1->show(); m_actionLabel1->show();
m_actionLabel2->show(); m_actionLabel2->show();
@ -232,14 +232,11 @@ void AppSearchPlugin::initDetailPage()
m_nameFrameLyt->addWidget(m_pluginLabel); m_nameFrameLyt->addWidget(m_pluginLabel);
m_line_1 = new SeparationLine(m_detailPage); m_line_1 = new SeparationLine(m_detailPage);
m_descFrame = new QFrame(m_detailPage);
m_descFrameLyt = new QVBoxLayout(m_descFrame); m_descLabel = new QLabel(m_detailPage);
m_descLabel = new QLabel(m_descFrame);
m_descLabel->setTextFormat(Qt::PlainText); m_descLabel->setTextFormat(Qt::PlainText);
m_descLabel->setContentsMargins(8, 0, 8, 0);
// m_descLabel->setWordWrap(true); // m_descLabel->setWordWrap(true);
m_descFrameLyt->addWidget(m_descLabel);
m_descFrame->setLayout(m_descFrameLyt);
m_descFrameLyt->setContentsMargins(8, 0, 0, 0);
m_line_2 = new SeparationLine(m_detailPage); m_line_2 = new SeparationLine(m_detailPage);
m_actionFrame = new QFrame(m_detailPage); m_actionFrame = new QFrame(m_detailPage);
@ -260,7 +257,7 @@ void AppSearchPlugin::initDetailPage()
m_detailLyt->addWidget(m_iconLabel); m_detailLyt->addWidget(m_iconLabel);
m_detailLyt->addWidget(m_nameFrame); m_detailLyt->addWidget(m_nameFrame);
m_detailLyt->addWidget(m_line_1); m_detailLyt->addWidget(m_line_1);
m_detailLyt->addWidget(m_descFrame); m_detailLyt->addWidget(m_descLabel);
m_detailLyt->addWidget(m_line_2); m_detailLyt->addWidget(m_line_2);
m_detailLyt->addWidget(m_actionFrame); m_detailLyt->addWidget(m_actionFrame);
m_detailPage->setLayout(m_detailLyt); m_detailPage->setLayout(m_detailLyt);

View File

@ -84,9 +84,7 @@ private:
QLabel *m_nameLabel = nullptr; QLabel *m_nameLabel = nullptr;
QLabel *m_pluginLabel = nullptr; QLabel *m_pluginLabel = nullptr;
SeparationLine *m_line_1 = nullptr; SeparationLine *m_line_1 = nullptr;
QFrame *m_descFrame = nullptr;
QLabel *m_descLabel = nullptr; QLabel *m_descLabel = nullptr;
QVBoxLayout *m_descFrameLyt = nullptr;
SeparationLine *m_line_2 = nullptr; SeparationLine *m_line_2 = nullptr;
QFrame *m_actionFrame = nullptr; QFrame *m_actionFrame = nullptr;
QVBoxLayout *m_actionFrameLyt = nullptr; QVBoxLayout *m_actionFrameLyt = nullptr;

View File

@ -1390,7 +1390,7 @@ QString FileUtils::getSnippetWithoutKeyword(const QString &content, int lineCoun
} }
QString word = content.mid(boundaryStart, boundaryEnd - boundaryStart); QString word = content.mid(boundaryStart, boundaryEnd - boundaryStart);
wordCount += boundaryEnd - boundaryStart; wordCount += boundaryEnd - boundaryStart;
length = fontMetricsF.horizontalAdvance(content.mid(boundaryStart - wordCount, wordCount)); length = fontMetricsF.horizontalAdvance(content.mid(boundaryEnd - wordCount, wordCount));
if (length >= LABEL_MAX_WIDTH || word == "\n") { if (length >= LABEL_MAX_WIDTH || word == "\n") {
if (word == "\n") { if (word == "\n") {

View File

@ -25,30 +25,30 @@
<name>UkuiSearch::AppSearchPlugin</name> <name>UkuiSearch::AppSearchPlugin</name>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="245"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="246"/>
<source>Add Shortcut to Desktop</source> <source>Add Shortcut to Desktop</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="249"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/>
<source>Add Shortcut to Panel</source> <source>Add Shortcut to Panel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="250"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/>
<source>Install</source> <source>Install</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="195"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="196"/>
<source>Application Description:</source> <source>Application Description:</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -32,25 +32,25 @@
<name>UkuiSearch::AppSearchPlugin</name> <name>UkuiSearch::AppSearchPlugin</name>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="245"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="246"/>
<source>Add Shortcut to Desktop</source> <source>Add Shortcut to Desktop</source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="249"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/>
<source>Add Shortcut to Panel</source> <source>Add Shortcut to Panel</source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="250"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/>
<source>Install</source> <source>Install</source>
<translation></translation> <translation></translation>
</message> </message>
@ -66,7 +66,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="195"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="196"/>
<source>Application Description:</source> <source>Application Description:</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -32,25 +32,25 @@
<name>UkuiSearch::AppSearchPlugin</name> <name>UkuiSearch::AppSearchPlugin</name>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="245"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="246"/>
<source>Add Shortcut to Desktop</source> <source>Add Shortcut to Desktop</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="249"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/>
<source>Add Shortcut to Panel</source> <source>Add Shortcut to Panel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="250"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/>
<source>Install</source> <source>Install</source>
<translation></translation> <translation></translation>
</message> </message>
@ -66,7 +66,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="195"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="196"/>
<source>Application Description:</source> <source>Application Description:</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -18,25 +18,25 @@
<name>UkuiSearch::AppSearchPlugin</name> <name>UkuiSearch::AppSearchPlugin</name>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="245"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="31"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="246"/>
<source>Add Shortcut to Desktop</source> <source>Add Shortcut to Desktop</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="32"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="249"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="247"/>
<source>Add Shortcut to Panel</source> <source>Add Shortcut to Panel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="250"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="248"/>
<source>Install</source> <source>Install</source>
<translation></translation> <translation></translation>
</message> </message>
@ -52,7 +52,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="195"/> <location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="196"/>
<source>Application Description:</source> <source>Application Description:</source>
<translation></translation> <translation></translation>
</message> </message>