fix: Fix the proportions of the list and the preview

This commit is contained in:
loner
2025-11-18 03:25:20 +08:00
parent 6eaffb0e65
commit ca89a0dc35
2 changed files with 10 additions and 6 deletions
+10 -5
View File
@@ -13,12 +13,12 @@ import qs.Widgets
SmartPanel {
id: root
readonly property int baseWidth: Math.round(500 * Style.uiScaleRatio)
readonly property int previewWidth: Math.round(400 * Style.uiScaleRatio)
readonly property real clipListRatio: 0.6 // 60% for the list
readonly property real clipPreviewRatio: 0.4 // 40% for the preview
readonly property bool previewActive: activePlugin && activePlugin.name === I18n.tr("plugins.clipboard") && results.length > 0
// Panel configuration
preferredWidth: baseWidth + (previewActive ? previewWidth : 0)
preferredWidth: Math.round(700 * Style.uiScaleRatio) // Base width when both are shown, scaled appropriately
preferredHeight: Math.round(600 * Style.uiScaleRatio)
preferredWidthRatio: 0.3
preferredHeightRatio: 0.5
@@ -348,7 +348,10 @@ SmartPanel {
ColumnLayout {
id: leftPane
Layout.fillHeight: true
Layout.preferredWidth: root.baseWidth
Layout.fillWidth: root.previewActive // Fill width proportionally when preview is active
Layout.preferredWidth: root.previewActive ?
Math.round(root.clipListRatio * (root.preferredWidth - (Style.marginL * 2))) :
(root.preferredWidth - (Style.marginL * 2))
anchors.margins: Style.marginL
spacing: Style.marginM
@@ -656,7 +659,9 @@ SmartPanel {
// --- Right Pane (Preview) ---
Item {
Layout.fillHeight: true
Layout.preferredWidth: root.previewActive ? root.previewWidth : 0
Layout.fillWidth: root.previewActive // Fill width proportionally when preview is active
Layout.preferredWidth: root.previewActive ?
Math.round(root.clipPreviewRatio * (root.preferredWidth - (Style.marginL * 2))) : 0
visible: root.previewActive
Behavior on Layout.preferredWidth {
-1
View File
@@ -13,7 +13,6 @@ Item {
property bool loadingFullContent: false
implicitHeight: contentColumn.implicitHeight + Style.marginL * 2
implicitWidth: 350 // A default width
Connections {
target: previewPanel