Results 1 to 2 of 2

Thread: Crash during use of Active QT + QVariantList in C# application

  1. #1
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Crash during use of Active QT + QVariantList in C# application

    Hi All,

    I have written following class in QT and I would like to access the array of following class object in C# application. But when I try to access it then it is causing the crash.

    Like

    MyClassAx a;

    a.Devices.Length; ///////Crash here;


    class Q_DECL_EXPORT DeviceInfo : public QObject
    {
    Q_OBJECT


    Q_CLASSINFO("ClassID", "{B4A5BD09-67FF-4869-B777-E91A59E08FF3}")
    Q_CLASSINFO("InterfaceID", "{A5F87FDA-F796-41C8-9C03-86A50AA7F963}")
    QString m_sDeviceName;
    bool m_bState;
    bool m_bPreferred;


    public:
    DeviceInfo() {}
    DeviceInfo(const DeviceInfo& src);
    DeviceInfo(QString sDeviceName,QObject *parent = 0);
    void SetIsPreferred(bool bPreferred);

    void SetState(bool bState);
    ~DeviceInfo();
    signals:

    public slots:
    bool GetState() const;
    bool IsPreferred() const;

    QString GetName() const;
    };
    Q_DECLARE_METATYPE(DeviceInfo)



    Following is the class which is exported as activex class

    class Q_DECL_EXPORT MyClassAx : public QWidget
    {

    Q_OBJECT

    Q_CLASSINFO("ClassID", "{75C97E48-AEBC-48C6-A4F5-80B462FD4E18}")
    Q_CLASSINFO("InterfaceID", "{C5845DAD-4E7D-481A-8ECE-FC1FF81E5FE7}")
    Q_CLASSINFO("EventsID", "{74C81852-2012-4333-A5A7-BD7D43B487D1}")
    // Q_CLASSINFO("Version", "1.0")
    Q_CLASSINFO("Description", "My class activex description")
    Q_CLASSINFO("StockEvents","yes")
    Q_CLASSINFO("ToSuperClass","MyClassAx")
    QVariantList variantList;

    Q_PROPERTY(QList<QVariant> Devices READ GetDevicesList)
    public:
    QList<QVariant> GetDevicesList()
    {
    QList<DeviceInfo> dev;
    ////Code to retrive the dev list
    for(int i=0;i<dev.size();i++)
    {

    variantList.append(QVariant::fromValue(dev[i]));
    }
    return variantList;
    }
    }



    Please let me know what i am missing
    Last edited by Vagesh; 26th December 2014 at 11:15.

  2. #2
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Crash during use of Active QT + QVariantList in C# application

    My issue is get resolved by following this example.
    http://doc.qt.io/qt-5/activeqt-activ...p-example.html

Similar Threads

  1. Qt application with live Active X camera feed.
    By bitChanger in forum Qt Programming
    Replies: 8
    Last Post: 4th September 2012, 19:26
  2. Replies: 3
    Last Post: 25th April 2011, 03:40
  3. Replies: 0
    Last Post: 4th March 2011, 19:18
  4. how to avoid crash of my application......
    By newb in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2010, 10:09
  5. run active-x as external application
    By yazwas in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2010, 12:40

Tags for this Thread

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.