Embedding Qt in SWT (win32)
-
I am trying to embed Qt widgets into SWT. Basically, from a Qt standpoint this should be an integration into regular Win32 app. I checked the designer plug-in sources and it looks like it relies on ActiveX and it looks like an overkill for my case.
I base my code on "Qt/MFC Migration Framework":http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate/
My first goal is opening a window with a button (just a proof of concept). Code is:
@ QMfcApp::pluginInstance();
QPushButton* hello = new QPushButton("Hello world!");
hello->resize(100, 130);
hello->move(30, 30);
hello->show();@It runs just fine and opens non-modal dialog with a button. But the problem is that it crashes when any event is sent to a Qt app (i.e. I hover over it, click, resize, etc). This is what Java reports:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x2a5a31e8, pid=22020, tid=20356
JRE version: 6.0_18-b07
Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode windows-x86 )
Problematic frame:
C [QtGuid4.dll+0x131e8]From stack traces I see that the message goes to Qt. I understand that there's some object that I should create - but I can't understand what the object is.
-
You're a brave man. You're trying to run Qt inside Java/SWT if I understand you correctly - or is this using "Jambi":http://doc.qt.nokia.com/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-index.html?
Typically any of these integrations Qt<->ActiveX, Qt<->Motif, Qt<->MFC are very tricky to implement.
If you can embedd an ActiveX control in your SWT program, I'd very much consider using the existing ActiveX support in Qt rather than writing your own Qt<->SWT integration from scratch.
-
[quote author="snowpong" date="1284454470"]If you can embedd an ActiveX control in your SWT program, I'd very much consider using the existing ActiveX support in Qt rather than writing your own Qt<->SWT integration from scratch.[/quote]
I am not using Jambi as I don't see an easy way to integrate it into win32 app - and my task does not require anything complex that would justify creating Jambi integration.
I thought I would be able to avoid learning the whole ActiveX stuff...
So, I create a plug-in DLL. I have a parent HWND and I have no control over the windows event queue. QMfcApp seems to work well as the events go to Qt libraries. It looks like I messed up somewhere in Qt land...
-
I created a new "forum topic":http://developer.qt.nokia.com/forums/viewthread/1105/ that has link to published sources.