Results 1 to 6 of 6

Thread: QImage problem in Windows-2000

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QImage problem in Windows-2000

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

  3. #3
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage problem in Windows-2000

    Hi,
    I am using VS-2005 for compile my program. Can I include that plug-in ( .lib files ) in my .exe program for avoid the folder copy ( imageformats ) ?

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QImage problem in Windows-2000

    J-P Nurmi

  5. #5
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage problem in Windows-2000

    Hi,
    I tryed this, But when I compile the program, Qt display an error like this

    main.obj : error LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qjpeg(void)" (?qt_plugin_instance_qjpeg@@YAPAVQObject@@XZ) referenced in function "public: __thiscall StaticqjpegPluginInstance::StaticqjpegPluginInstan ce(void)" (??0StaticqjpegPluginInstance@@QAE@XZ)
    release\Test.exe : fatal error LNK1120: 1 unresolved externals
    Please help me to solve this problem.
    Last edited by jacek; 2nd January 2008 at 19:09. Reason: changed [code] to [quote]

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QImage problem in Windows-2000

    Did you notice what it says right in the beginning when you follow the link:
    When compiled as a static library, Qt provides the following static plugins
    ?
    J-P Nurmi

Similar Threads

  1. QImage on windows
    By J-jayz-Z in forum Installation and Deployment
    Replies: 3
    Last Post: 26th September 2007, 21:27
  2. problem with menu entries for mdi windows
    By y.shan in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2007, 07:48
  3. QTableView Performance Problem on Windows
    By umitoz in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2007, 16:47
  4. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 08:04
  5. Thread problem with windows
    By vratojr in forum Qt Programming
    Replies: 17
    Last Post: 16th June 2006, 08:34

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.