Good day.
Let me describe the problem.
I am using QByteArray to send pixmap information between client and server.
All Was OK.
But now the same code doesn't work correctly on Windows platform, but working good on Linux.
This sample works with png image files but with JPEG I have problems in Windows.
Can you help me to fix this problem.

qt4.2.0 qt4.2.1 (tested)
gcc 4.1.1(linux)
MinGW 3.4.2( Window)

Can you help me.
I sent this information to qt-bugs but I think they have so much to do. (And Week end)

Qt Code:
  1. include <QDebug>
  2. #include <QApplication>
  3. #include <QWidget>
  4. #include <QBrush>
  5. #include <QPalette>
  6. #include <QFile>
  7. #include <QMessageBox>
  8.  
  9. int main(int argc, char** argv)
  10. {
  11. QApplication App(argc, argv);
  12. QBrush Brush;
  13. QPixmap Pixmap;
  14. QPalette Palette;
  15. QByteArray bArray;
  16.  
  17. QFile PixmapFile("./testimage.jpg");
  18. if(!PixmapFile.open(QIODevice::ReadOnly))
  19. {
  20. qDebug("Error loading Pixmap");
  21. return false;
  22. }
  23.  
  24. bArray=PixmapFile.readAll().toBase64();
  25.  
  26. if(!Pixmap.loadFromData( bArray.fromBase64(bArray)))
  27. {
  28. qDebug()<<"Error pixmap processing";
  29. return 0;
  30. }
  31.  
  32. QWidget *tWidget=new QWidget();
  33.  
  34. Brush.setTexture(Pixmap );
  35.  
  36. Palette.setBrush(QPalette::Background, Brush);
  37. tWidget->setPalette( Palette);
  38.  
  39. tWidget->show();
  40. App.exec();
  41. }
To copy to clipboard, switch view to plain text mode