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. Whether we can use COM or ActiveX only in main thread(GUI thread)?
QtWS25 Last Chance

Whether we can use COM or ActiveX only in main thread(GUI thread)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qaxobjectcom
5 Posts 2 Posters 1.7k 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.
  • M Offline
    M Offline
    MartinChan
    wrote on 15 Aug 2016, 09:05 last edited by
    #1

    Hi,

    This is an interesting question. I used to created a topic about how to create a QModbusClient Class correctly.And finally get rid of those fault error information when I didn't create a intialized QModbusClient Object in my subclass(which I move it to an sub-thread).

    These two days I use a COM to read back a powermeter value,the similar happened again.When I created a QAxObject Object in a user-defined class,it shows some mistakes("Make sure 'QVariant&' is registered using qRegisterMetaType",I searched it and some people said it is related to multi-threads),however,when I created it in mainwindow or any qt designer classs,the error code disappears.

    So here is the question:whether we can only use COM or activex in a GUI thread??If not,what should I pay attention to?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 15 Aug 2016, 09:26 last edited by
      #2

      @MartinChan said:

      QAxObject

      When you say
      user defined class
      is that a QObject subclass?

      M 1 Reply Last reply 15 Aug 2016, 09:34
      0
      • M mrjj
        15 Aug 2016, 09:26

        @MartinChan said:

        QAxObject

        When you say
        user defined class
        is that a QObject subclass?

        M Offline
        M Offline
        MartinChan
        wrote on 15 Aug 2016, 09:34 last edited by
        #3

        @mrjj Yes...Is that having some conflicts with the COM?

        M 1 Reply Last reply 15 Aug 2016, 09:38
        0
        • M MartinChan
          15 Aug 2016, 09:34

          @mrjj Yes...Is that having some conflicts with the COM?

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 15 Aug 2016, 09:38 last edited by mrjj
          #4

          @MartinChan
          nope, it its just the note in the docs
          "Warning: You can subclass QAxObject, but you cannot use the Q_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxObject as a member of the QObject subclass."

          so I wondered if the errors u get was moc errors.

          Was just a thought.

          update:
          if you subclass is indeed QObject based and you aggregate the QAxObject,
          i dont think its the reason for your errors.

          M 1 Reply Last reply 15 Aug 2016, 09:43
          0
          • M mrjj
            15 Aug 2016, 09:38

            @MartinChan
            nope, it its just the note in the docs
            "Warning: You can subclass QAxObject, but you cannot use the Q_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxObject as a member of the QObject subclass."

            so I wondered if the errors u get was moc errors.

            Was just a thought.

            update:
            if you subclass is indeed QObject based and you aggregate the QAxObject,
            i dont think its the reason for your errors.

            M Offline
            M Offline
            MartinChan
            wrote on 15 Aug 2016, 09:43 last edited by
            #5

            @mrjj thx,I am astonished and I will try it soon...:(

            1 Reply Last reply
            0

            2/5

            15 Aug 2016, 09:26

            • Login

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