Skip to content

Commit 0138344

Browse files
wangfeizsien
authored andcommitted
fix: elide text
auto resize with content Issue: linuxdeepin/developer-center#7728
1 parent 5d45377 commit 0138344

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "widgets/settingsgroup.h"
1717
#include "widgets/settingsitem.h"
1818
#include <DLog>
19+
#include <QTranslator>
1920

2021
DWIDGET_USE_NAMESPACE
2122
DCORE_USE_NAMESPACE

src/window/imsettingwindow.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ void IMSettingWindow::initUI()
133133
m_shortcutGroup = new DCC_NAMESPACE::SettingsGroup(nullptr, DCC_NAMESPACE::SettingsGroup::GroupBackground);
134134
m_imSwitchCbox = new DCC_NAMESPACE::ComboxWidget(tr("Scroll between input methods"));
135135
m_imSwitchCbox->setComboxOption({ "NONE", "CTRL_SHIFT", "ALT_SHIFT", "CTRL_SUPER", "ALT_SUPER" });
136+
for (auto child : m_imSwitchCbox->children()) {
137+
if (auto label = qobject_cast<QLabel *>(child)) {
138+
QFontMetrics fm(label->font());
139+
int pixelsWide = fm.horizontalAdvance(tr("Scroll between input methods"));
140+
label->setMinimumWidth(pixelsWide);
141+
break;
142+
}
143+
}
136144
m_imSwitchCbox->comboBox()->setAccessibleName("Switch input methods");
137145
m_defaultIMKey = new FcitxKeySettingsItem(tr("Switch between the current/first input method"));
138146
m_shortcutGroup->appendItem(m_imSwitchCbox);

0 commit comments

Comments
 (0)