Fix the incorrectly display of the ToolTip.

This commit is contained in:
baijunjie 2022-02-16 17:12:48 +08:00 committed by iaom
parent 00a349e41b
commit af3ea26b0a
5 changed files with 20 additions and 6 deletions

View File

@ -109,6 +109,8 @@ QWidget *AppSearchPlugin::detailPage(const ResultInfo &ri)
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
} else {
m_nameLabel->setToolTip("");
}
m_pluginLabel->setText(tr("Application"));
if(ri.type == 1) {

View File

@ -94,9 +94,11 @@ QWidget *FileSearchPlugin::detailPage(const ResultInfo &ri)
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 215); //当字体长度超过215时显示为省略号
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
//if(QString::compare(showname, ri.name)) {
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
//}
} else {
m_nameLabel->setToolTip("");
}
m_pluginLabel->setText(tr("File"));
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
@ -292,9 +294,11 @@ QWidget *DirSearchPlugin::detailPage(const ResultInfo &ri)
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 215); //当字体长度超过215时显示为省略号
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
//if(QString::compare(showname, ri.name)) {
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
//}
} else {
m_nameLabel->setToolTip("");
}
m_pluginLabel->setText(tr("directory"));
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
@ -474,9 +478,11 @@ QWidget *FileContengSearchPlugin::detailPage(const ResultInfo &ri)
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 215); //当字体长度超过215时显示为省略号
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
//if(QString::compare(showname, ri.name)) {
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
//}
} else {
m_nameLabel->setToolTip("");
}
m_snippetLabel->setText(getHtmlText(wrapData(m_snippetLabel,ri.description.at(0).value), m_keyWord));
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));

View File

@ -98,6 +98,8 @@ QWidget *MailSearchPlugin::detailPage(const SearchPluginIface::ResultInfo &ri)
m_senderFieldsLabel->setText(FileUtils::escapeHtml(senderName));
if (QString::compare(senderName, ri.description.at(0).value)) {
m_senderFieldsLabel->setToolTip(ri.description.at(0).value);
} else {
m_nameLabel->setToolTip("");
}
m_timeLabel->setText(ri.description.at(1).key);

View File

@ -74,6 +74,8 @@ QWidget *NoteSearchPlugin::detailPage(const SearchPluginIface::ResultInfo &ri)
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
} else {
m_nameLabel->setToolTip("");
}
m_pluginLabel->setText(tr("Application"));
QString showDesc = fontMetrics.elidedText(/*ri.description.at(0).key + " " + */ri.description.at(0).value, Qt::ElideRight, m_descLabel->width() * 2); //当字体长度超过215时显示为省略号

View File

@ -80,6 +80,8 @@ QWidget *SettingsSearchPlugin::detailPage(const ResultInfo &ri)
m_nameLabel->setText(FileUtils::setAllTextBold(showname));
if(QString::compare(showname, ri.name)) {
m_nameLabel->setToolTip(ri.name);
} else {
m_nameLabel->setToolTip("");
}
return m_detailPage;
}