Results 1 to 20 of 38

Thread: Images/icons. It's not displayed

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    No result... I add to /images an png image - image.png
    To res.qrc I add -
    Qt Code:
    1. <file>images/image.png</file>
    To copy to clipboard, switch view to plain text mode 
    And my .cpp:
    Qt Code:
    1. qSpeed->setWindowIcon(QIcon(":/images/image.png"));
    To copy to clipboard, switch view to plain text mode 
    //qSpeed is a label

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Images/icons. It's not displayed

    Have you recompiled your resource?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Images/icons. It's not displayed

    First of all, did you run qmake after adding the resource file to the project?

  4. #4
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    marcel, wysota:
    sure

    But, can I put my icon on a label, by using QLabel::setWindowIcon(QIcon(...)) ? Maybe this is the problem?...

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Images/icons. It's not displayed

    No.
    Use QLabel::setPixmap.

  6. #6
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    Qt Code:
    1. qSpeed->setPixmap(QPixmap(":/images/image.png"));
    To copy to clipboard, switch view to plain text mode 
    no result.....:-\

  7. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Images/icons. It's not displayed

    Are you sure that qSpeed is inside a proper layout?
    Try also qSpeed->setMinimumSize( pixmap.size() ).

  8. #8
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    Are you sure that qSpeed is inside a proper layout?
    Hm.. I'm just beginner, can you explain how to verify it?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Images/icons. It's not displayed

    Quote Originally Posted by marcel View Post
    Are you sure that qSpeed is inside a proper layout?
    Try also qSpeed->setMinimumSize( pixmap.size() ).
    It's not needed. If "qSpeed" is a label and is given a pixmap, it's minimum size will be set to the size of pixmap.

    @LMZ: Could you provide a small compilable example that reproduces your problem? It might be easier for us to fix it then.

  10. #10
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    Hi guys! Sorry for that long pause... Well, I have create a small simple project. I made a form in a designer, designer was generate myform.h file. I put my pict within a disigner on a form. Picture are described in resources.. well, download it and take a look..
    Thx a lot! )
    URL

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Images/icons. It's not displayed

    Sorry, but could you use the attachment feature of the forum instead of using 3rd party commercial sites?

  12. #12
    Join Date
    May 2007
    Posts
    46
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Images/icons. It's not displayed

    sure, sorry ))
    Attached Files Attached Files

  13. #13
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Images/icons. It's not displayed

    I bet this is because of the jpeg plugin. Have you tried loading a PNG instead? Just to see if it works.

    EDIT -I can see it also ( in designer )

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Images/icons. It's not displayed

    I can see the image. Could you again verify that PNG images don't work either?

Similar Threads

  1. Replies: 20
    Last Post: 15th August 2008, 23:19
  2. JPEG Image isn't displayed!?
    By GodOfWar in forum Qt Programming
    Replies: 9
    Last Post: 16th April 2007, 15:01
  3. QLineEdit - Float number not displayed correct
    By morty in forum Qt Programming
    Replies: 3
    Last Post: 9th November 2006, 00:47
  4. Replies: 6
    Last Post: 10th April 2006, 10:47

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.