This commit is contained in:
朱子楚\zhuzi 2023-06-28 02:28:34 +08:00
parent 96071ac8d7
commit a7e8a5e4cf
10 changed files with 20 additions and 23 deletions

View File

@ -13,6 +13,10 @@ FluContentPage{
loadData(1,1000) loadData(1,1000)
} }
Component.onDestruction: {
console.debug("T_TableView已经销毁")
}
function loadData(page,count){ function loadData(page,count){
var numbers = [100, 300, 500, 1000]; var numbers = [100, 300, 500, 1000];
function getRandomAge() { function getRandomAge() {

View File

@ -25,8 +25,8 @@ int main(int argc, char *argv[])
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
#endif #endif
AppInfo* appInfo = new AppInfo(); AppInfo* appInfo = new AppInfo();

View File

@ -109,3 +109,8 @@ QJsonArray FluApp::awesomelist(const QString& keyword)
void FluApp::closeApp(){ void FluApp::closeApp(){
qApp->exit(0); qApp->exit(0);
} }
void FluApp::deleteWindow(QQuickWindow* window){
wnds.remove(window->winId());
window->deleteLater();
}

View File

@ -73,6 +73,8 @@ public:
*/ */
Q_INVOKABLE void closeApp(); Q_INVOKABLE void closeApp();
Q_INVOKABLE void deleteWindow(QQuickWindow* window);
public: public:
/** /**
* @brief wnds * @brief wnds

View File

@ -87,3 +87,7 @@ void FluTools::setOverrideCursor(Qt::CursorShape shape){
void FluTools::restoreOverrideCursor(){ void FluTools::restoreOverrideCursor(){
qApp->restoreOverrideCursor(); qApp->restoreOverrideCursor();
} }
void FluTools::deleteItem(QObject *p){
p->deleteLater();
}

View File

@ -58,6 +58,7 @@ public:
Q_INVOKABLE void restoreOverrideCursor(); Q_INVOKABLE void restoreOverrideCursor();
Q_INVOKABLE void deleteItem(QObject *p);
}; };
#endif // FLUTOOLS_H #endif // FLUTOOLS_H

View File

@ -1,7 +1,6 @@
#include "WindowHelper.h" #include "WindowHelper.h"
#include "FluRegister.h" #include "FluRegister.h"
#include "FluApp.h"
WindowHelper::WindowHelper(QObject *parent) WindowHelper::WindowHelper(QObject *parent)
: QObject{parent} : QObject{parent}
@ -19,10 +18,3 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
p->path(path); p->path(path);
return QVariant::fromValue(p); return QVariant::fromValue(p);
} }
void WindowHelper::deleteWindow(){
if(this->window){
FluApp::getInstance()->wnds.remove(this->window->winId());
this->window->deleteLater();
}
}

View File

@ -24,11 +24,6 @@ public:
*/ */
Q_INVOKABLE void initWindow(QQuickWindow* window); Q_INVOKABLE void initWindow(QQuickWindow* window);
/**
* @brief deleteWindow QML中的Window close并不会销毁窗口
*/
Q_INVOKABLE void deleteWindow();
/** /**
* @brief createRegister FluRegsiter对象FluWindow中registerForWindowResult方法调用 * @brief createRegister FluRegsiter对象FluWindow中registerForWindowResult方法调用
* @param window * @param window

View File

@ -31,7 +31,6 @@ Item {
id:control id:control
QtObject{ QtObject{
id:d id:d
property var pageMap: ({})
property var stackItems: [] property var stackItems: []
property int displayMode: FluNavigationView.Open property int displayMode: FluNavigationView.Open
property bool enableNavigationPanel: false property bool enableNavigationPanel: false
@ -519,7 +518,7 @@ Item {
disabled: nav_swipe.depth <= 1 disabled: nav_swipe.depth <= 1
iconSize: 13 iconSize: 13
onClicked: { onClicked: {
nav_swipe.pop() FluTools.deleteItem(nav_swipe.pop())
d.stackItems.pop() d.stackItems.pop()
var item = d.stackItems[d.stackItems.length-1] var item = d.stackItems[d.stackItems.length-1]
if(item.idx<(nav_list.count - layout_footer.count)){ if(item.idx<(nav_list.count - layout_footer.count)){
@ -997,7 +996,7 @@ Item {
case FluNavigationView.SingleTask: case FluNavigationView.SingleTask:
while(nav_swipe.currentItem !== page) while(nav_swipe.currentItem !== page)
{ {
nav_swipe.pop() FluTools.deleteItem(nav_swipe.pop())
d.stackItems.pop() d.stackItems.pop()
} }
return return

View File

@ -44,11 +44,6 @@ Window {
id: bg id: bg
anchors.fill: parent anchors.fill: parent
color: backgroundColor color: backgroundColor
Behavior on color{
ColorAnimation {
duration: 300
}
}
} }
Item{ Item{
id:container id:container
@ -78,7 +73,7 @@ Window {
return helper.createRegister(window,path) return helper.createRegister(window,path)
} }
function deleteWindow(){ function deleteWindow(){
helper.deleteWindow() FluApp.deleteWindow(window)
} }
function onResult(data){ function onResult(data){
if(pageRegister){ if(pageRegister){