Results 1 to 10 of 10

Thread: adding icons from resources to buttons without Qt3Support

  1. #1
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default adding icons from resources to buttons without Qt3Support

    Hi All,

    I've got a resource file which I've used to add icons to buttons in designer.

    The problem I've hit is that the code it generates uses qPixmapFromMimeSource - which I can get to work using Qt3Support, but I'd rather have it generate Qt4 style code.

    Anyone know how I can get it to do this? Or what I should be using if I put the changes into the constructor of my class which inherits this ui file?

    Cheers,

    Alan.
    Last edited by skyphyr; 5th December 2006 at 15:03. Reason: more accurate title

  2. #2
    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: adding icons from resources to buttons without Qt3Support

    In Qt4 you should create a qrc file and use a proper URI to reach the resource from your code. What buttons are we talking about here anyway? Qt3 ones?

  3. #3
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding icons from resources to buttons without Qt3Support

    Hi wysota,

    Sorry for the delay - I complete forgot I posted this for a while with other issues popping up.

    The project has only been done in Qt4 and the button type is QToolButton.

    I have used a .qrc file - here's an example section from the .ui file
    Qt Code:
    1. <widget class="QToolButton" name="taskResume" >
    2. <property name="sizePolicy" >
    3. <sizepolicy>
    4. <hsizetype>5</hsizetype>
    5. <vsizetype>5</vsizetype>
    6. <horstretch>0</horstretch>
    7. <verstretch>0</verstretch>
    8. </sizepolicy>
    9. </property>
    10. <property name="toolTip" >
    11. <string>Resume Task</string>
    12. </property>
    13. <property name="text" >
    14. <string>></string>
    15. </property>
    16. <property name="icon" >
    17. <iconset resource="../splishgraphics/splishgraphics.qrc" >:/icons/splish_play.png</iconset>
    18. </property>
    19. <property name="iconSize" >
    20. <size>
    21. <width>32</width>
    22. <height>32</height>
    23. </size>
    24. </property>
    25. </widget>
    To copy to clipboard, switch view to plain text mode 

    Thanks for the help.

    Cheers,

    Alan.

  4. #4
    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: adding icons from resources to buttons without Qt3Support

    So what is the problem?

  5. #5
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding icons from resources to buttons without Qt3Support

    The problem is that it creates code which requires qt3support, not code which is purely qt4.

    Cheers,

    Alan.

  6. #6
    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: adding icons from resources to buttons without Qt3Support

    What exact symbols does it need from Qt3support?

  7. #7
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding icons from resources to buttons without Qt3Support

    Hi wysota,

    It needs qPixmapFromMimeSource from q3mimefactory.h

    Cheers,

    Alan.

  8. #8
    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: adding icons from resources to buttons without Qt3Support

    Can you post a small compilable example experiencing such a behaviour? Are you porting from Qt3? In the snippet you posted everything seems to be fine, the problem has to be elsewhere...

  9. #9
    Join Date
    Jan 2006
    Location
    Cambridge, MA
    Posts
    32
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: adding icons from resources to buttons without Qt3Support

    I have run into this when porting Qt3 forms to Qt4. You should just delete the pixmapFunction (or something to that effect) tag and its contents from the .ui file by hand. Worked for me. Newly created forms should not have this problem.

    --Justin

  10. The following user says thank you to Glitch for this useful post:

    skyphyr (26th February 2007)

  11. #10
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding icons from resources to buttons without Qt3Support

    Hi,

    Sorry again for the delay. This has definitely fixed it for me :-) I've only even worked in Qt4 for this project - perhaps I accidentally opened the ui in kdevelop's embedded designer?

    Thanks very much for the help with this one.

    Cheers,

    Alan.

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.