Skip to content

Commit 66a98ee

Browse files
fix: power and bluetooth text cut in russian (#371)
Log:
1 parent d6fb3ea commit 66a98ee

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

plugins/dde-dock/bluetooth/bluetoothitem.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ void BluetoothItem::refreshTips()
189189
}
190190

191191
m_tipsLabel->setText(tipsText);
192+
QFontMetrics metrics(m_tipsLabel->font());
193+
int textWidth = metrics.boundingRect(m_tipsLabel->text()).width();
194+
m_tipsLabel->setMinimumWidth(textWidth);
192195
m_quickPanel->setDescription(description);
193196
}
194197

plugins/dde-dock/power/powerplugin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ void PowerPlugin::loadPlugin()
216216
}
217217
refreshTipsData();
218218
});
219+
219220
connect(m_systemPowerInter, &SystemPowerInter::BatteryTimeToEmptyChanged, this, &PowerPlugin::refreshTipsData);
220221
connect(m_systemPowerInter, &SystemPowerInter::BatteryTimeToFullChanged, this, &PowerPlugin::refreshTipsData);
221222
connect(m_systemPowerInter, &SystemPowerInter::BatteryPercentageChanged, this, &PowerPlugin::refreshTipsData);
@@ -226,6 +227,7 @@ void PowerPlugin::loadPlugin()
226227

227228
onDConfigValueChanged("showTimeToFull");
228229
m_powerStatusWidget->refreshIcon();
230+
229231
}
230232

231233
void PowerPlugin::refreshPluginItemsVisible()
@@ -347,7 +349,10 @@ void PowerPlugin::refreshTipsData()
347349
}
348350
}
349351

350-
m_tipsLabel->setText(tips);
352+
m_tipsLabel->setText(tips);
353+
QFontMetrics metrics(m_tipsLabel->font());
354+
int textWidth = metrics.boundingRect(m_tipsLabel->text()).width();
355+
m_tipsLabel->setMinimumWidth(textWidth);
351356
m_powerStatusWidget->refreshBatteryPercentage(value, appletTips);
352357
}
353358

0 commit comments

Comments
 (0)