Merge branch 'y2209bug' into 'dbus-interface'

Fix bug 141661 网络名称长度最大时,网络详情界面名称显示不全

See merge request kylin-desktop/kylin-nm!718
This commit is contained in:
赵世旭 2022-09-28 01:47:44 +00:00
commit 677b4d5f29
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -37,7 +37,7 @@
#define WINDOW_HEIGHT 602
#define ICON_SIZE 22,22
#define TITLE_LAYOUT_MARGINS 9,9,0,0
#define CENTER_LAYOUT_MARGINS 24,0,24,0
#define CENTER_LAYOUT_MARGINS 24,0,0,0
#define BOTTOM_LAYOUT_MARGINS 24,0,24,0
#define BOTTOM_LAYOUT_SPACING 16
#define PAGE_LAYOUT_SPACING 1