mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NInputButton properly uses NTextInput
This commit is contained in:
@@ -37,21 +37,15 @@ ColumnLayout {
|
||||
placeholderText: "/home/user/.face"
|
||||
buttonIcon: "photo"
|
||||
buttonTooltip: "Browse for avatar image"
|
||||
|
||||
onInputEditingFinished: {
|
||||
Settings.data.general.avatarImage = text
|
||||
}
|
||||
onInputEditingFinished: Settings.data.general.avatarImage = text
|
||||
onButtonClicked: {
|
||||
FilePickerService.open({
|
||||
"title": "Select Avatar Image",
|
||||
"initialPath": Settings.data.general.avatarImage || Quickshell.env("HOME"),
|
||||
"selectFiles": true,
|
||||
"scaling": scaling,
|
||||
"onSelected": function (path) {
|
||||
Settings.data.general.avatarImage = path
|
||||
text = path
|
||||
},
|
||||
"parent": root
|
||||
"parent": root,
|
||||
"onSelected": path => Settings.data.general.avatarImage = path
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,21 +27,15 @@ ColumnLayout {
|
||||
text: Settings.data.screenRecorder.directory
|
||||
buttonIcon: "folder-open"
|
||||
buttonTooltip: "Browse for output folder"
|
||||
|
||||
onInputEditingFinished: {
|
||||
Settings.data.screenRecorder.directory = text
|
||||
}
|
||||
onInputEditingFinished: Settings.data.screenRecorder.directory = text
|
||||
onButtonClicked: {
|
||||
FilePickerService.open({
|
||||
"title": "Select Output Folder",
|
||||
"initialPath": Settings.data.screenRecorder.directory || Quickshell.env("HOME") + "/Videos",
|
||||
"selectFiles": false,
|
||||
"scaling": scaling,
|
||||
"onSelected": function (path) {
|
||||
Settings.data.screenRecorder.directory = path
|
||||
text = path
|
||||
},
|
||||
"parent": root
|
||||
"parent": root,
|
||||
"onSelected": path => Settings.data.screenRecorder.directory = path
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,11 +350,8 @@ ColumnLayout {
|
||||
"initialPath": Settings.data.wallpaper.directory || Quickshell.env("HOME"),
|
||||
"selectFiles": false,
|
||||
"scaling": scaling,
|
||||
"onSelected": function (path) {
|
||||
Settings.data.wallpaper.directory = path
|
||||
wallpaperPathInput.text = path
|
||||
},
|
||||
"parent": root
|
||||
"parent": root,
|
||||
"onSelected": path => Settings.data.wallpaper.directory = path
|
||||
})
|
||||
}
|
||||
|
||||
@@ -364,10 +361,8 @@ ColumnLayout {
|
||||
"initialPath": WallpaperService.getMonitorDirectory(monitorName),
|
||||
"selectFiles": false,
|
||||
"scaling": scaling,
|
||||
"onSelected": function (path) {
|
||||
WallpaperService.setMonitorDirectory(monitorName, path)
|
||||
},
|
||||
"parent": root
|
||||
"parent": root,
|
||||
"onSelected": path => WallpaperService.setMonitorDirectory(monitorName, path)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,41 +36,12 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Input field container
|
||||
Rectangle {
|
||||
id: inputContainer
|
||||
NTextInput{
|
||||
id: input
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: root.maximumWidth > 0 ? root.maximumWidth : -1
|
||||
implicitHeight: Style.baseWidgetSize * 1.1 * scaling
|
||||
|
||||
radius: Style.radiusM * scaling
|
||||
color: Color.mSurface
|
||||
border.color: input.activeFocus ? Color.mSecondary : Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
|
||||
Behavior on border.color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: input
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.margins: Style.marginM * scaling
|
||||
|
||||
color: Color.mOnSurface
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
font.family: Settings.data.ui.fontDefault
|
||||
selectByMouse: true
|
||||
|
||||
background: Item {} // Remove default background since we have our own Rectangle
|
||||
|
||||
onTextChanged: root.inputTextChanged(text)
|
||||
onEditingFinished: root.inputEditingFinished()
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onTextChanged: root.inputTextChanged(text)
|
||||
onEditingFinished: root.inputEditingFinished()
|
||||
}
|
||||
|
||||
// Button
|
||||
|
||||
@@ -166,7 +166,6 @@ RowLayout {
|
||||
fontSize: Style.fontSizeS * scaling
|
||||
}
|
||||
|
||||
// Font list
|
||||
ListView {
|
||||
id: listView
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -54,14 +54,6 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// Block mouse events from going through
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: -1 // Place behind the TextField
|
||||
acceptedButtons: Qt.AllButtons
|
||||
propagateComposedEvents: false
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: input
|
||||
|
||||
@@ -92,5 +84,13 @@ ColumnLayout {
|
||||
|
||||
onEditingFinished: root.editingFinished()
|
||||
}
|
||||
|
||||
// Block mouse events from going through to components behind this one
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: -1 // Place behind the TextField
|
||||
acceptedButtons: Qt.AllButtons
|
||||
propagateComposedEvents: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user