Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Get the instance of QApplication or QCoreApplication inside dll qt 4.8
I have my QApplication created inside main() in QthreadTest project. From this project i have called the function inside library felix2.lib which is dynamically build.
Inside felix2 , i need to have QApplication or QCoreApplication to connect to ODBC drivers. i tried using
QCoreApplication *app1 = QApplication::instance(); which is returning NULL.
int main(int argc, char *argv)
int i =0;
QApplication a(argc, argv);
analyze("Prompted");// function inside lib
Please help me with how to get the instance of Qapplication that is already defined in main.cpp inside the lib
i tried like this
QCoreApplication *app1 = qApp->instance(); inside the library but the app1 is NULL , is there any other methods to get the instance.
@meganathan Why do you call instance on it?
If you read documentation you will notice that qApp already gives you pointer to QApplication instance.
@jsulm i used that to confirm whether qApp holds any instance or not.
qApp is the pointer to the instance.