Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QtService -or- how to run QCoreApplication as a service?
Forum Updated to NodeBB v4.3 + New Features

QtService -or- how to run QCoreApplication as a service?

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 13.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    syfy323
    wrote on last edited by
    #1

    Hello,

    my console application should be run as a service. The executable is registered as a service by the WiX Toolset which works fine. When starting the service, I get an error that it took too long to start. This is expected behaviour but how do I implement this right in Qt 5.2.1?

    For 4.x there was "QtService"which is now part of Qt-Solutions.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      syfy323
      wrote on last edited by
      #2

      I thought Qt-Solutions is just for 4.x but it also works with Qt 5.2.1.
      I successfully made my app start via service. I am not sure if it works right but the service started successfully.

      For all who are looking for the same:

      Download:
      https://qt.gitorious.org/qt-solutions/qt-solutions/

      Unpack the archive. Copy the qtservice dir under a folder named libs (for example) inside the own project.

      Add this line to .pro:
      @include(libs/external/qtservice/src/qtservice.pri)@

      Create a new "Service" Class. I named mine "AgentService".
      @#ifndef AGENTSERVICE_H
      #define AGENTSERVICE_H

      #include <QApplication>
      #include <qtservice.h>

      class AgentService : public QtService<QApplication>
      {
      public:
      AgentService(int argc, char **argv);
      //~AgentService();

      protected:
      void start();
      void stop();
      void pause();
      void resume();
      void processCommand(int code);
      };

      #endif // AGENTSERVICE_H
      @

      After this, follow the docs inside the lib examples:
      qt-solutions-qt-solutions/qtservice/doc/html/qtservice-example-interactive.html

      Maybe helpful when experimenting:
      http://qt-project.org/forums/viewthread/13968

      1 Reply Last reply
      0
      • N Offline
        N Offline
        najihahnizar
        wrote on last edited by
        #3

        how you connect your app with qt service?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved