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. QVariant activeqt question
Qt 6.11 is out! See what's new in the release blog

QVariant activeqt question

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k 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.
  • D Offline
    D Offline
    drdre
    wrote on last edited by
    #1

    I'm using activeQt to call a COM dll and the function I need to use has a VARIANT* datatype as a function parameter.

    From visual studio I can do the following:

    (import COMClass as MFC class from type lib)
    VARIANT x;
    VariantInit(&x);
    COMClass.functionToCall(&x); //this will work

    but if I do this without VariantInit(&x); it won't work

    Now if I do the same thing in Qt:

    (use dumpcpp to generate type lib from dll and create a COMCLass object)
    QVariant x;
    COMClass.functionToCall(&x); //won't work

    it doesn't work. Is there any reason for this? Could it be because QVariant doesn't have a corresponding VT_EMPTY data type to initialize to?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      QVariant != VARIANT!!!

      the thing you have to do it this way in MFC is that VARIANT is a structure so it has no constructor. In MFC you could use CVariant which does this implicitly.

      I'm not 100% sure what to do in ActiveQ there

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      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