From d8d4bfce0c18b87572e023f5f1dd2e763030a81c Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 25 Dec 2020 08:49:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9E=90=E6=9E=84=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/TaoQuickShow/Src/main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/TaoQuickShow/Src/main.cpp b/examples/TaoQuickShow/Src/main.cpp index 6cbd47f..69bfa3b 100644 --- a/examples/TaoQuickShow/Src/main.cpp +++ b/examples/TaoQuickShow/Src/main.cpp @@ -1,15 +1,15 @@ #include "AppInfo.h" -#include "Trans/Trans.h" +#include "DeviceAddTable/DeviceAddModel.h" #include "Frameless/TaoFrameLessView.h" #include "Logger/Logger.h" #include "QuickTool/QuickTool.h" -#include "DeviceAddTable/DeviceAddModel.h" +#include "Trans/Trans.h" #include #include #include #include -#include #include +#include static void prepareApp() { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -25,7 +25,7 @@ int main(int argc, char **argv) prepareApp(); QGuiApplication app(argc, argv); #ifdef TAODEBUG -// qSetMessagePattern("[%{time h:mm:ss.zzz} %{function}] %{message}"); + // qSetMessagePattern("[%{time h:mm:ss.zzz} %{function}] %{message}"); qSetMessagePattern("[%{time h:mm:ss.zzz} %{file} row(%{line}) %{function}] %{message}"); #else Logger::initLog(); @@ -33,13 +33,15 @@ int main(int argc, char **argv) const auto appPath = QDir::cleanPath(app.applicationDirPath()); qWarning() << "appPath" << appPath; + Trans trans; + AppInfo appInfo; + QuickTool quickTool; + TaoFrameLessView view; view.setMinimumSize({ 800, 600 }); view.resize(1440, 960); view.moveToScreenCenter(); - Trans trans; - AppInfo appInfo; - QuickTool quickTool; + trans.beforeUiReady(view.rootContext()); appInfo.beforeUiReady(view.rootContext()); @@ -77,7 +79,9 @@ int main(int argc, char **argv) quickTool.setRootObjet(view.rootObject()); } }); + //qml call 'Qt.quit()' will emit engine::quit, here should call qApp->quit QObject::connect(view.engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit); + view.setSource(url); view.moveToScreenCenter(); view.show();