Merge branch '0811-dev' into 'dev-unity'

Fix: File name is obscured when it's too long in detail page.

See merge request kylin-desktop/ukui-search!151
This commit is contained in:
PengfeiZhang 2021-09-26 01:25:01 +00:00
commit 2e91cdd9a7
1 changed files with 2 additions and 2 deletions

View File

@ -217,7 +217,7 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path,
m_optionView->show(); m_optionView->show();
QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
QString showname = fontMetrics.elidedText(m_name, Qt::ElideRight, 215); //当字体长度超过215时显示为省略号 QString showname = fontMetrics.elidedText(m_name, Qt::ElideRight, 200); //当字体长度超过200时显示为省略号
// m_nameLabel->setText(showname); // m_nameLabel->setText(showname);
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(showname))); m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(showname)));
if(QString::compare(showname, m_name)) { if(QString::compare(showname, m_name)) {
@ -353,7 +353,7 @@ void SearchDetailView::setupWidget(const int& type, const QString& path) {
setIcon(path); setIcon(path);
QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
QString wholeName = FileUtils::getFileName(path); QString wholeName = FileUtils::getFileName(path);
QString name = fontMetrics.elidedText(wholeName, Qt::ElideRight, 215); QString name = fontMetrics.elidedText(wholeName, Qt::ElideRight, 200);
// m_nameLabel->setText(name); // m_nameLabel->setText(name);
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name))); m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name)));
if(QString::compare(name, wholeName)) { if(QString::compare(name, wholeName)) {