PDA

View Full Version : is there any way to call / start Qtwidget from win32 application ?



umen
4th May 2011, 13:31
sorry if i duplicate threads
is there any way to start Qtwidget window from win32 native gui application
of from simple win32 c++ application ?

high_flyer
4th May 2011, 14:11
Unless you really understand your win32 gui event loop, and Qt event loop, don't go on that path.
Theoretically, you need to link against QtGui.dll, construct a QApplication instance, and call exec() on it - otherwise you wont have any Qt event handing.
If and how this will play nicely with any other event loops and GUI events in your application is a hard to say, and is very specific to the application it self.
As I said, don't go there, there be dragons.
It will probably be easier to port the win32 application to Qt.

umen
4th May 2011, 14:38
to port to Qt its not an option at all . its legacy code .. allot of code.
what option do i have beside this ? basically i need to open QMainWindow with QWebkit inside of it .
then be able to get string back into my win32 application when the QMainWindow done its job .

stampede
4th May 2011, 14:44
You can always create separate Qt-based app to do the specific task and implement communication between those two applications ( sockets, window messages, ... etc )

umen
4th May 2011, 15:12
you mean inner process communication between the process ?

stampede
4th May 2011, 15:37
Yes, just open the second app as separate process and write/read to/from it - how to do that is up to you. If you need only to start the Qt-webkit window and get a single string when it's finished, I'd probably use simple stdin/out communication (I mean output this string with std::cout or printf, and catch it in your main app). You can use win32 window messages with Qt widgets as well, so use them if you prefer communicating this way. Or use sockets. Or files...
If porting the app to Qt is not an option, I'd prefer to do this like that, because I agree with high_flyer's previous post.