Home > other >  Qt write DLL, calling the DLL interface on Qt main interface, run at QEventLoop: always be 2 without
Qt write DLL, calling the DLL interface on Qt main interface, run at QEventLoop: always be 2 without

Time:09-24

It two or three days have been tormented by the question that what a great god save me, recently had a Qt project, write a serial port driver DLL, interface is another person to do, so I hope I can provide the interface function, let him drive up, so I wrote in the DLL comm classes dedicated to a serial port communication, inherit from QObject, then has written a class driver, also inherit from QObject, the driver new a QThread in the constructor, then the comm movetothread an object of the class to the new thread, let him run in the thread, finally made an interface function that is new to a driver class object, the interface problems at the call I made it myself a Qt Gui program to invoke the interface, tip QEventLoop: always be 2 without QApplication, so I in the interface function and add the QApplication exec, such drive up normally, but was in a Gui program QApplication and exec, so if the interface on the picture show the former, picture, will not display on the interface after the show, the picture has been closed, process does not exit, all sorts of headache!

CodePudding user response:

I also is written in Qt DLL, QEventLoop DLL function call is: always be 2 without QApplication, have you solved?
  • Related