1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

sizing changes

This commit is contained in:
bbedward
2025-07-22 23:35:48 -04:00
parent 54a7281fa3
commit 9c8c25711c
8 changed files with 56 additions and 70 deletions

View File

@@ -114,8 +114,8 @@ DankModal {
// DankModal configuration // DankModal configuration
visible: isVisible visible: isVisible
width: 600 width: 650
height: 500 height: 550
keyboardFocus: "ondemand" keyboardFocus: "ondemand"
onVisibleChanged: { onVisibleChanged: {
@@ -132,8 +132,8 @@ DankModal {
content: Component { content: Component {
Column { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingL anchors.margins: Theme.spacingM
spacing: Theme.spacingM spacing: Theme.spacingS
// Header with search // Header with search
Rectangle { Rectangle {
@@ -201,12 +201,10 @@ DankModal {
Connections { Connections {
target: clipboardHistory target: clipboardHistory
function onShouldFocusSearchChanged() { function onOpened() {
if (shouldFocusSearch) { if (shouldFocusSearch) {
Qt.callLater(function() { searchField.forceActiveFocus()
searchField.forceActiveFocus(); shouldFocusSearch = false
shouldFocusSearch = false;
});
} }
} }
} }
@@ -315,7 +313,7 @@ DankModal {
id: clearConfirmDialog id: clearConfirmDialog
visible: showClearConfirmation visible: showClearConfirmation
width: 350 width: 350
height: 180 height: 150
keyboardFocus: "ondemand" keyboardFocus: "ondemand"
onBackgroundClicked: { onBackgroundClicked: {
@@ -328,8 +326,8 @@ DankModal {
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - Theme.spacingL * 2 width: parent.width - Theme.spacingM * 2
spacing: Theme.spacingL spacing: Theme.spacingM
Text { Text {
text: "Clear All History?" text: "Clear All History?"

View File

@@ -36,16 +36,17 @@ DankModal {
} }
visible: dialogVisible visible: dialogVisible
width: 400 width: 380
height: 250 height: 190
keyboardFocus: "exclusive" keyboardFocus: "ondemand"
onOpened: {
textInput.forceActiveFocus()
}
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
textInput.enabled = true; textInput.enabled = true;
Qt.callLater(function() {
textInput.forceActiveFocus();
});
} else { } else {
textInput.enabled = false; textInput.enabled = false;
} }
@@ -59,8 +60,8 @@ DankModal {
content: Component { content: Component {
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - Theme.spacingL * 2 width: parent.width - Theme.spacingM * 2
spacing: Theme.spacingL spacing: Theme.spacingM
Text { Text {
text: dialogTitle text: dialogTitle

View File

@@ -38,7 +38,7 @@ DankModal {
// DankModal configuration // DankModal configuration
visible: powerConfirmVisible visible: powerConfirmVisible
width: 350 width: 350
height: 200 height: 160
keyboardFocus: "ondemand" keyboardFocus: "ondemand"
enableShadow: false enableShadow: false
onBackgroundClicked: { onBackgroundClicked: {
@@ -62,8 +62,8 @@ DankModal {
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - Theme.spacingL * 2 width: parent.width - Theme.spacingM * 2
spacing: Theme.spacingL spacing: Theme.spacingM
// Title // Title
Text { Text {
@@ -95,7 +95,7 @@ DankModal {
} }
Item { Item {
height: Theme.spacingL height: Theme.spacingS
} }
// Buttons // Buttons

View File

@@ -21,8 +21,8 @@ DankModal {
// DankModal configuration // DankModal configuration
visible: settingsVisible visible: settingsVisible
width: 700 width: 650
height: 600 height: 750
keyboardFocus: "ondemand" keyboardFocus: "ondemand"
enableShadow: true enableShadow: true
@@ -33,8 +33,8 @@ DankModal {
content: Component { content: Component {
Column { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingL anchors.margins: Theme.spacingM
spacing: Theme.spacingL spacing: Theme.spacingS
// Header // Header
Row { Row {

View File

@@ -200,9 +200,9 @@ DankModal {
// DankModal configuration // DankModal configuration
visible: spotlightOpen visible: spotlightOpen
width: 600 width: 550
height: 500 height: 600
keyboardFocus: "exclusive" keyboardFocus: "ondemand"
backgroundColor: Theme.popupBackground() backgroundColor: Theme.popupBackground()
cornerRadius: Theme.cornerRadiusXLarge cornerRadius: Theme.cornerRadiusXLarge
borderColor: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) borderColor: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
@@ -271,16 +271,6 @@ DankModal {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Component.onCompleted: {
forceActiveFocus();
}
onVisibleChanged: {
if (visible) {
forceActiveFocus();
}
}
// Handle keyboard shortcuts // Handle keyboard shortcuts
Keys.onPressed: function(event) { Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
@@ -302,17 +292,16 @@ DankModal {
launchSelected(); launchSelected();
event.accepted = true; event.accepted = true;
} else if (event.text && event.text.length > 0 && event.text.match(/[a-zA-Z0-9\\s]/)) { } else if (event.text && event.text.length > 0 && event.text.match(/[a-zA-Z0-9\\s]/)) {
// User started typing, focus search field and pass the character
searchField.forceActiveFocus();
searchField.text = event.text; searchField.text = event.text;
searchField.forceActiveFocus();
event.accepted = true; event.accepted = true;
} }
} }
Column { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingXL anchors.margins: Theme.spacingM
spacing: Theme.spacingL spacing: Theme.spacingM
// Combined row for categories and view mode toggle // Combined row for categories and view mode toggle
@@ -442,24 +431,15 @@ DankModal {
Connections { Connections {
target: spotlightLauncher target: spotlightLauncher
function onShouldFocusSearchChanged() { function onOpened() {
if (shouldFocusSearch) { if (shouldFocusSearch) {
Qt.callLater(function() { searchField.forceActiveFocus()
searchField.forceActiveFocus(); searchField.selectAll()
searchField.selectAll(); shouldFocusSearch = false
shouldFocusSearch = false;
});
} }
} }
} }
onActiveFocusChanged: {
if (!activeFocus && searchQuery.length === 0) {
// If search field loses focus and there's no search text, give focus back to main handler
parent.parent.forceActiveFocus();
}
}
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
hide(); hide();

View File

@@ -12,9 +12,13 @@ DankModal {
property string wifiPasswordInput: "" property string wifiPasswordInput: ""
visible: wifiPasswordDialogVisible visible: wifiPasswordDialogVisible
width: 450 width: 420
height: 280 height: 230
keyboardFocus: "exclusive" keyboardFocus: "ondemand"
onOpened: {
passwordInput.forceActiveFocus()
}
onVisibleChanged: { onVisibleChanged: {
if (!visible) { if (!visible) {
@@ -31,16 +35,11 @@ DankModal {
Item { Item {
anchors.fill: parent anchors.fill: parent
Component.onCompleted: {
Qt.callLater(function() {
passwordInput.forceActiveFocus();
});
}
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - Theme.spacingL * 2 width: parent.width - Theme.spacingM * 2
spacing: Theme.spacingL spacing: Theme.spacingM
// Header // Header
Row { Row {

View File

@@ -11,9 +11,13 @@ PanelWindow {
// Core properties // Core properties
property alias content: contentLoader.sourceComponent property alias content: contentLoader.sourceComponent
// Sizing // Sizing - can use fixed or relative to screen
property real width: 400 property real width: 400
property real height: 300 property real height: 300
// Screen-relative sizing helpers
readonly property real screenWidth: parent ? parent.width : width
readonly property real screenHeight: parent ? parent.height : height
// Background behavior // Background behavior
property bool showBackground: true property bool showBackground: true
@@ -71,6 +75,11 @@ PanelWindow {
if (root.visible) { if (root.visible) {
opened() opened()
} else { } else {
// Properly cleanup text input surfaces
if (Qt.inputMethod) {
Qt.inputMethod.hide()
Qt.inputMethod.reset()
}
dialogClosed() dialogClosed()
} }
} }

View File

@@ -159,7 +159,6 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
textInput.text = ""; textInput.text = "";
textInput.forceActiveFocus();
} }
} }