fix(ntextinput): use onTextChanged for autosave, onEditingFinished instead of onAccepted

- Switch most settings from onEditingFinished to onTextChanged so
changes save on every keystroke
- Replace onAccepted with onEditingFinished (Enter + blur) for search,
pager, wifi, bluetooth
- Keep onEditingFinished for pager, wallhaven, path inputs, and
validation fields
This commit is contained in:
Lysec
2026-03-18 17:50:46 +01:00
parent 0756e9f56c
commit 9f8bf988f0
23 changed files with 76 additions and 62 deletions
@@ -110,7 +110,7 @@ ColumnLayout {
description: I18n.tr("bar.media-mini.max-width-description")
placeholderText: widgetMetadata.maxWidth
text: valueMaxWidth
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.maxWidth)
}
@@ -34,7 +34,7 @@ ColumnLayout {
description: I18n.tr("bar.audio-visualizer.width-description")
text: widgetData.width || widgetMetadata.width
placeholderText: I18n.tr("placeholders.enter-width-pixels")
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.width)
}
@@ -140,8 +140,10 @@ ColumnLayout {
description: I18n.tr("bar.clock.horizontal-bar-description")
placeholderText: "HH:mm ddd, MMM dd"
text: valueFormatHorizontal
onTextChanged: valueFormatHorizontal = text
onEditingFinished: saveSettings()
onTextChanged: {
valueFormatHorizontal = text
saveSettings()
}
Component.onCompleted: {
if (inputItem) {
inputItem.onActiveFocusChanged.connect(function () {
@@ -166,8 +168,10 @@ ColumnLayout {
// Tokens are Qt format tokens and must not be localized
placeholderText: "HH mm dd MM"
text: valueFormatVertical
onTextChanged: valueFormatVertical = text
onEditingFinished: saveSettings()
onTextChanged: {
valueFormatVertical = text
saveSettings()
}
Component.onCompleted: {
if (inputItem) {
inputItem.onActiveFocusChanged.connect(function () {
@@ -187,8 +191,10 @@ ColumnLayout {
description: I18n.tr("bar.clock.tooltip-format-description")
placeholderText: "HH:mm, ddd MMM dd"
text: valueTooltipFormat
onTextChanged: valueTooltipFormat = text
onEditingFinished: saveSettings()
onTextChanged: {
valueTooltipFormat = text
saveSettings()
}
Component.onCompleted: {
if (inputItem) {
inputItem.onActiveFocusChanged.connect(function () {
@@ -139,8 +139,10 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.general-tooltip-text-description")
placeholderText: I18n.tr("placeholders.enter-tooltip")
text: valueGeneralTooltipText
onTextChanged: valueGeneralTooltipText = text
onEditingFinished: saveSettings()
onTextChanged: {
valueGeneralTooltipText = text
saveSettings()
}
defaultValue: widgetMetadata.generalTooltipText
}
@@ -174,8 +176,10 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.ipc-identifier-description")
placeholderText: I18n.tr("placeholders.enter-ipc-identifier")
text: valueIpcIdentifier
onTextChanged: valueIpcIdentifier = text
onEditingFinished: saveSettings()
onTextChanged: {
valueIpcIdentifier = text
saveSettings()
}
defaultValue: widgetMetadata.ipcIdentifier
}
@@ -189,7 +193,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.left-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData?.leftClickExec || widgetMetadata.leftClickExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.leftClickExec
}
@@ -219,7 +223,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.right-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData?.rightClickExec || widgetMetadata.rightClickExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.rightClickExec
}
@@ -249,7 +253,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.middle-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData.middleClickExec || widgetMetadata.middleClickExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.middleClickExec
}
@@ -299,7 +303,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.wheel-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData?.wheelExec || widgetMetadata?.wheelExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.wheelExec
}
@@ -334,7 +338,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.wheel-up-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData?.wheelUpExec || widgetMetadata?.wheelUpExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.wheelUpExec
}
@@ -364,7 +368,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.wheel-down-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: widgetData?.wheelDownExec || widgetMetadata?.wheelDownExec
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.wheelDownExec
}
@@ -451,7 +455,7 @@ ColumnLayout {
description: valueTextStream ? I18n.tr("bar.custom-button.display-command-output-stream-description") : I18n.tr("bar.custom-button.display-command-output-description")
placeholderText: I18n.tr("placeholders.command-example")
text: widgetData?.textCommand || widgetMetadata.textCommand
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.textCommand
}
@@ -463,7 +467,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.collapse-condition-description")
placeholderText: I18n.tr("placeholders.enter-text-to-collapse")
text: widgetData?.textCollapse || widgetMetadata.textCollapse
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: widgetMetadata.textCollapse
}
@@ -475,7 +479,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.refresh-interval-description")
placeholderText: String(widgetMetadata.textIntervalMs)
text: widgetData && widgetData.textIntervalMs !== undefined ? String(widgetData.textIntervalMs) : ""
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.textIntervalMs)
}
@@ -152,7 +152,7 @@ ColumnLayout {
description: I18n.tr("bar.media-mini.max-width-description")
placeholderText: widgetMetadata.maxWidth
text: valueMaxWidth
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.maxWidth)
}
@@ -81,8 +81,10 @@ ColumnLayout {
description: I18n.tr("panels.audio.on-middle-clicked-description")
placeholderText: I18n.tr("panels.audio.external-mixer-placeholder")
text: valueMiddleClickCommand
onTextChanged: valueMiddleClickCommand = text
onEditingFinished: saveSettings()
onTextChanged: {
valueMiddleClickCommand = text
saveSettings()
}
defaultValue: widgetMetadata.middleClickCommand
}
}
@@ -28,7 +28,7 @@ ColumnLayout {
description: I18n.tr("bar.spacer.width-description")
text: widgetData.width || widgetMetadata.width
placeholderText: I18n.tr("placeholders.enter-width-pixels")
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.width)
}
}
@@ -164,7 +164,7 @@ ColumnLayout {
description: I18n.tr("bar.taskbar.title-width-description")
text: widgetData.titleWidth || widgetMetadata.titleWidth
placeholderText: I18n.tr("placeholders.enter-width-pixels")
onEditingFinished: saveSettings()
onTextChanged: saveSettings()
defaultValue: String(widgetMetadata.titleWidth)
}
@@ -81,8 +81,10 @@ ColumnLayout {
description: I18n.tr("panels.audio.on-middle-clicked-description")
placeholderText: I18n.tr("panels.audio.external-mixer-placeholder")
text: valueMiddleClickCommand
onTextChanged: valueMiddleClickCommand = text
onEditingFinished: saveSettings()
onTextChanged: {
valueMiddleClickCommand = text
saveSettings()
}
defaultValue: widgetMetadata.middleClickCommand
}
}
@@ -139,7 +139,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.general-tooltip-text-description")
placeholderText: I18n.tr("placeholders.enter-tooltip")
text: _settings.generalTooltipText
onEditingFinished: {
onTextChanged: {
_settings.generalTooltipText = text;
saveSettings();
}
@@ -164,7 +164,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.left-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onClicked
onEditingFinished: {
onTextChanged: {
_settings.onClicked = text;
saveSettings();
}
@@ -177,7 +177,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.right-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onRightClicked
onEditingFinished: {
onTextChanged: {
_settings.onRightClicked = text;
saveSettings();
}
@@ -190,7 +190,7 @@ ColumnLayout {
description: I18n.tr("bar.custom-button.middle-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onMiddleClicked
onEditingFinished: {
onTextChanged: {
_settings.onMiddleClicked = text;
saveSettings();
}
@@ -238,7 +238,7 @@ ColumnLayout {
Layout.fillWidth: true
placeholderText: I18n.tr("panels.control-center.shortcuts-custom-button-state-checks-command")
text: model.command
onEditingFinished: {
onTextChanged: {
updateStateCheck(currentIndex, text, model.icon);
}
}
@@ -174,8 +174,10 @@ ColumnLayout {
description: I18n.tr("bar.clock.horizontal-bar-description")
placeholderText: "HH:mm\\nd MMMM yyyy"
text: valueFormat
onTextChanged: valueFormat = text
onEditingFinished: settingsChanged(saveSettings())
onTextChanged: {
valueFormat = text
settingsChanged(saveSettings())
}
Component.onCompleted: {
if (inputItem) {
inputItem.onActiveFocusChanged.connect(function () {
+1 -1
View File
@@ -860,7 +860,7 @@ Item {
}
onTextChanged: root.searchText = text
onAccepted: {
onEditingFinished: {
if (root.searchText.trim() !== "")
root.searchActivate();
}
@@ -103,7 +103,7 @@ ColumnLayout {
text: Settings.data.audio.volumeFeedbackSoundFile ?? ""
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
onInputEditingFinished: Settings.data.audio.volumeFeedbackSoundFile = text
onInputTextChanged: text => Settings.data.audio.volumeFeedbackSoundFile = text
onButtonClicked: volumeFeedbackFilePicker.open()
}
}
@@ -754,7 +754,7 @@ Item {
inputItem.forceActiveFocus();
}
}
inputItem.onAccepted: {
inputItem.onEditingFinished: {
if (text.length > 0) {
BluetoothService.submitPin(text);
text = "";
@@ -448,7 +448,7 @@ Item {
label: I18n.tr("wifi.panel.network-name-ssid")
text: addNetworkPopup.customSsid
onTextChanged: addNetworkPopup.customSsid = text
onAccepted: {
onEditingFinished: {
if (addNetworkPopup.customSsid.length > 0 && (addNetworkPopup.customSecurityKey === "open" || addNetworkPopup.customPassword.length > 0)) {
NetworkService.connectManual(addNetworkPopup.customSsid, addNetworkPopup.customPassword, addNetworkPopup.customSecurityKey, addNetworkPopup.customIdentity, {
eap: addNetworkPopup.customEnterpriseEap,
@@ -572,7 +572,7 @@ Item {
text: addNetworkPopup.customPassword
onTextChanged: addNetworkPopup.customPassword = text
inputItem.echoMode: addNetworkPopup.customShowPassword ? TextInput.Normal : TextInput.Password
onAccepted: {
onEditingFinished: {
if (addNetworkPopup.customSsid.length > 0 && addNetworkPopup.customPassword.length > 0) {
NetworkService.connectManual(addNetworkPopup.customSsid, addNetworkPopup.customPassword, addNetworkPopup.customSecurityKey, addNetworkPopup.customIdentity, {
eap: addNetworkPopup.customEnterpriseEap,
@@ -1278,7 +1278,7 @@ Item {
selectByMouse: true
text: root.enterpriseAnonIdentity
onTextChanged: root.enterpriseAnonIdentity = text
onAccepted: identityInput.forceActiveFocus()
onEditingFinished: identityInput.forceActiveFocus()
NText {
visible: parent.text.length === 0
@@ -1315,7 +1315,7 @@ Item {
forceActiveFocus();
}
}
onAccepted: pwdInput.forceActiveFocus()
onEditingFinished: pwdInput.forceActiveFocus()
NText {
visible: parent.text.length === 0
@@ -1353,7 +1353,7 @@ Item {
forceActiveFocus();
}
}
onAccepted: {
onEditingFinished: {
if (text && !NetworkService.connecting) {
if (!networkItem.isEnterprise || identityInput.text.length > 0) {
root.submitPassword(modelData.ssid, text, identityInput.text);
@@ -42,7 +42,7 @@ ColumnLayout {
placeholderText: '~/.face' // don't translate path
buttonIcon: "photo"
buttonTooltip: I18n.tr("panels.general.profile-tooltip")
onInputEditingFinished: Settings.data.general.avatarImage = text
onInputTextChanged: text => Settings.data.general.avatarImage = text
onButtonClicked: {
avatarPicker.openFilePicker();
}
@@ -73,7 +73,7 @@ ColumnLayout {
description: I18n.tr("panels.launcher.settings-clipboard-watch-text-description")
Layout.fillWidth: true
text: Settings.data.appLauncher.clipboardWatchTextCommand
onEditingFinished: Settings.data.appLauncher.clipboardWatchTextCommand = text
onTextChanged: Settings.data.appLauncher.clipboardWatchTextCommand = text
enabled: Settings.data.appLauncher.enableClipboardHistory
visible: Settings.data.appLauncher.enableClipboardHistory
}
@@ -83,7 +83,7 @@ ColumnLayout {
description: I18n.tr("panels.launcher.settings-clipboard-watch-image-description")
Layout.fillWidth: true
text: Settings.data.appLauncher.clipboardWatchImageCommand
onEditingFinished: Settings.data.appLauncher.clipboardWatchImageCommand = text
onTextChanged: Settings.data.appLauncher.clipboardWatchImageCommand = text
enabled: Settings.data.appLauncher.enableClipboardHistory
visible: Settings.data.appLauncher.enableClipboardHistory
}
@@ -15,7 +15,7 @@ ColumnLayout {
description: I18n.tr("panels.launcher.settings-terminal-command-description")
Layout.fillWidth: true
text: Settings.data.appLauncher.terminalCommand
onEditingFinished: {
onTextChanged: {
Settings.data.appLauncher.terminalCommand = text;
}
}
@@ -35,7 +35,7 @@ ColumnLayout {
text: Settings.data.appLauncher.customLaunchPrefix
enabled: Settings.data.appLauncher.customLaunchPrefixEnabled
visible: Settings.data.appLauncher.customLaunchPrefixEnabled
onEditingFinished: Settings.data.appLauncher.customLaunchPrefix = text
onTextChanged: Settings.data.appLauncher.customLaunchPrefix = text
}
NTextInput {
@@ -44,6 +44,6 @@ ColumnLayout {
Layout.fillWidth: true
text: Settings.data.appLauncher.screenshotAnnotationTool
placeholderText: I18n.tr("panels.launcher.settings-annotation-tool-placeholder")
onEditingFinished: Settings.data.appLauncher.screenshotAnnotationTool = text
onTextChanged: Settings.data.appLauncher.screenshotAnnotationTool = text
}
}
@@ -99,7 +99,7 @@ ColumnLayout {
text: Settings.data.notifications?.sounds?.normalSoundFile ?? ""
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
onInputEditingFinished: {
onInputTextChanged: text => {
const soundPath = text;
Settings.data.notifications.sounds.normalSoundFile = soundPath;
Settings.data.notifications.sounds.lowSoundFile = soundPath;
@@ -132,7 +132,7 @@ ColumnLayout {
text: Settings.data.notifications?.sounds?.lowSoundFile ?? ""
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
onInputEditingFinished: Settings.data.notifications.sounds.lowSoundFile = text
onInputTextChanged: text => Settings.data.notifications.sounds.lowSoundFile = text
onButtonClicked: root.openLowPicker()
}
}
@@ -154,7 +154,7 @@ ColumnLayout {
text: Settings.data.notifications?.sounds?.normalSoundFile ?? ""
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
onInputEditingFinished: Settings.data.notifications.sounds.normalSoundFile = text
onInputTextChanged: text => Settings.data.notifications.sounds.normalSoundFile = text
onButtonClicked: root.openNormalPicker()
}
}
@@ -176,7 +176,7 @@ ColumnLayout {
text: Settings.data.notifications?.sounds?.criticalSoundFile ?? ""
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
onInputEditingFinished: Settings.data.notifications.sounds.criticalSoundFile = text
onInputTextChanged: text => Settings.data.notifications.sounds.criticalSoundFile = text
onButtonClicked: root.openCriticalPicker()
}
}
@@ -198,7 +198,7 @@ ColumnLayout {
Layout.fillWidth: true
placeholderText: I18n.tr("panels.notifications.sounds-excluded-apps-placeholder")
text: Settings.data.notifications?.sounds?.excludedApps ?? ""
onEditingFinished: Settings.data.notifications.sounds.excludedApps = text
onTextChanged: Settings.data.notifications.sounds.excludedApps = text
}
}
}
@@ -119,7 +119,7 @@ ColumnLayout {
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.wallpaper.settings-folder-label")
Layout.fillWidth: true
onInputEditingFinished: Settings.data.wallpaper.directory = text
onInputTextChanged: text => Settings.data.wallpaper.directory = text
onButtonClicked: root.openMainFolderPicker()
}
@@ -164,7 +164,7 @@ ColumnLayout {
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("panels.wallpaper.settings-monitor-specific-tooltip")
Layout.fillWidth: true
onInputEditingFinished: WallpaperService.setMonitorDirectory(modelData.name, text)
onInputTextChanged: text => WallpaperService.setMonitorDirectory(modelData.name, text)
onButtonClicked: root.openMonitorFolderPicker(modelData.name)
}
}
@@ -332,7 +332,7 @@ ColumnLayout {
buttonIcon: "folder-open"
buttonTooltip: I18n.tr("setup.wallpaper.dir-browse")
Layout.fillWidth: true
onInputEditingFinished: {
onInputTextChanged: text => {
selectedDirectory = text;
directoryChanged(text);
}
+1 -1
View File
@@ -1835,7 +1835,7 @@ SmartPanel {
pageInput.inputItem.focus = false;
}
onAccepted: submitPage()
onEditingFinished: submitPage()
}
NText {