Merge branch 'main' into open-panel-overlay-layer

This commit is contained in:
Damian D'Souza
2025-10-20 22:14:18 +02:00
committed by GitHub
43 changed files with 1567 additions and 412 deletions
+28 -55
View File
@@ -296,6 +296,10 @@ Popup {
text: root.currentPath
placeholderText: "Enter path..."
Layout.fillWidth: true
visible: !filePickerPanel.showSearchBar
enabled: !filePickerPanel.showSearchBar
onEditingFinished: {
const newPath = text.trim()
if (newPath !== "" && newPath !== root.currentPath) {
@@ -314,6 +318,30 @@ Popup {
}
}
// Search bar
NTextInput {
id: searchInput
inputIconName: "search"
placeholderText: I18n.tr("placeholders.search")
Layout.fillWidth: true
visible: filePickerPanel.showSearchBar
enabled: filePickerPanel.showSearchBar
text: filePickerPanel.searchText
onTextChanged: {
filePickerPanel.searchText = text
filePickerPanel.filterText = text
root.updateFilteredModel()
}
Keys.onEscapePressed: {
filePickerPanel.showSearchBar = false
filePickerPanel.searchText = ""
filePickerPanel.filterText = ""
root.updateFilteredModel()
}
}
NIconButton {
icon: filePickerPanel.viewMode ? "filepicker-list" : "filepicker-layout-grid"
tooltipText: filePickerPanel.viewMode ? "List View" : "Grid View"
@@ -336,61 +364,6 @@ Popup {
}
}
// Search bar
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 45
color: Color.mSurfaceVariant
radius: Style.radiusS
border.color: Color.mOutline
border.width: Math.max(1, Style.borderS)
visible: filePickerPanel.showSearchBar
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Style.marginS
anchors.rightMargin: Style.marginS
spacing: Style.marginS
NIcon {
icon: "filepicker-search"
color: Color.mOnSurfaceVariant
pointSize: Style.fontSizeS
}
NTextInput {
id: searchInput
placeholderText: I18n.tr("widget.file-picker.search-placeholder")
Layout.fillWidth: true
text: filePickerPanel.searchText
onTextChanged: {
filePickerPanel.searchText = text
filePickerPanel.filterText = text
root.updateFilteredModel()
}
Keys.onEscapePressed: {
filePickerPanel.showSearchBar = false
filePickerPanel.searchText = ""
filePickerPanel.filterText = ""
root.updateFilteredModel()
}
}
NIconButton {
icon: "filepicker-x"
tooltipText: I18n.tr("tooltips.clear")
baseSize: Style.baseWidgetSize * 0.6
visible: filePickerPanel.searchText.length > 0
onClicked: {
searchInput.text = ""
filePickerPanel.searchText = ""
filePickerPanel.filterText = ""
root.updateFilteredModel()
}
}
}
}
// File list area
Rectangle {
Layout.fillWidth: true
+2 -1
View File
@@ -173,6 +173,7 @@ RowLayout {
// Search input
NTextInput {
id: searchInput
inputIconName: "search"
Layout.fillWidth: true
placeholderText: root.searchPlaceholder
text: root.searchText
@@ -233,7 +234,7 @@ RowLayout {
Layout.alignment: Qt.AlignRight
Repeater {
model: badgeLocations
model: typeof badgeLocations !== 'undefined' ? badgeLocations : []
delegate: NBox {
width: Style.baseWidgetSize * 0.7
+93 -51
View File
@@ -9,6 +9,7 @@ ColumnLayout {
property string label: ""
property string description: ""
property string inputIconName: ""
property bool readOnly: false
property bool enabled: true
property color labelColor: Color.mOnSurface
@@ -106,74 +107,115 @@ ColumnLayout {
id: inputContainer
anchors.fill: parent
anchors.leftMargin: Style.marginM
anchors.rightMargin: Style.marginM
// anchors.rightMargin: Style.marginM
clip: true
z: 1
TextField {
id: input
RowLayout {
anchors.fill: parent
verticalAlignment: TextInput.AlignVCenter
spacing: 0
echoMode: TextInput.Normal
readOnly: root.readOnly
enabled: root.enabled
color: Color.mOnSurface
placeholderTextColor: Qt.alpha(Color.mOnSurfaceVariant, 0.6)
NIcon {
id: inputIcon
icon: root.inputIconName
selectByMouse: true
visible: root.inputIconName !== ""
enabled: false
topPadding: 0
bottomPadding: 0
leftPadding: 0
rightPadding: 0
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: visible ? Style.marginS : 0
}
background: null
TextField {
id: input
font.family: root.fontFamily
font.pointSize: root.fontSize * Style.uiScaleRatio
font.weight: root.fontWeight
Layout.fillWidth: true
Layout.fillHeight: true
onEditingFinished: root.editingFinished()
verticalAlignment: TextInput.AlignVCenter
// Override mouse handling to prevent propagation
MouseArea {
id: textFieldMouse
anchors.fill: parent
acceptedButtons: Qt.AllButtons
preventStealing: true
propagateComposedEvents: false
cursorShape: Qt.IBeamCursor
echoMode: TextInput.Normal
readOnly: root.readOnly
enabled: root.enabled
color: Color.mOnSurface
placeholderTextColor: Qt.alpha(Color.mOnSurfaceVariant, 0.6)
property int selectionStart: 0
selectByMouse: true
onPressed: mouse => {
mouse.accepted = true
input.forceActiveFocus()
var pos = input.positionAt(mouse.x, mouse.y)
input.cursorPosition = pos
selectionStart = pos
}
topPadding: 0
bottomPadding: 0
leftPadding: 0
rightPadding: 0
onPositionChanged: mouse => {
if (mouse.buttons & Qt.LeftButton) {
mouse.accepted = true
var pos = input.positionAt(mouse.x, mouse.y)
input.select(selectionStart, pos)
background: null
font.family: root.fontFamily
font.pointSize: root.fontSize * Style.uiScaleRatio
font.weight: root.fontWeight
onEditingFinished: root.editingFinished()
// Override mouse handling to prevent propagation
MouseArea {
id: textFieldMouse
anchors.fill: parent
acceptedButtons: Qt.AllButtons
preventStealing: true
propagateComposedEvents: false
cursorShape: Qt.IBeamCursor
property int selectionStart: 0
onPressed: mouse => {
mouse.accepted = true
input.forceActiveFocus()
var pos = input.positionAt(mouse.x, mouse.y)
input.cursorPosition = pos
selectionStart = pos
}
onPositionChanged: mouse => {
if (mouse.buttons & Qt.LeftButton) {
mouse.accepted = true
var pos = input.positionAt(mouse.x, mouse.y)
input.select(selectionStart, pos)
}
}
onDoubleClicked: mouse => {
mouse.accepted = true
input.selectAll()
}
onDoubleClicked: mouse => {
mouse.accepted = true
input.selectAll()
}
onReleased: mouse => {
mouse.accepted = true
}
onWheel: wheel => {
wheel.accepted = true
}
}
}
NIconButton {
id: clearButton
icon: "x"
tooltipText: I18n.tr("widgets.text-input.clear")
onReleased: mouse => {
mouse.accepted = true
}
onWheel: wheel => {
wheel.accepted = true
}
Layout.alignment: Qt.AlignVCenter
border.width: 0
colorBg: Color.transparent
colorBgHover: Color.transparent
colorFg: Color.mOnSurface
colorFgHover: Color.mError
visible: input.text.length > 0 && !root.readOnly
enabled: input.text.length > 0 && !root.readOnly
onClicked: {
input.clear()
input.forceActiveFocus()
}
}
}
}
+8
View File
@@ -9,6 +9,7 @@ RowLayout {
property string label: ""
property string description: ""
property bool enabled: true
property bool checked: false
property bool hovering: false
property int baseSize: Math.round(Style.baseWidgetSize * 0.8 * Style.uiScaleRatio)
@@ -18,6 +19,7 @@ RowLayout {
signal exited
Layout.fillWidth: true
opacity: enabled ? 1.0 : 0.6
NLabel {
label: root.label
@@ -71,14 +73,20 @@ RowLayout {
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
if (!enabled)
return
hovering = true
root.entered()
}
onExited: {
if (!enabled)
return
hovering = false
root.exited()
}
onClicked: {
if (!enabled)
return
root.toggled(!root.checked)
}
}