Results 1 to 3 of 3

Thread: VARIANT <-> QVariant

  1. #1
    Join Date
    Jul 2007
    Posts
    56
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question VARIANT <-> QVariant

    I'm working with some legacy Windows C++ code that gets and sets a Windows VARIANT type.

    I can't see a way to convert this directly to and from a QVariant. I could make my own conversion I guess, but it seems like it would be in Qt already as part of ActiveQt (which I'm not using).

    Is there a way do this?

  2. #2
    Join Date
    Aug 2009
    Posts
    52
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: VARIANT <-> QVariant

    You can refer the files: %QTDIR%/src/activeqt/shared/qaxtypes.cpp and qaxtypes.h
    Qt Code:
    1. bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName = 0, bool out = false);
    2. QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type = 0);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2007
    Posts
    56
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: VARIANT <-> QVariant

    Excellent. Just what I was looking for.

Similar Threads

  1. ActiveQt QVariant and VC VARIANT
    By dbzhang800 in forum Qt Programming
    Replies: 15
    Last Post: 19th June 2013, 13:50
  2. Convert between a custom data type wrapped in a QVariant
    By darkadept in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2009, 09:07
  3. Getting Microsoft Word Object to SaveAs
    By jvwebb in forum Newbie
    Replies: 3
    Last Post: 2nd September 2008, 19:27
  4. Replies: 8
    Last Post: 16th July 2008, 14:05
  5. Crash caused by QVariant (mis)use
    By mclark in forum Newbie
    Replies: 2
    Last Post: 31st October 2006, 15:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.