Results 1 to 9 of 9

Thread: QPixmap bug under Qt4.3.1 ?

  1. #1
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default QPixmap bug under Qt4.3.1 ?

    Hello,

    I use Qt 4.3.1 OpenSource Edition on Windows XP Pro SP2 32bits.
    My application has an interface with a QLabel.
    My objective is to post an image, also I display it in the QLabel using a QPixmap.

    Qt Code:
    1. int hauteur_jaquette = (tree->height ()) /2; // 50% of the height of the interface
    2.  
    3. QPixmap jaquette_pixmap;
    4. jaquette_pixmap.load (acces_jaquette); // Loading of the image in QPixmap
    5. jaquette_pixmap = jaquette_pixmap.scaledToHeight (hauteur_jaquette, Qt:: SmoothTransformation); // Scaling the image
    6.  
    7. label_jaquette->setPixmap (jaquette_pixmap); // Posting of QPixmap (and thus of the image) in the QLabel of the interface
    To copy to clipboard, switch view to plain text mode 

    That functions perfectly with the version OpenSource of Qt distribuated by Trolltech.
    However, if I reconfigure Qt in static mode (configures static, make sub-src) and if I recompile my project, then the image is not displayed any more…

    Would somebody have an idea, a council, a suggestion ?

  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

    Default Re: QPixmap bug under Qt4.3.1 ?

    And the image is in which format? Try PNG..?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap bug under Qt4.3.1 ?

    The image is downloaded from the web before to be displayed, so it's generally .jpg and sometimes .gif

    So I don't know if I can convert it to .png from my application, but I'll test some .png images to understand well the problem.

    Thanks for this tip

  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: QPixmap bug under Qt4.3.1 ?

    First of all, make sure your Qt was built with GIF and JPG support (configure script outputs detailed information about this, after qmake has been compiled, before reading all the .pro files). Secondly, since you're using static Qt, you will have to import static plugins:

    .pro:
    QTPLUGIN += qjpeg
    main.cpp:
    Q_IMPORT_PLUGIN(qjpeg)
    More info: http://doc.trolltech.com/latest/qtpl..._IMPORT_PLUGIN
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    Nyphel (7th October 2007)

  6. #5
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap bug under Qt4.3.1 ?

    Thanks !

    So, if I understood well, I've to re-configure Qt with the following options :
    -relase
    -static
    -qt-libgif
    -qt-libpng (instead of the default option : -system-libpng)
    -qt-libjpeg (instead of the default option : -system-libjpeg)

    Next, I'll add "Q_IMPORT_PLUGIN(qjpeg)" (without ";" ?) at the top of my class .cpp and "QTPLUGIN += qgif qpng qjpeg" in my .pro file.

    That's right ?

  7. #6
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap bug under Qt4.3.1 ?

    I've re-configured and re-built (make sub-src) my Qt4.3.1 OpenSource edition for Windows with the options that were listed above.
    I got no errors, no warning.

    Here is my .pro file :
    Qt Code:
    1. TEMPLATE = app
    2. TARGET = Listeur
    3. QT += core \
    4. gui \
    5. network
    6. HEADERS += Thread_existing_files.h \
    7. Thread_HTTP_VC.h \
    8. Thread_HTTP_MC.h \
    9. Thread_HTTP_AC.h \
    10. Thread_HTTP_QLCS.h \
    11. Listeur.h \
    12. Thread_scanneur.h \
    13. donnee.h \
    14. interface.h \
    15. interface_impl.h
    16. SOURCES += Thread_existing_files.cpp \
    17. Thread_HTTP_VC.cpp \
    18. Thread_HTTP_MC.cpp \
    19. Thread_HTTP_AC.cpp \
    20. Thread_HTTP_QLCS.cpp \
    21. Listeur.cpp \
    22. Thread_scanneur.cpp \
    23. donnee.cpp \
    24. interface_impl.cpp \
    25. main.cpp
    26. FORMS += interface.ui
    27. QTPLUGIN += qgif \
    28. qjpeg
    To copy to clipboard, switch view to plain text mode 

    Here is my main.cpp :
    Qt Code:
    1. #include "Listeur.h"
    2.  
    3. #include <QtPlugin>
    4. Q_IMPORT_PLUGIN(qjpeg)
    5. Q_IMPORT_PLUGIN(qgif)
    6.  
    7. int main(int argc, char *argv[])
    8. {
    9. QApplication app(argc, argv);
    10.  
    11. Listeur * mon_listeur = new Listeur();
    12.  
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    When I build my application, using "qmake" an "make", I get the following error message :
    Qt Code:
    1. D:\Applications\Qt\4.3.1\Workspace\Listeur>qmake
    2.  
    3. D:\Applications\Qt\4.3.1\Workspace\Listeur>make
    4. mingw32-make -f Makefile.Release
    5. mingw32-make[1]: Entering directory `D:/Applications/Qt/4.3.1/Workspace/Listeur'
    6.  
    7. g++ -c -O2 -Wall -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT
    8. _NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_N
    9. EEDS_QMAIN -I"..\..\include\QtCore" -I"..\..\include\QtCore" -I"..\..\include\Qt
    10. Network" -I"..\..\include\QtNetwork" -I"..\..\include\QtGui" -I"..\..\include\Qt
    11. Gui" -I"..\..\include" -I"..\..\include\ActiveQt" -I"tmp\moc\release_static" -I"
    12. ." -I"..\..\mkspecs\win32-g++" -o tmp\obj\release_static\main.o main.cpp
    13. main.cpp: In function `int qMain(int, char**)':
    14. main.cpp:15: warning: unused variable 'mon_listeur'
    15. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    16. oc -Wl,-s -Wl,-subsystem,windows -o "release\Listeur.exe" object_script.Listeur.
    17. Release -L"d:\Applications\Qt\4.3.1\lib" -L"d:\Applications\Qt\4.3.1\lib" -lmin
    18. gw32 -lqtmain -LD:/Applications/Qt/4.3.1/plugins/imageformats/ -lqgif4 -LD:/Appl
    19. ications/Qt/4.3.1/plugins/imageformats/ -lqjpeg4 -lQtGui -lQtNetwork -lgdi32 -lc
    20. omdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -lus
    21. er32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
    22. ./tmp\obj\release_static\main.o(.text+0x83):main.cpp: undefined reference to `qt
    23. _plugin_instance_qjpeg()'
    24. ./tmp\obj\release_static\main.o(.text+0xa3):main.cpp: undefined reference to `qt
    25. _plugin_instance_qgif()'
    26. collect2: ld returned 1 exit status
    27. mingw32-make[1]: *** [release\Listeur.exe] Error 1
    28. mingw32-make[1]: Leaving directory `D:/Applications/Qt/4.3.1/Workspace/Listeur'
    29. mingw32-make: *** [release] Error 2
    30.  
    31. D:\Applications\Qt\4.3.1\Workspace\Listeur>
    To copy to clipboard, switch view to plain text mode 

    I don't understand how to solve this linking error :s
    Last edited by Nyphel; 7th October 2007 at 15:05.

  8. #7
    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: QPixmap bug under Qt4.3.1 ?

    Quote Originally Posted by Nyphel View Post
    -qt-libjpeg (instead of the default option : -system-libjpeg)
    I suppose both are fine as long as needed libs can be found and configure outputs something like:
    JPEG support............plugin
    Next, I'll add "Q_IMPORT_PLUGIN(qjpeg)" (without ";" ?) at the top of my class .cpp and "QTPLUGIN += qgif qpng qjpeg" in my .pro file.

    That's right ?
    Yes, that's right.
    J-P Nurmi

  9. #8
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap bug under Qt4.3.1 ?

    (Small up, because JPN was writting an answer while I was posting more informations about my problem ^^)

  10. #9
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap bug under Qt4.3.1 ?

    Quote Originally Posted by Messenger from qtforum.org
    Everything looks OK. Strange. See
    >objdump.exe -t libqgif4.a
    what function are in.
    If there is no [_]qt_plugin_instance_qgif() then delete everything in plugins\imageformats folder and mingw32-make Qt library (or just mingw32-make in [qt base]\src\plugins\imageformats)
    Qt Code:
    1. D:\Applications\Qt\4.3.1>cd plugins
    2.  
    3. D:\Applications\Qt\4.3.1\plugins>cd imageformats
    4.  
    5. D:\Applications\Qt\4.3.1\plugins\imageformats>objdump -t libqgif4.a
    6. In archive libqgif4.a:
    7.  
    8. d000003.o: file format pe-i386
    9.  
    10. SYMBOL TABLE:
    11. [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$4
    12. [ 1](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$5
    13. [ 2](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$7
    14. [ 3](sec 3)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _qgif4_dll_iname
    15.  
    16.  
    17.  
    18. d000000.o: file format pe-i386
    19.  
    20. SYMBOL TABLE:
    21. [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$2
    22. [ 1](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$5
    23. [ 2](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$4
    24. [ 3](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __head_qgif4_dll
    25. [ 4](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _qgif4_dll_iname
    26.  
    27.  
    28.  
    29. d000002.o: file format pe-i386
    30.  
    31. SYMBOL TABLE:
    32. [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .text
    33. [ 1](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$7
    34. [ 2](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$5
    35. [ 3](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$4
    36. [ 4](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$6
    37. [ 5](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _qt_plugin_query_verif
    38. ication_data
    39. [ 6](sec 3)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __imp__qt_plugin_query
    40. _verification_data
    41. [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __head_qgif4_dll
    42.  
    43.  
    44.  
    45. d000001.o: file format pe-i386
    46.  
    47. SYMBOL TABLE:
    48. [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .text
    49. [ 1](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$7
    50. [ 2](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$5
    51. [ 3](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$4
    52. [ 4](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 .idata$6
    53. [ 5](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _qt_plugin_instance
    54. [ 6](sec 3)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __imp__qt_plugin_insta
    55. nce
    56. [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __head_qgif4_dll
    57.  
    58.  
    59.  
    60. D:\Applications\Qt\4.3.1\plugins\imageformats>
    To copy to clipboard, switch view to plain text mode 

    Oki, I deleted the contents of Qt4.3.1/plugins/imageformats (lots of .a and .dll files).

    Next I made what he told me to do :
    cd src
    cd plugins
    cd imagefomats
    make

    And now all works well.
    My Qt4.3.1/plugins/imageformats dir contains 5 files :
    - libqgif.a
    - libqjpeg.a
    - libqmng.a
    - libqsvg.a
    - libqtiff.a

    When I build my application, I've no errors and I works perfectly
    Thanks a lot !

Similar Threads

  1. CreateCompatibleBitmap fails in QPixmap
    By JimBrown in forum Qt Programming
    Replies: 14
    Last Post: 29th May 2007, 15:24
  2. QPixmap into QTextBrowser
    By xgoan in forum Qt Programming
    Replies: 6
    Last Post: 3rd November 2006, 13:05
  3. QPixmap -> HICON trouble.
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2006, 15:51
  4. Loading a custom image into a QPixmap
    By KShots in forum Qt Programming
    Replies: 12
    Last Post: 5th August 2006, 00:16
  5. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.