Skip to content

Commit 2905127

Browse files
committed
fix: use dynamic integer range from fcitx5 config properties
Pass IntMax/IntMin properties for Integer type options to QML SpinBox, enable editable input and set fixed width to prevent layout stretching. 将Integer类型选项的IntMax/IntMin属性传递到QML SpinBox,启用可编辑输入并设置固定宽度防止布局拉伸。 Log: SpinBox支持动态整数范围和可编辑输入 PMS: BUG-357563 Influence: Integer类型配置项的SpinBox现在使用fcitx5配置中定义的实际范围,支持手动输入数值。
1 parent 8272d56 commit 2905127

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/dcc-fcitx5configtool/operation/fcitx5configproxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ QVariantList Fcitx5ConfigProxy::globalConfigOptions(const QString &type, bool al
219219
}
220220
++iterator;
221221
}
222+
if (option.type() == "Integer") {
223+
if (properties.contains("IntMax"))
224+
item["intMax"] = properties["IntMax"].toInt();
225+
if (properties.contains("IntMin"))
226+
item["intMin"] = properties["IntMin"].toInt();
227+
}
222228
}
223229
list.append(item);
224230
}

src/dcc-fcitx5configtool/qml/DetailConfigItem.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ DccObject {
112112
Component {
113113
id: integerComponent
114114
D.SpinBox {
115-
width: 55
116-
implicitWidth: 55
115+
editable: true
116+
width: 75
117+
implicitWidth: 75
118+
from: modelData.intMin !== undefined ? modelData.intMin : 0
119+
to: modelData.intMax !== undefined ? modelData.intMax : 9999
117120
value: parseInt(modelData.value)
118121
onValueChanged: {
119122
dccData.fcitx5ConfigProxy.setValue(

0 commit comments

Comments
 (0)