Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Converting a desktop application with a GUI to a console application
Forum Updated to NodeBB v4.3 + New Features

Converting a desktop application with a GUI to a console application

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.1k 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.
  • D Offline
    D Offline
    d.oberkofler
    wrote on last edited by
    #1

    This might sound a little strange but I'll try nevertheless.
    Imagine a large GUI desktop application build using Qt and now you would want to have parts of the application to be run as a console application or even as a service on windows.
    Clearly the application can be "reconfigured" (eliminate all GUI ) in the source code using the precompiler but I was wondering if there are any best practices on how to solve this ?
    Thank you in advance.

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

      Hello,

      Not aware of best practices but looking nearly to the same case.

      How do you plan to communicate betwen background and 'missing' GUI ?

      Using Signal and Process or by threading ?

      Cheers,
      Skylar

      In most cases, the bug is mine. But of the remaining lines are correct.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        d.oberkofler
        wrote on last edited by
        #3

        In our case the communication would be all database based.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          miroslav
          wrote on last edited by
          #4

          A few notes:

          If the business logic and the user interface of your application is separated (as it should be :-) ), try building a command line application that links the logic part.

          You can then try to abstract the user operations so that they can be triggered from code. Your UIs (command line and GUI) should trigger the same operations through different ways.

          If your code uses event-driven logic (like asynchronous networking or timers), instantiate a QCoreApplication, start it's event loop, and execute the operations in a slot triggered from main().

          Mirko Boehm | mirko@kde.org | KDE e.V.
          FSFE Fellow
          Qt Certified Specialist

          1 Reply Last reply
          0
          • D Offline
            D Offline
            d.oberkofler
            wrote on last edited by
            #5

            I complete agree in that a perfect separation of business logic an user interface should make this quite simple but unfortunately this is not the case with "this" application. :-(
            We have gone a different path and simply created a new path that prevents any user interaction to actually stop the application and wait for user input.
            This is not perfect but (at least in our case) solves the problem of running the application in batch mode.

            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