Results 1 to 7 of 7

Thread: QAxWidget Programming: pass by reference

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: QAxWidget Programming: pass by reference

    I am not certain how a pointer to a float can be passed as the second argument but I would try:
    Qt Code:
    1. double outPos(0.0);
    2. QVariant retCode = hMotor.dynamicCall("GetPosition(int, float&)",chanID, outPos);
    To copy to clipboard, switch view to plain text mode 
    The parameter types come from the lookup in the docs.

  2. #2
    Join Date
    Mar 2014
    Posts
    5
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Unhappy Re: QAxWidget Programming: pass by reference

    Thanks, I appreciate the help.

    I just tried your suggestion. It gives the same error as before.

    QAxBase: Error calling IDispatch member GetPosition: Type mismatch in parameter
    1
    0
    Press <RETURN> to close this window...
    Last edited by NeuroC++; 4th March 2014 at 00:29. Reason: added thanks and smiley

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: QAxWidget Programming: pass by reference

    How about this?
    Qt Code:
    1. float outPos(0.0);
    2. QVariant retCode = hMotor.dynamicCall("GetPosition(int, float*)",chanID, &outPos);
    To copy to clipboard, switch view to plain text mode 
    I don't really expect this to work, just covering the bases.

  4. #4
    Join Date
    Mar 2014
    Posts
    5
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QAxWidget Programming: pass by reference

    Yeah, if I do that it gives the "QVariant::QVariant(*void) is private" compile error. I've even tried casting the pointer to "outPos" into an int that I put into a QVariant which I then passed to the function. It compiled but still gave a type mismatch error at runtime.

Similar Threads

  1. Design: Signals => Pass by Reference
    By tescrin in forum Qt Programming
    Replies: 19
    Last Post: 7th December 2012, 22:40
  2. How to pass variables as reference from C++ to QML
    By dmendizabal in forum Qt Quick
    Replies: 1
    Last Post: 17th February 2012, 15:39
  3. Pass by reference in QtScript
    By songyu_us in forum Qt Programming
    Replies: 0
    Last Post: 14th July 2009, 18:59
  4. Pass by reference
    By vermarajeev in forum General Programming
    Replies: 6
    Last Post: 20th July 2007, 15:53
  5. QAxWidget
    By chak_med in forum Newbie
    Replies: 1
    Last Post: 10th September 2006, 21:05

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
  •  
Qt is a trademark of The Qt Company.