From 7134afe5fb26da6b7b16facba538e6d8cbaf6999 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sat, 17 Jan 2026 14:30:12 +0100 Subject: [PATCH] NTextInput: proper disabled state (visually) --- .../Settings/Tabs/Notifications/SoundSubTab.qml | 5 +++++ .../Settings/Tabs/SystemMonitor/PollingSubTab.qml | 1 - .../Settings/Tabs/SystemMonitor/ThresholdsSubTab.qml | 5 +++-- Widgets/NTextInput.qml | 12 ++++-------- Widgets/NTextInputButton.qml | 1 + 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Modules/Panels/Settings/Tabs/Notifications/SoundSubTab.qml b/Modules/Panels/Settings/Tabs/Notifications/SoundSubTab.qml index 2b63db32a..b7c386d47 100644 --- a/Modules/Panels/Settings/Tabs/Notifications/SoundSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Notifications/SoundSubTab.qml @@ -96,6 +96,7 @@ ColumnLayout { } NTextInputButton { + enabled: parent.enabled Layout.fillWidth: true placeholderText: I18n.tr("panels.notifications.sounds-files-placeholder") text: Settings.data.notifications?.sounds?.normalSoundFile ?? "" @@ -128,6 +129,7 @@ ColumnLayout { } NTextInputButton { + enabled: parent.enabled Layout.fillWidth: true placeholderText: I18n.tr("panels.notifications.sounds-files-placeholder") text: Settings.data.notifications?.sounds?.lowSoundFile ?? "" @@ -149,6 +151,7 @@ ColumnLayout { } NTextInputButton { + enabled: parent.enabled Layout.fillWidth: true placeholderText: I18n.tr("panels.notifications.sounds-files-placeholder") text: Settings.data.notifications?.sounds?.normalSoundFile ?? "" @@ -170,6 +173,7 @@ ColumnLayout { } NTextInputButton { + enabled: parent.enabled Layout.fillWidth: true placeholderText: I18n.tr("panels.notifications.sounds-files-placeholder") text: Settings.data.notifications?.sounds?.criticalSoundFile ?? "" @@ -193,6 +197,7 @@ ColumnLayout { } NTextInput { + enabled: parent.enabled Layout.fillWidth: true placeholderText: I18n.tr("panels.notifications.sounds-excluded-apps-placeholder") text: Settings.data.notifications?.sounds?.excludedApps ?? "" diff --git a/Modules/Panels/Settings/Tabs/SystemMonitor/PollingSubTab.qml b/Modules/Panels/Settings/Tabs/SystemMonitor/PollingSubTab.qml index d273f1f3b..f837ee93e 100644 --- a/Modules/Panels/Settings/Tabs/SystemMonitor/PollingSubTab.qml +++ b/Modules/Panels/Settings/Tabs/SystemMonitor/PollingSubTab.qml @@ -168,5 +168,4 @@ ColumnLayout { suffix: " ms" } } - } diff --git a/Modules/Panels/Settings/Tabs/SystemMonitor/ThresholdsSubTab.qml b/Modules/Panels/Settings/Tabs/SystemMonitor/ThresholdsSubTab.qml index 4637aa850..aff0c0a67 100644 --- a/Modules/Panels/Settings/Tabs/SystemMonitor/ThresholdsSubTab.qml +++ b/Modules/Panels/Settings/Tabs/SystemMonitor/ThresholdsSubTab.qml @@ -23,7 +23,9 @@ ColumnLayout { rowSpacing: Style.marginM // Header row - Item { Layout.fillWidth: true } + Item { + Layout.fillWidth: true + } NText { Layout.alignment: Qt.AlignHCenter @@ -209,5 +211,4 @@ ColumnLayout { onValueChanged: Settings.data.systemMonitor.diskCriticalThreshold = value } } - } diff --git a/Widgets/NTextInput.qml b/Widgets/NTextInput.qml index 5a86a1fb3..c9affc48f 100644 --- a/Widgets/NTextInput.qml +++ b/Widgets/NTextInput.qml @@ -20,8 +20,6 @@ ColumnLayout { property var defaultValue: undefined property string settingsPath: "" - property color textColor: Color.mOnSurface - property alias text: input.text property alias placeholderText: input.placeholderText property alias inputMethodHints: input.inputMethodHints @@ -29,7 +27,7 @@ ColumnLayout { signal editingFinished - opacity: enabled ? 1.0 : 0.6 + opacity: enabled ? 1.0 : 0.3 spacing: Style.marginS readonly property bool isValueChanged: (defaultValue !== undefined) && (text !== defaultValue) @@ -149,9 +147,7 @@ ColumnLayout { echoMode: TextInput.Normal readOnly: root.readOnly placeholderTextColor: Qt.alpha(Color.mOnSurfaceVariant, 0.6) - color: root.textColor - selectionColor: Color.mPrimary - selectedTextColor: Color.mOnPrimary + color: enabled ? Color.mOnSurface : Qt.alpha(Color.mOnSurface, 0.4) selectByMouse: true @@ -211,7 +207,7 @@ ColumnLayout { NIconButton { id: clearButton icon: "x" - tooltipText: I18n.tr("common.clear") + tooltipText: (input.text.length > 0 && !root.readOnly && root.enabled) ? I18n.tr("common.clear") : "" Layout.alignment: Qt.AlignVCenter border.width: 0 @@ -222,7 +218,7 @@ ColumnLayout { colorFgHover: Color.mError visible: input.text.length > 0 && !root.readOnly - enabled: input.text.length > 0 && !root.readOnly + enabled: input.text.length > 0 && !root.readOnly && root.enabled onClicked: { input.clear(); diff --git a/Widgets/NTextInputButton.qml b/Widgets/NTextInputButton.qml index 3b0160779..89711105e 100644 --- a/Widgets/NTextInputButton.qml +++ b/Widgets/NTextInputButton.qml @@ -42,6 +42,7 @@ ColumnLayout { inputIconName: root.inputIconName Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter + enabled: root.enabled onTextChanged: root.inputTextChanged(text) onEditingFinished: root.inputEditingFinished() }