1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-09 15:05:39 -05:00

refactor: common DankTextField widget

This commit is contained in:
bbedward
2025-07-21 22:10:46 -04:00
parent 303dc70c28
commit 9730e4edae
7 changed files with 352 additions and 351 deletions

View File

@@ -385,36 +385,21 @@ PanelWindow {
border.color: profileImageInput.activeFocus ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
border.width: profileImageInput.activeFocus ? 2 : 1
TextInput {
DankTextField {
id: profileImageInput
anchors.fill: parent
anchors.margins: Theme.spacingM
verticalAlignment: TextInput.AlignVCenter
color: Theme.surfaceText
textColor: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
text: Prefs.profileImage
selectByMouse: true
placeholderText: "Enter image path or URL..."
backgroundColor: "transparent"
normalBorderColor: "transparent"
focusedBorderColor: "transparent"
onEditingFinished: {
Prefs.setProfileImage(text);
}
// Placeholder text
Text {
anchors.verticalCenter: parent.verticalCenter
text: "Enter image path or URL..."
color: Qt.rgba(Theme.surfaceVariantText.r, Theme.surfaceVariantText.g, Theme.surfaceVariantText.b, 0.6)
font.pixelSize: Theme.fontSizeMedium
visible: profileImageInput.text.length === 0 && !profileImageInput.activeFocus
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.NoButton
}
}
}
@@ -498,36 +483,21 @@ PanelWindow {
border.color: weatherLocationInput.activeFocus ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
border.width: weatherLocationInput.activeFocus ? 2 : 1
TextInput {
DankTextField {
id: weatherLocationInput
anchors.fill: parent
anchors.margins: Theme.spacingM
verticalAlignment: TextInput.AlignVCenter
color: Theme.surfaceText
textColor: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
text: Prefs.weatherLocationOverride
selectByMouse: true
placeholderText: "Enter location..."
backgroundColor: "transparent"
normalBorderColor: "transparent"
focusedBorderColor: "transparent"
onEditingFinished: {
Prefs.setWeatherLocationOverride(text);
}
// Placeholder text
Text {
anchors.verticalCenter: parent.verticalCenter
text: "Enter location..."
color: Qt.rgba(Theme.surfaceVariantText.r, Theme.surfaceVariantText.g, Theme.surfaceVariantText.b, 0.6)
font.pixelSize: Theme.fontSizeMedium
visible: weatherLocationInput.text.length === 0 && !weatherLocationInput.activeFocus
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.NoButton
}
}
}