From 84edf4087633840b827e0236402241daf6637a08 Mon Sep 17 00:00:00 2001 From: reionwong Date: Mon, 20 Sep 2021 22:13:42 +0800 Subject: [PATCH] Fix property dialog size --- dialogs/filepropertiesdialog.cpp | 7 +++++++ dialogs/filepropertiesdialog.h | 2 ++ qml/Dialogs/PropertiesDialog.qml | 10 ++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dialogs/filepropertiesdialog.cpp b/dialogs/filepropertiesdialog.cpp index d0165a7..3fb803c 100644 --- a/dialogs/filepropertiesdialog.cpp +++ b/dialogs/filepropertiesdialog.cpp @@ -71,6 +71,13 @@ FilePropertiesDialog::~FilePropertiesDialog() } } +void FilePropertiesDialog::updateSize(int width, int height) +{ + setBaseSize(QSize(width, height)); + setMinimumSize(QSize(width, height)); + setMaximumSize(QSize(width, height)); +} + void FilePropertiesDialog::accept(const QString &text) { KFileItemList list = m_items; diff --git a/dialogs/filepropertiesdialog.h b/dialogs/filepropertiesdialog.h index 809f695..a87bf5f 100644 --- a/dialogs/filepropertiesdialog.h +++ b/dialogs/filepropertiesdialog.h @@ -50,6 +50,8 @@ public: explicit FilePropertiesDialog(const QUrl &url, QQuickView *parent = nullptr); ~FilePropertiesDialog(); + Q_INVOKABLE void updateSize(int width, int height); + Q_INVOKABLE void accept(const QString &text); Q_INVOKABLE void reject(); diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index 7002d88..86592cc 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -26,8 +26,14 @@ import FishUI 1.0 as FishUI Item { id: control - width: _mainLayout.implicitWidth + FishUI.Units.largeSpacing * 4 - height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 + property int widthValue: _mainLayout.implicitWidth + FishUI.Units.largeSpacing * 4 + property int heightValue: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 + + // width: widthValue + // height: heightValue + + onWidthValueChanged: main.updateSize(widthValue, heightValue) + onHeightValueChanged: main.updateSize(widthValue, heightValue) focus: true Keys.enabled: true