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. Qt Quick Application to C
Forum Updated to NodeBB v4.3 + New Features

Qt Quick Application to C

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 301 Views 2 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.
  • J Offline
    J Offline
    jabille
    wrote on last edited by
    #1

    Hi, I've started working with Qt & C++ in like 2 weeks. I created a simple app that shows a window with a button.
    Is it possible to somehow export it as a .dll or .so and use it in a C project?
    The goal is to show a UI in C. This project is deployed in an unattended terminal and the GUI will be shown there.

    Pl45m4P 1 Reply Last reply
    0
    • J jabille

      Hi, I've started working with Qt & C++ in like 2 weeks. I created a simple app that shows a window with a button.
      Is it possible to somehow export it as a .dll or .so and use it in a C project?
      The goal is to show a UI in C. This project is deployed in an unattended terminal and the GUI will be shown there.

      Pl45m4P Online
      Pl45m4P Online
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @jabille said in Qt Quick Application to C:

      Is it possible to somehow export it as a .dll or .so and use it in a C project?

      Yes, for the first part. Simply build a shared library.
      The second part doesn't work just like this...you can call some exported "extern" Qt C++ functions from C, but I don't think you are able to run the whole Qt GUI app from a C program.

      To call a single function in your Qt C++ app from C, see this topic.
      As @VRonin mentions there, you can't call a class function from C, because C doesn't know classes...

      The goal is to show a UI in C.

      Why not use proper C GUI Frameworks like GTK+?

      And the title even says "Qt Quick"... I doubt you can run your QML GUI from your plain C program.

      This project is deployed in an unattended terminal and the GUI will be shown there.

      Moving to a C/C++ compiler is no option?! What is your hardware? Wouldn't it be better to move to a C++ compiler and program?! Either that, or use GTK+ like mentioned above.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      J 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @jabille said in Qt Quick Application to C:

        Is it possible to somehow export it as a .dll or .so and use it in a C project?

        Yes, for the first part. Simply build a shared library.
        The second part doesn't work just like this...you can call some exported "extern" Qt C++ functions from C, but I don't think you are able to run the whole Qt GUI app from a C program.

        To call a single function in your Qt C++ app from C, see this topic.
        As @VRonin mentions there, you can't call a class function from C, because C doesn't know classes...

        The goal is to show a UI in C.

        Why not use proper C GUI Frameworks like GTK+?

        And the title even says "Qt Quick"... I doubt you can run your QML GUI from your plain C program.

        This project is deployed in an unattended terminal and the GUI will be shown there.

        Moving to a C/C++ compiler is no option?! What is your hardware? Wouldn't it be better to move to a C++ compiler and program?! Either that, or use GTK+ like mentioned above.

        J Offline
        J Offline
        jabille
        wrote on last edited by
        #3

        @Pl45m4 Thank you so much for your response.
        We've went ahead with using Qt C++ and calling C functions. I am currently developing an app for a linux device.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ankou29666
          wrote on last edited by
          #4

          That's how the OBS project is written : plain C core with C++/Qt UI. so yes it's possible.

          1 Reply Last reply
          0
          • J jabille has marked this topic as solved on

          • Login

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