Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Does the qmake -project work?

Does the qmake -project work?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
13 Posts 4 Posters 3.6k Views
  • 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    I have a quite large Makefile project (console) that compiles within MSYS2.
    I imported it into QtCreator and managed to compile it with mingw32 5.3.0.

    Because now I want to extend it with some Qt features I run the following in the root of the repository:

    qmake -project -nopwd path/to/the/Makefile
    

    It created a *.pro file, but opening it as a project doesn't compile anymore!
    Here the documentation:

    http://doc.qt.io/qt-5.8/qmake-running.html#project-mode-options

    I was thinking it should handle the existing Makefile correctly, in order to continue the development using qmake. Am I wrong?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I may be wrong but I don't think that qmake parses the Makefile in order create the .pro file.

      From a first step, I'd just run qmake -project in the root of your project.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        I may be wrong but I don't think that qmake parses the Makefile in order create the .pro file.

        From a first step, I'd just run qmake -project in the root of your project.

        M Offline
        M Offline
        Mark81
        wrote on last edited by
        #3

        @SGaist said in Does the qmake -project work?:

        From a first step, I'd just run qmake -project in the root of your project.

        Done! It just added all sources and headers files found in each subfolder.
        Perhaps this is not the best approach.

        My goal is to use Qt features (Q_OBJECT, signals, slots...) in the main.c:

        https://github.com/bluekitchen/btstack/blob/develop/port/windows-winusb/main.c

        What's the right way to do this?

        jsulmJ J.HilkJ 2 Replies Last reply
        0
        • M Mark81

          @SGaist said in Does the qmake -project work?:

          From a first step, I'd just run qmake -project in the root of your project.

          Done! It just added all sources and headers files found in each subfolder.
          Perhaps this is not the best approach.

          My goal is to use Qt features (Q_OBJECT, signals, slots...) in the main.c:

          https://github.com/bluekitchen/btstack/blob/develop/port/windows-winusb/main.c

          What's the right way to do this?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Mark81 Well, use Qt features. Read Qt documentation, take a look at examples.
          http://doc.qt.io/qt-5/qtexamplesandtutorials.html
          http://doc.qt.io/qt-5.8/signalsandslots.html
          https://wiki.qt.io/Qt_for_Beginners

          You cannot do it just in main.c, Qt is a C++ framework - you will need to write C++ code, C++ classes, ...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • M Mark81

            @SGaist said in Does the qmake -project work?:

            From a first step, I'd just run qmake -project in the root of your project.

            Done! It just added all sources and headers files found in each subfolder.
            Perhaps this is not the best approach.

            My goal is to use Qt features (Q_OBJECT, signals, slots...) in the main.c:

            https://github.com/bluekitchen/btstack/blob/develop/port/windows-winusb/main.c

            What's the right way to do this?

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #5

            @Mark81 to add to @jsulm , you can force the issue, using connect in main.cpp, if you really want/have to with this:

            e.g:

            QPushButton *btnExit = new QPushButton();
            QObject::connect(btnExit,SIGNAL(clicked()),qApp,SLOT(quit()));
            

            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            M 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Mark81 Well, use Qt features. Read Qt documentation, take a look at examples.
              http://doc.qt.io/qt-5/qtexamplesandtutorials.html
              http://doc.qt.io/qt-5.8/signalsandslots.html
              https://wiki.qt.io/Qt_for_Beginners

              You cannot do it just in main.c, Qt is a C++ framework - you will need to write C++ code, C++ classes, ...

              M Offline
              M Offline
              Mark81
              wrote on last edited by
              #6

              @jsulm Thanks for the links. I'm not new to Qt... I'm not an expert developer but I use this framework since Qt3. My question is exactly how to "migrate" from an existing Makefile C project to a Qt one.

              Of course I need to write C++ code and classes. It's exactly what I want! But I need to maintain the functionality of the underlying C project - i.e. calling its functions inside slots.

              1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                @Mark81 to add to @jsulm , you can force the issue, using connect in main.cpp, if you really want/have to with this:

                e.g:

                QPushButton *btnExit = new QPushButton();
                QObject::connect(btnExit,SIGNAL(clicked()),qApp,SLOT(quit()));
                
                M Offline
                M Offline
                Mark81
                wrote on last edited by
                #7

                @J.Hilk said in Does the qmake -project work?:

                @Mark81 to add to @jsulm , you can force the issue, using connect in main.cpp, if you really want/have to with this:

                e.g:

                QPushButton *btnExit = new QPushButton();
                QObject::connect(btnExit,SIGNAL(clicked()),qApp,SLOT(quit()));
                

                I understand it, but as @jsulm said, this is a C project, while I'm trying to embed into a C++ one.

                A different approach would be creating a new Qt console project and add all the repository files, but the main.c - replaced from my main.cpp. I'm asking help how to do this.

                J.HilkJ 1 Reply Last reply
                0
                • M Mark81

                  @J.Hilk said in Does the qmake -project work?:

                  @Mark81 to add to @jsulm , you can force the issue, using connect in main.cpp, if you really want/have to with this:

                  e.g:

                  QPushButton *btnExit = new QPushButton();
                  QObject::connect(btnExit,SIGNAL(clicked()),qApp,SLOT(quit()));
                  

                  I understand it, but as @jsulm said, this is a C project, while I'm trying to embed into a C++ one.

                  A different approach would be creating a new Qt console project and add all the repository files, but the main.c - replaced from my main.cpp. I'm asking help how to do this.

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @Mark81 thanks for the clarification, I misread the post.


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    You seem to have your own event loop.

                    What exactly is that application supposed to do ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      You seem to have your own event loop.

                      What exactly is that application supposed to do ?

                      M Offline
                      M Offline
                      Mark81
                      wrote on last edited by Mark81
                      #10

                      @SGaist said in Does the qmake -project work?:

                      What exactly is that application supposed to do ?

                      Sorry, are you talking about my application or the existing one?

                      The latter, the github one, is a Bluetooth stack. The actual main loop is just an example to be extended for own applications. For this reason I would embed that code into my Qt project.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Then one way is to create a wrapper object that handles what your main.c does. Then it will make things easier to integrate with your application.

                        Does your stack have its own event loop ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        M 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Then one way is to create a wrapper object that handles what your main.c does. Then it will make things easier to integrate with your application.

                          Does your stack have its own event loop ?

                          M Offline
                          M Offline
                          Mark81
                          wrote on last edited by
                          #12

                          @SGaist said in Does the qmake -project work?:

                          Then one way is to create a wrapper object that handles what your main.c does. Then it will make things easier to integrate with your application.

                          Is there somewhere a minimal example how to do this? I'm afraid how to handle both C and C++ code in the same project.

                          Does your stack have its own event loop ?

                          Yes:

                          http://bluekitchen-gmbh.com/btstack/architecture/

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Well, using Qt you're already doing that. A great part of Qt is dealing with lower-level C interfaces.

                            As for API design, this old Qt Quarterly article is pretty good.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            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