NTextInput: proper disabled state (visually)

This commit is contained in:
Ly-sec
2026-01-17 14:30:12 +01:00
parent 0a6a3e5eba
commit 7134afe5fb
5 changed files with 13 additions and 11 deletions
@@ -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 ?? ""
@@ -168,5 +168,4 @@ ColumnLayout {
suffix: " ms"
}
}
}
@@ -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
}
}
}
+4 -8
View File
@@ -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();
+1
View File
@@ -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()
}