Hey, guys,

I am new here, I am playing with AXIS network camera using its SDK based on QT. I want to use its GetCurrentImage function to get the Image.

Below is the syntax of GetCurrentImage from AXIS SDK.

GetCurrentImage
Syntax
HRESULT GetCurrentImage(int theFormat, [C++]
VARIANT* theBuffer,
LONG* theBufferSize
);
Parameters
theFormat
Identifier specifiying the format of the image data. Values available are: 0 = JPEG, 1 = BMP (defined in the AMC_IMAGE_FORMAT enum in the type library).

theBuffer
The buffer where the image data is returned.

theBufferSize
Size of the image data buffer returned.

It looks like assigning the “theBuffer” field passing by reference, like the format below

Qt Code:
  1. var* var;
  2.  
  3. getCurrentImage(var){ // object-> dynamicallcall(“getCurrentImage(var)”)
  4.  
  5. var = … // which can not be seen by us, because I am using dynamiccall to call the method in AXIS SDK
  6.  
  7. }
To copy to clipboard, switch view to plain text mode 



So I choose QVariant to do that

(1) In the .h file under public declaration,
QVariant* MediaBuffer;
long* MediaBufferSize;

(2) in the .cpp file
I first tried
Qt Code:
  1. axWidget->dynamicCall("GetCurrentImage(int, QVariant*, long*)",0,MediaBuffer, MediaBufferSize);
To copy to clipboard, switch view to plain text mode 

then I got the error report twice:

error: C2248: 'QVariant::QVariant' : cannot access private member declared in class 'QVariant'
e:\qt\4.8.5\src\corelib\kernel\qvariant.h:429: see declaration of 'QVariant::QVariant'
e:\qt\4.8.5\src\corelib\kernel\qvariant.h:93: see declaration of 'QVariant'
error: C2248: 'QVariant::QVariant' : cannot access private member declared in class 'QVariant'
e:\qt\4.8.5\src\corelib\kernel\qvariant.h:429: see declaration of 'QVariant::QVariant'
e:\qt\4.8.5\src\corelib\kernel\qvariant.h:93: see declaration of 'QVariant'

in the second time, I tried

Qt Code:
  1. QList<QVariant> varList;
  2. varList << 0 << MediaBuffer << MediaBufferSize; // error report place
  3. axWidget->dynamicCall("GetCurrentImage(int, QVariant*, long*)",varList);
  4. axWidget->dynamicCall("GetCurrentImage(QList<QVariant>)",varList); // the same error report
To copy to clipboard, switch view to plain text mode 


I got the same error report

Looking deeper at the qvariant.h,
In line 429 it is

Qt Code:
  1. private:
  2. // force compile error, prevent QVariant(bool) to be called
  3. inline QVariant(void *) { Q_ASSERT(false); } // line 429
To copy to clipboard, switch view to plain text mode 


in line 93
it is
Qt Code:
  1. class Q_CORE_EXPORT QVariant
To copy to clipboard, switch view to plain text mode 

which I do not list all stuff here.

It seems the problem of the usage of QVariant up to now, but I do not know how can I fix it.

Could you guys give me some suggestions?


My environment is
Qt 4.8.5
Qtcreator 3.1.0
Win 8
AXIS Media Control API 6.30


Many thanks,
szysagittarius