return mXmlFile;
 }
 
+int App::exec()
+{
+    setReady(true);
+    int rval = QCoreApplication::exec();
+    setReady(false);
+    return rval;
+}
+
 void App::restart()
 {
     QCoreApplication::exit(RC_Restart);
 {
     QCoreApplication::exit(err ? RC_Error : RC_Quit);
 }
+
+void App::setReady(bool value)
+{
+    if (mReady != value) {
+        mReady = value;
+        iEventQueue::instance()->broadcastEvent(new Event(mReady ? mEvReady : mEvTerminating));
+        if (mReady)
+            emit ready();
+        else
+            emit terminating();
+    }
+}
 
 
     virtual QString const xmlFileName() const;
 
+    virtual int exec();
+
     virtual void restart();
 
     virtual void quit(bool err = false);
     virtual QString const qtPluginsDir() const;
 
 
-private:
+private: // Members
 
     /// Flag indicating that the eVaf application is ready
     bool mReady;
     uint mEvReady;
     uint mEvTerminating;
 
+
+private: // Methods
+
+    void setReady(bool value);
+
 };
 
 } // namespace eVaf::Common::Internal
 
      */
     virtual QString const xmlFileName() const = 0;
 
+    /**
+     * Enters the main event loop of the Qt application.
+     * @return Value returned by the Qt application
+     *
+     * This function enters the event loop of the Qt application. Use this function to start event handling
+     * instead of calling QCoreApplication::exec() or QApplication::exec() functions directly.
+     */
+    virtual int exec() = 0;
+
     /**
      * Requests the eVaf application to restart.
      *
 
 /**
  * Module/library version number in the form major,minor,release,build
  */
-#define VER_FILE_VERSION                0,1,3,6
+#define VER_FILE_VERSION                0,1,4,7
 
 /**
  * Module/library version number in the string format (shall end with \0)
  */
-#define VER_FILE_VERSION_STR            "0.1.3.6\0"
+#define VER_FILE_VERSION_STR            "0.1.4.7\0"
 
 /**
  * Module/library name (shall end with \0)
 
 
         // Run the application
         EVAF_INFO("Running %s", VER_MODULE_NAME_STR);
-        rval = app.exec();
+        rval = Common::iApp::instance()->exec();
 
         quit = rval != Common::iApp::RC_Restart;
 
 
 /**
  * Module/library version number in the form major,minor,release,build
  */
-#define VER_FILE_VERSION                0,1,1,2
+#define VER_FILE_VERSION                0,1,2,3
 
 /**
  * Module/library version number in the string format (shall end with \0)
  */
-#define VER_FILE_VERSION_STR            "0.1.1.2\0"
+#define VER_FILE_VERSION_STR            "0.1.2.3\0"
 
 /**
  * Module/library name (shall end with \0)
 
 
         // Run the application
         EVAF_INFO("Running %s", VER_MODULE_NAME_STR);
-        rval = app.exec();
+        rval = Common::iApp::instance()->exec();
 
         quit = rval != Common::iApp::RC_Restart;