Hi,
I have a program in Qt 4.3.0 and in that program I need to load some picture. For that I write a function like this

Qt Code:
  1. MyClass::LoadImages(){
  2.  
  3. int COLUMN;
  4. QImage *image = new QImage();
  5. QIcon icon;
  6.  
  7. filters << "snapshot-*" ;
  8.  
  9. directory.setNameFilters(filters);
  10. files = directory.entryList(filters, QDir::Files | QDir::NoSymLinks);
  11. c=0; COLUMN = 2;
  12. QLabel *pixmapLabels [100] [2];
  13.  
  14. NumStates_New = 0;
  15. NumStates_New = files.size()/2;
  16.  
  17. if ( files.size()%2 >0 ) {
  18. NumStates_New++;
  19. }
  20.  
  21. for (int i = 0; i < NumStates_New; ++i) {
  22. for (int j = 0; j < COLUMN; ++j) {
  23. pixmapLabels[i][j] = createPixmapLabel();
  24. pixmapLabels[i][j]->resize(5,5);
  25. // pixmapLabels[i][j]->show();
  26. SnapLayout->addWidget(pixmapLabels[i][j], i + 1, j + 1 );
  27. // SnapLayout->update();
  28.  
  29. }
  30. }
  31. r=0, c=0;
  32. for (int i = 0; i < files.size(); ++i) {
  33. fileName = directory.absolutePath();
  34. fileName.append("/");
  35. fileName.append(files.at(i).toLocal8Bit().constData());
  36.  
  37. image->load(fileName);
  38.  
  39. if (!image->isNull()){
  40. icon.addPixmap(QPixmap::fromImage(*image), QIcon::Normal, QIcon::On);
  41. }
  42. else{
  43. QMessageBox::critical(this, "Picture error", "Picture error", QMessageBox::Ok, QMessageBox::NoButton);
  44. }
  45.  
  46. this->icon = icon;
  47. this->size = QSize(110,102);
  48. QPixmap pixmap = icon.pixmap(size, QIcon::Normal, QIcon::On);
  49. pixmapLabels[r][c]->setPixmap(pixmap);
  50. pixmapLabels[r][c]->setToolTip(fileName);
  51. pixmapLabels[r][c]->show();
  52.  
  53. c++; if (c>=COLUMN) { c=0; r++; }
  54. }
  55. }
  56.  
  57.  
  58.  
  59. QLabel *MyClass::createPixmapLabel()
  60. {
  61. QLabel *label = new QLabel;
  62. label->setEnabled(true);
  63. label->setAlignment(Qt::AlignCenter);
  64. label->setText("Picture");
  65. label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  66. label->setAutoFillBackground(true);
  67. label->setMinimumSize(110,102);
  68. return label;
  69. }
To copy to clipboard, switch view to plain text mode 


I compiled this code in Windows Xp and it is working. But When I copy the .exe file to Windows-2000, then it display the error message "Picture error", ie, the image is NULL.
I tried this same code in Linux ( fedora core 2 ) and it is working.

How can I solve this problem in windows-2000.
Please help me