mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
d6c0492665
commit
07fedb43a8
@ -214,15 +214,15 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
reply->abort();
|
reply->abort();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
QMetaObject::Connection conn_destoryed = {};
|
QMetaObject::Connection conn_destroyed = {};
|
||||||
QMetaObject::Connection conn_quit = {};
|
QMetaObject::Connection conn_quit = {};
|
||||||
if(params->_target){
|
if(params->_target){
|
||||||
conn_destoryed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
|
conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
|
||||||
}
|
}
|
||||||
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
|
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
|
||||||
loop.exec();
|
loop.exec();
|
||||||
if(conn_destoryed){
|
if(conn_destroyed){
|
||||||
disconnect(conn_destoryed);
|
disconnect(conn_destroyed);
|
||||||
}
|
}
|
||||||
if(conn_quit){
|
if(conn_quit){
|
||||||
disconnect(conn_quit);
|
disconnect(conn_quit);
|
||||||
@ -336,10 +336,10 @@ void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
};
|
};
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
QMetaObject::Connection conn_destoryed = {};
|
QMetaObject::Connection conn_destroyed = {};
|
||||||
QMetaObject::Connection conn_quit = {};
|
QMetaObject::Connection conn_quit = {};
|
||||||
if(params->_target){
|
if(params->_target){
|
||||||
conn_destoryed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
|
conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
|
||||||
}
|
}
|
||||||
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
|
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
|
||||||
connect(reply,&QNetworkReply::readyRead,reply,[reply,seek,destFile,cacheFile,callable]{
|
connect(reply,&QNetworkReply::readyRead,reply,[reply,seek,destFile,cacheFile,callable]{
|
||||||
@ -377,8 +377,8 @@ void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
}
|
}
|
||||||
printRequestEndLog(request,params,reply,destPath);
|
printRequestEndLog(request,params,reply,destPath);
|
||||||
}
|
}
|
||||||
if(conn_destoryed){
|
if(conn_destroyed){
|
||||||
disconnect(conn_destoryed);
|
disconnect(conn_destroyed);
|
||||||
}
|
}
|
||||||
if(conn_quit){
|
if(conn_quit){
|
||||||
disconnect(conn_quit);
|
disconnect(conn_quit);
|
||||||
|
@ -13,7 +13,7 @@ void FluWindowLifecycle::onCompleted(QQuickWindow* window){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluWindowLifecycle::onDestoryOnClose(){
|
void FluWindowLifecycle::onDestroyOnClose(){
|
||||||
if(_window && _window->transientParent() == nullptr){
|
if(_window && _window->transientParent() == nullptr){
|
||||||
FluApp::getInstance()->removeWindow(_window);
|
FluApp::getInstance()->removeWindow(_window);
|
||||||
_window = nullptr;
|
_window = nullptr;
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
Q_INVOKABLE void onCompleted(QQuickWindow* window);
|
Q_INVOKABLE void onCompleted(QQuickWindow* window);
|
||||||
Q_INVOKABLE void onDestruction();
|
Q_INVOKABLE void onDestruction();
|
||||||
Q_INVOKABLE void onVisible(bool visible);
|
Q_INVOKABLE void onVisible(bool visible);
|
||||||
Q_INVOKABLE void onDestoryOnClose();
|
Q_INVOKABLE void onDestroyOnClose();
|
||||||
private:
|
private:
|
||||||
QQuickWindow* _window = nullptr;
|
QQuickWindow* _window = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ Window {
|
|||||||
property bool autoMaximize: false
|
property bool autoMaximize: false
|
||||||
property bool autoVisible: true
|
property bool autoVisible: true
|
||||||
property bool autoCenter: true
|
property bool autoCenter: true
|
||||||
property bool autoDestory: true
|
property bool autoDestroy: true
|
||||||
property bool useSystemAppBar
|
property bool useSystemAppBar
|
||||||
property color resizeBorderColor: {
|
property color resizeBorderColor: {
|
||||||
if(window.active){
|
if(window.active){
|
||||||
@ -49,8 +49,8 @@ Window {
|
|||||||
}
|
}
|
||||||
property int resizeBorderWidth: 1
|
property int resizeBorderWidth: 1
|
||||||
property var closeListener: function(event){
|
property var closeListener: function(event){
|
||||||
if(autoDestory){
|
if(autoDestroy){
|
||||||
destoryOnClose()
|
destroyOnClose()
|
||||||
}else{
|
}else{
|
||||||
window.visibility = Window.Hidden
|
window.visibility = Window.Hidden
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
@ -263,8 +263,8 @@ Window {
|
|||||||
return com_border
|
return com_border
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function destoryOnClose(){
|
function destroyOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestroyOnClose()
|
||||||
}
|
}
|
||||||
function showLoading(text = qsTr("Loading..."),cancel = true){
|
function showLoading(text = qsTr("Loading..."),cancel = true){
|
||||||
loader_loading.loadingText = text
|
loader_loading.loadingText = text
|
||||||
|
@ -9,12 +9,12 @@ FluWindow {
|
|||||||
property Component contentDelegate
|
property Component contentDelegate
|
||||||
autoVisible: false
|
autoVisible: false
|
||||||
autoCenter: false
|
autoCenter: false
|
||||||
autoDestory: true
|
autoDestroy: true
|
||||||
fixSize: true
|
fixSize: true
|
||||||
Loader{
|
Loader{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(control.autoDestory){
|
if(control.autoDestroy){
|
||||||
return control.visible ? control.contentDelegate : undefined
|
return control.visible ? control.contentDelegate : undefined
|
||||||
}
|
}
|
||||||
return control.contentDelegate
|
return control.contentDelegate
|
||||||
|
@ -38,7 +38,7 @@ Window {
|
|||||||
property bool autoMaximize: false
|
property bool autoMaximize: false
|
||||||
property bool autoVisible: true
|
property bool autoVisible: true
|
||||||
property bool autoCenter: true
|
property bool autoCenter: true
|
||||||
property bool autoDestory: true
|
property bool autoDestroy: true
|
||||||
property bool useSystemAppBar
|
property bool useSystemAppBar
|
||||||
property color resizeBorderColor: {
|
property color resizeBorderColor: {
|
||||||
if(window.active){
|
if(window.active){
|
||||||
@ -48,8 +48,8 @@ Window {
|
|||||||
}
|
}
|
||||||
property int resizeBorderWidth: 1
|
property int resizeBorderWidth: 1
|
||||||
property var closeListener: function(event){
|
property var closeListener: function(event){
|
||||||
if(autoDestory){
|
if(autoDestroy){
|
||||||
destoryOnClose()
|
destroyOnClose()
|
||||||
}else{
|
}else{
|
||||||
window.visibility = Window.Hidden
|
window.visibility = Window.Hidden
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
@ -262,8 +262,8 @@ Window {
|
|||||||
return com_border
|
return com_border
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function destoryOnClose(){
|
function destroyOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestroyOnClose()
|
||||||
}
|
}
|
||||||
function showLoading(text = qsTr("Loading..."),cancel = true){
|
function showLoading(text = qsTr("Loading..."),cancel = true){
|
||||||
loader_loading.loadingText = text
|
loader_loading.loadingText = text
|
||||||
|
@ -9,12 +9,12 @@ FluWindow {
|
|||||||
property Component contentDelegate
|
property Component contentDelegate
|
||||||
autoVisible: false
|
autoVisible: false
|
||||||
autoCenter: false
|
autoCenter: false
|
||||||
autoDestory: true
|
autoDestroy: true
|
||||||
fixSize: true
|
fixSize: true
|
||||||
Loader{
|
Loader{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(control.autoDestory){
|
if(control.autoDestroy){
|
||||||
return control.visible ? control.contentDelegate : undefined
|
return control.visible ? control.contentDelegate : undefined
|
||||||
}
|
}
|
||||||
return control.contentDelegate
|
return control.contentDelegate
|
||||||
|
Loading…
Reference in New Issue
Block a user