Unsolved Does the qmake -project work?
-
@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_BeginnersYou cannot do it just in main.c, Qt is a C++ framework - you will need to write C++ code, C++ classes, ...
-
-
@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.
-
@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.
-
@Mark81 thanks for the clarification, I misread the post.
-
You seem to have your own event loop.
What exactly is that application supposed to do ?
-
@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.
-
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 ?
-
@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:
-
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.