diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 6390b842..a1ea49fe 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -10,6 +10,20 @@ #include #include +FluWindowRegister::FluWindowRegister(QObject *parent):QObject{parent}{ + from(nullptr); + to(nullptr); + path(""); +} + +void FluWindowRegister::launch(const QJsonObject& argument){ + FluApp::getInstance()->navigate(path(),argument,this); +} + +void FluWindowRegister::onResult(const QJsonObject& data){ + Q_EMIT result(data); +} + FluApp::FluApp(QObject *parent):QObject{parent}{ useSystemAppBar(false); } diff --git a/src/FluApp.h b/src/FluApp.h index 10f49e4a..9ef317a8 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -9,10 +9,27 @@ #include #include #include -#include "FluWindowRegister.h" +#include #include "stdafx.h" #include "singleton.h" + +/** + * @brief The FluWindowRegister class + */ +class FluWindowRegister : public QObject +{ + Q_OBJECT + Q_PROPERTY_AUTO(QQuickWindow*,from) + Q_PROPERTY_AUTO(QQuickWindow*,to) + Q_PROPERTY_AUTO(QString,path); +public: + explicit FluWindowRegister(QObject *parent = nullptr); + Q_INVOKABLE void launch(const QJsonObject& argument = {}); + Q_INVOKABLE void onResult(const QJsonObject& data = {}); + Q_SIGNAL void result(const QJsonObject& data); +}; + /** * @brief The FluApp class */ diff --git a/src/FluWindowRegister.cpp b/src/FluWindowRegister.cpp deleted file mode 100644 index b2fa678b..00000000 --- a/src/FluWindowRegister.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "FluWindowRegister.h" - -#include "FluApp.h" -#include - -FluWindowRegister::FluWindowRegister(QObject *parent):QObject{parent}{ - from(nullptr); - to(nullptr); - path(""); -} - -void FluWindowRegister::launch(const QJsonObject& argument){ - FluApp::getInstance()->navigate(path(),argument,this); -} - -void FluWindowRegister::onResult(const QJsonObject& data){ - Q_EMIT result(data); -} diff --git a/src/FluWindowRegister.h b/src/FluWindowRegister.h deleted file mode 100644 index cda59497..00000000 --- a/src/FluWindowRegister.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef FLUWINDOWREGISTER_H -#define FLUWINDOWREGISTER_H - -#include -#include -#include -#include "stdafx.h" - -/** - * @brief The FluWindowRegister class - */ -class FluWindowRegister : public QObject -{ - Q_OBJECT - Q_PROPERTY_AUTO(QQuickWindow*,from) - Q_PROPERTY_AUTO(QQuickWindow*,to) - Q_PROPERTY_AUTO(QString,path); -public: - explicit FluWindowRegister(QObject *parent = nullptr); - Q_INVOKABLE void launch(const QJsonObject& argument = {}); - Q_INVOKABLE void onResult(const QJsonObject& data = {}); - Q_SIGNAL void result(const QJsonObject& data); -}; - -#endif // FLUWINDOWREGISTER_H diff --git a/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml b/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml index 2e1dcf9c..6b489ec5 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml @@ -25,12 +25,7 @@ FluTextBox{ function handleClick(modelData){ control_popup.visible = false control.itemClicked(modelData) - d.updateText(modelData.title) - } - function updateText(text){ - d.flagVisible = false - control.text = text - d.flagVisible = true + control.updateText(modelData.title) } function loadData(){ var result = [] @@ -137,4 +132,9 @@ FluTextBox{ control_popup.visible = true } } + function updateText(text){ + d.flagVisible = false + control.text = text + d.flagVisible = true + } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml b/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml index 0aaa8e03..b343ba32 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAutoSuggestBox.qml @@ -24,12 +24,7 @@ FluTextBox{ function handleClick(modelData){ control_popup.visible = false control.itemClicked(modelData) - d.updateText(modelData.title) - } - function updateText(text){ - d.flagVisible = false - control.text = text - d.flagVisible = true + control.updateText(modelData.title) } function loadData(){ var result = [] @@ -136,4 +131,9 @@ FluTextBox{ control_popup.visible = true } } + function updateText(text){ + d.flagVisible = false + control.text = text + d.flagVisible = true + } }