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. [SOLVED] Handling COM event Qt/C++
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Handling COM event Qt/C++

Scheduled Pinned Locked Moved General and Desktop
22 Posts 4 Posters 12.9k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    anagelcg
    wrote on last edited by
    #21

    I didn't try connecting to Event for Excel but for Word and I found out that I could only connect to Events which have no parameters like 'DocumentChange()'. I use the tool 'dumpcpp.exe' from ActiveQt and generated wrapper classes for Word, but handling events was only possible via the generic signal
    @signal(QString,int,void*)@

    I don't know why it didn't work but there are different Event signatures.

    I want to show an example:

    First of all, I connect to the generic signal 'signal(QString,int,void*)' to handle all event. In the first param (QString), you find the name of the event with full signature. In case of word, there is e.g. an event called

    @DocumentBeforeClose(IDispatch*,bool&)@

    If i directly connect to that signal...

    @connect(word, SIGNAL(DocumentBeforeClose(IDispatch*,bool&)), this, SLOT(onDocumentBeforeClose(IDispatch*,bool&)));@

    ...I get a message:

    Object::connect: No such signal Word::Application::DocumentBeforeClose(IDispatch*,bool&)

    I studied the generated code of the word wrapper classes and I found in the metadata string, that the signature is:

    @DocumentBeforeClose(Document*,bool&)@

    The same signature is printed out if I use the code from Maxbester to show all signals. If I connect to this event, there is no output on console (no error message) so I thought this is the correct event, but my slot is never called (it has no parameter just to make sure that there are no problems due to paramter conversion, etc)

    @connect(word, SIGNAL(DocumentBeforeClose(Document*,bool&)), this, SLOT(onDocumentBeforeClose()));@

    By the way, all word events are fired 2 to 4 times (http://qt-project.org/forums/viewthread/38109), so I think there are either bugs in ActiveQt event handling or there is a trick how to do it?!?!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Maxbester
      wrote on last edited by
      #22

      There may be some bugs indeed.

      In the .pro file I added:

      @TYPELIBS = $$system( dumpcpp lib/MyLib.tlb -n MyNameSpace -o src/MyActiveXClass )@

      Note that the -o is important. It was missing in my first tries. This option writes the class declaration to MyActiveXClass.h and meta object infomation to MyActiveXClass.cpp.

      Maybe it will help you.

      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