Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Embedding Qt in SWT (win32)
Forum Update on Monday, May 27th 2025

Embedding Qt in SWT (win32)

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 6.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zzhou
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      snowpong
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zzhou
        wrote on last edited by
        #3

        [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...

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          zzhou
          wrote on last edited by
          #4

          Now it is working. I guess the sources will be published at some later point (once they are made prettier) and I will give link here.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            snowpong
            wrote on last edited by
            #5

            OK - sounds interresting, keep us posted :)

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zzhou
              wrote on last edited by
              #6

              I created a new "forum topic":http://developer.qt.nokia.com/forums/viewthread/1105/ that has link to published sources.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved