changeset 17804:f3e25230b1f3

use QCoreApplication if starting with --no-gui * octave-gui.cc (octave_start_gui): Use QApplication when starting the GUI and QCoreApplication if not. (octave_cli_thread::run): Call QCoreApplication::exit instead of QApplication::exit.
author John W. Eaton <jwe@octave.org>
date Wed, 30 Oct 2013 02:08:41 -0400
parents f5ada8597078
children 2a15970da7f0
files libgui/src/octave-gui.cc
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc	Wed Oct 30 00:34:14 2013 -0400
+++ b/libgui/src/octave-gui.cc	Wed Oct 30 02:08:41 2013 -0400
@@ -25,6 +25,7 @@
 #endif
 
 #include <QApplication>
+#include <QCoreApplication>
 #include <QTextCodec>
 #include <QThread>
 #include <QTranslator>
@@ -72,7 +73,7 @@
 
     m_result = octave_execute_interpreter ();
 
-    QApplication::exit (m_result);
+    QCoreApplication::exit (m_result);
   }
 
 private:
@@ -119,10 +120,10 @@
 {
   qInstallMsgHandler (message_handler);
 
-  QApplication application (argc, argv);
-
   if (start_gui)
     {
+      QApplication application (argc, argv);
+
       // Set the codec for all strings
       QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("UTF-8"));
 
@@ -175,9 +176,9 @@
     }
   else
     {
-      octave_cli_thread main_thread (argc, argv);
+      QCoreApplication application (argc, argv);
 
-      application.setQuitOnLastWindowClosed (false);
+      octave_cli_thread main_thread (argc, argv);
 
       main_thread.start ();