From 1f1c93c28b30bf76a9b1d32ab3a123d29c4849bd Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 23 Jan 2015 23:18:32 +0000 Subject: [PATCH] Create window widget after the library is loaded. --- common/lc_application.cpp | 5 +++++ qt/qtmain.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/lc_application.cpp b/common/lc_application.cpp index ac31abb4..a425fe9a 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -11,6 +11,7 @@ #include "lc_mainwindow.h" #include "lc_shortcuts.h" #include "view.h" +#include "lc_qmainwindow.h" lcApplication* g_App; @@ -270,6 +271,8 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal } } + gMainWindow = new lcMainWindow(); + if (!LoadPiecesLibrary(LibPath, LibraryInstallPath, LDrawPath, LibraryCachePath)) { if (SaveImage || SaveWavefront) @@ -286,6 +289,8 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal "Please visit http://www.leocad.org for information on how to download and install a library.", LC_MB_OK | LC_MB_ICONERROR); } + gMainWindow->mHandle = new lcQMainWindow; + // Create a new project. Project* NewProject = new Project(); SetProject(NewProject); diff --git a/qt/qtmain.cpp b/qt/qtmain.cpp index fb3d53dd..3e5a9eab 100644 --- a/qt/qtmain.cpp +++ b/qt/qtmain.cpp @@ -175,18 +175,16 @@ int main(int argc, char *argv[]) QDir dir; dir.mkpath(cachePath); - gMainWindow = new lcMainWindow(); - lcQMainWindow w; - gMainWindow->mHandle = &w; if (!g_App->Initialize(argc, argv, libPath, LDrawPath, cachePath.toLocal8Bit().data())) return 1; - w.LibraryLoaded(); + lcQMainWindow* MainWindow = (lcQMainWindow*)gMainWindow->mHandle; + MainWindow->LibraryLoaded(); lcGetActiveModel()->UpdateInterface(); gMainWindow->SetColorIndex(lcGetColorIndex(4)); gMainWindow->UpdateRecentFiles(); - w.show(); + MainWindow->show(); #if !LC_DISABLE_UPDATE_CHECK lcDoInitialUpdateCheck(); @@ -199,6 +197,8 @@ int main(int argc, char *argv[]) delete g_App; g_App = NULL; + delete MainWindow; + return execReturn; }