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; }