Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QT project in Visual studio
I'm using QT plug-in with Visual studio to create a front end GUI for my C++ based application. I have integrated my dlls and external library files. Created a simple login form in QT designer and coded it to display the login parameters when the pushbutton is clicked (for testing purpose). The solution is build successfully with out any errors. However, the GUI doesn't appear while running. There is no error or warning but the GUI form is not visible.
It works when I remove my external libraries. But that doesn't help. Any suggestions or comments on why this happens? And how do I debug/ fix it?
@prajesw2 We're definitely going to need some more information to help on this.
If I understand correctly you have a preexisting visual c++ project that you want to add a Qt GUI to? I don't really understand this though. Is it a console application that you want to add a gui to? Is it a set of libraries you want to call with a Qt interface? I'm just not understanding at all.
Can I see your code to invoke the GUI? How are you building?
@ambershark : Yes I have a preexisting visual C++ project. I want to add QT GUI to accept input from users.
It is a console application which completely works fine in visual studio. But I included the necessary header files and imported the library files and dlls into my QT project in Visual studio.
int main(int argc, char *argv)
QApplication a(argc, argv);
msg.setText("main func is running");
QLineEdit *name = ui.lineEdit_name; QLineEdit *age = ui.lineEdit_age; QString t_name; QString t_age; t_name = name->text(); t_age = age->text(); int a = t_age.split("").toInt();
// creates object for class physiology engine
std::unique_ptr<PhysiologyEngine> bg = CreateBioGearsEngine("Engine.log");
// function call
Once I include "std::unique_ptr<PhysiologyEngine> bg = CreateBioGearsEngine("Engine.log");
// function call
HowToEngineUse(); " these lines in my function, the GUI does not show up. Please let me know if you further information. Thanks!!
attached a screenshot of the ui form that should show up..
@prajesw2 That's interesting... That shouldn't affect the GUI at all. What happens when you include those lines? The GUI just doesn't show up but does the application exit?
I'm wondering if you're not getting stuck in the create of the biogears engine and therefore Qt can't start it's event loop in the main
app.exec(). That would make the gui not show up.
And also what does HowToEngineUse() do?
You didn't include the screenshot but it's not necessary anyway. ;)
Yes totally.. I don't understand why the GUI doesn't appear. There are no build errors or warnings. The project is compiled successfully. I can see the process( .exe) is running in task manager. There is no error. Nothing happens in the window till I stop the debugger.
bg->GetLogger()->Info(...) line works. it actually updates log. I have this line commented for now.
HowToEngineUse() is a function that has series of instructions to advance time and stuff like that.
"I'm wondering if you're not getting stuck in the create of the biogears engine and therefore Qt can't start it's event loop in the main app.exec()." - Do you have any suggestions for debugging?