Fix bug 141661

This commit is contained in:
zhangyuanyuan1 2022-09-26 15:34:20 +08:00
parent cd1735ca69
commit 05ab23d156
1 changed files with 4 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#define MAX_NAME_LENGTH 32 #define MAX_NAME_LENGTH 32
#define MAX_LABEL_WIDTH 250 #define MAX_LABEL_WIDTH 250
#define MAX_SSID_WIDTH 133
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
@ -50,10 +51,10 @@ void DetailPage::setSSID(const QString &ssid) {
return; return;
} }
m_formerSSID = ssid; m_formerSSID = ssid;
QFontMetrics fontMetrics(this->font()); QFontMetrics fontMetrics(m_SSIDLabel->font());
int fontSize = fontMetrics.width(ssid); int fontSize = fontMetrics.width(ssid);
if (fontSize > this->width()) { if (fontSize > MAX_SSID_WIDTH) {
this->m_SSIDLabel->setText(fontMetrics.elidedText(ssid, Qt::ElideRight, this->width())); this->m_SSIDLabel->setText(fontMetrics.elidedText(ssid, Qt::ElideRight, MAX_SSID_WIDTH));
this->setToolTip(ssid); this->setToolTip(ssid);
} else { } else {
this->m_SSIDLabel->setText(ssid); this->m_SSIDLabel->setText(ssid);