Hi everybody,

I am working on a software that is using an active x control. The active x has function that return a bitmap as QVariant, tha Qvariant Type is QvariantList, and the item type inside the list are reconigzes as int.

The Function is suppose to return this information wrap in a variant:

  • BitmapInfoHeader: (WINDOWS BITMAPINFOHEADER sturct);
  • Palette 256 element arrayof Windows PALETTEENTRY;
  • Bits Two-Dimensional array of byte. the size of the array is specified in the bitmapInfoHeader.bSizeImage


Well this is what i am doing:

Qt Code:
  1. QVariantList list = ActiveXObject->Bitmap().toList();
  2. uchar unChList[list.size()];
  3. for (qint32 i = 0; i < list.size(); i++)
  4. {
  5. unChList[i] = a.at(i).toUInt();
  6. }
  7. QPixmap pixBeam;
  8. pixBeam.loadFromData(unChList, list.size());
  9. QString name = "File.pdf";
  10. QPrinter printer;
  11. printer.setOutputFormat(QPrinter::PdfFormat);
  12. printer.setOutputFileName(name);
  13. printer.setPageSize(QPrinter::A4);
  14. printer.setPageMargins(25, 10, 20, 10, QPrinter::Millimeter);
  15. printer.setFullPage(false);
  16.  
  17. QPainter painter;
  18. if (!painter.begin(&printer))
  19. {
  20. qWarning("failed to open file, is it writable?");
  21. return;
  22. }
  23. painter.setWindow(0, 0, 1650, 2750);
  24.  
  25. QPen pen;
  26. pen.setBrush(QBrush(Qt::black, Qt::SolidPattern));
  27. painter.setPen(pen);
  28.  
  29. /*********
  30.  *here i draw also some rects and text
  31. *********/
  32.  
  33. painter.drawPixmap(QRect(0, 100, 1650, 1200), pixBeam, pixBeam.rect());
  34.  
  35. /*********
  36.  *here i draw also some rects and text
  37. *********/
  38. painter.end();
To copy to clipboard, switch view to plain text mode 

The text and and squares and lines are there but the bitmap is not.
How shall i conver this? i calling "fromData" function in a incorrect way?

Thanks for the help in Advance

PS: I have run with the printing of the value they have data inside.