from C code? you can't really - except by calling C++ code.
I see two ways to go:
i) make main.c into a main.cpp (should be no problem, right?)
ii) call from main.c setupAndRunGui()
where
// gui.h
extern "C" int setupAndRunGui();
// gui.cpp
int setupAndRunGui(int &argc, char **argv)
{
// whatever else you need to setup
return app.exec(); // note that this is a blocking call
}
// gui.h
extern "C" int setupAndRunGui();
// gui.cpp
int setupAndRunGui(int &argc, char **argv)
{
QApplication app(argc, argv);
// whatever else you need to setup
return app.exec(); // note that this is a blocking call
}
To copy to clipboard, switch view to plain text mode
iii) I would suggest you create a "normal" Qt app.
* a C++ main that creates a QApplication object
* create a QThread that does your C event polling/handling
* send Qt custom events for that events from your C code (if the gui needs to act upon those)
HTH
Bookmarks