From 64728632c7ed469ca56f1e95295b93700dbc0def Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Fri, 18 Aug 2023 19:17:45 +0800 Subject: [PATCH] update --- example/qml/page/T_Screenshot.qml | 25 +++++++++++++++---------- src/FluColors.cpp | 1 + src/FluColors.h | 1 + src/FluTools.cpp | 4 ++++ src/FluTools.h | 11 +++++++++++ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/example/qml/page/T_Screenshot.qml b/example/qml/page/T_Screenshot.qml index 197c3e70..4d9f0441 100644 --- a/example/qml/page/T_Screenshot.qml +++ b/example/qml/page/T_Screenshot.qml @@ -16,10 +16,7 @@ FluScrollablePage{ Layout.topMargin: 20 FluFilledButton{ - anchors{ - top: parent.top - topMargin: 14 - } + anchors.verticalCenter: parent.verticalCenter text:"Open Screenshot" onClicked: { screenshot.open() @@ -27,12 +24,22 @@ FluScrollablePage{ } } - Image{ - id:image + Rectangle{ Layout.preferredHeight: 400 Layout.preferredWidth: 400 - fillMode: Image.PreserveAspectFit - asynchronous: true + Layout.topMargin: 10 + Layout.leftMargin: 4 + color: FluTheme.dark ? FluColors.Black : FluColors.White + FluShadow{ + radius: 0 + color: FluTheme.primaryColor.dark + } + Image{ + id:image + anchors.fill: parent + fillMode: Image.PreserveAspectFit + asynchronous: true + } } FluScreenshot{ @@ -41,8 +48,6 @@ FluScrollablePage{ saveFolder: FluTools.getApplicationDirPath()+"/screenshot" onCaptrueCompleted: (captrue)=>{ - - //C:/Users/zhuzi/Pictures/1692283885126.png image.source = captrue } } diff --git a/src/FluColors.cpp b/src/FluColors.cpp index e7475a52..41fb9399 100644 --- a/src/FluColors.cpp +++ b/src/FluColors.cpp @@ -13,6 +13,7 @@ FluColors *FluColors::getInstance() FluColors::FluColors(QObject *parent) : QObject{parent} { + Transparent("#00000000"); Black("#000000"); White("#ffffff"); Grey10("#faf9f8"); diff --git a/src/FluColors.h b/src/FluColors.h index 92ce68af..d70f7f31 100644 --- a/src/FluColors.h +++ b/src/FluColors.h @@ -12,6 +12,7 @@ class FluColors : public QObject { Q_OBJECT + Q_PROPERTY_AUTO(QString,Transparent); Q_PROPERTY_AUTO(QString,Black); Q_PROPERTY_AUTO(QString,White); Q_PROPERTY_AUTO(QString,Grey10); diff --git a/src/FluTools.cpp b/src/FluTools.cpp index e105a995..b7876fab 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -119,3 +119,7 @@ QRect FluTools::getVirtualGeometry(){ QString FluTools::getApplicationDirPath(){ return qApp->applicationDirPath(); } + +QUrl FluTools::getUrlByFilePath(const QString& path){ + return QUrl::fromLocalFile(path); +} diff --git a/src/FluTools.h b/src/FluTools.h index 9e607bf5..5d65fa4b 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -122,8 +122,19 @@ public: */ Q_INVOKABLE QRect getVirtualGeometry(); + /** + * @brief getApplicationDirPath + * @return + */ Q_INVOKABLE QString getApplicationDirPath(); + /** + * @brief getUrlByFilePath + * @param path + * @return + */ + Q_INVOKABLE QUrl getUrlByFilePath(const QString& path); + };