Results 1 to 3 of 3

Thread: Qt5.7/C++ - Window icon shows, can't show control icons.

  1. #1
    Join Date
    Oct 2006
    Posts
    105
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Qt5.7/C++ - Window icon shows, can't show control icons.

    Hello,

    Windows 10 32 bit
    Qt5.7, QtCreator 4.1.0

    I can get the QMainWindow showing an icon.
    Qt Code:
    1. Pro file
    2. RESOURCES += gui_icons.qrc
    3. RC_ICONS = myApp.ico
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. gui_icons.qrc
    2. <RCC>
    3. <qresource prefix="/images">
    4. <file>images/browse.ico</file>
    5. <file>images/myApp.ico</file>
    6. </qresource>
    7. </RCC>
    To copy to clipboard, switch view to plain text mode 
    I have a QToolButton on the QMainWindow generated from Designer.
    I have in my source code:-
    Qt Code:
    1. ui->tbBrowse->setIcon(QIcon ("browse.ico"));
    To copy to clipboard, switch view to plain text mode 
    I've also set the icon in Designer.
    The icon never shows.
    What steps am I missing?

    Regards
    Last edited by jimbo; 3rd September 2016 at 18:29.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt5.7/C++ - Window icon shows, can't show control icons.

    A resource path starts with ":" and your path is also missing the "images" prefix.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2006
    Posts
    105
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt5.7/C++ - Window icon shows, can't show control icons.

    Hello anda_skoa

    Qt Code:
    1. ui->tbBrowse->setIcon(QIcon (":/images/images/browse.ico"));
    To copy to clipboard, switch view to plain text mode 
    Does the trick, Thanks.

    Regards

Similar Threads

  1. Replies: 0
    Last Post: 21st May 2011, 22:19
  2. push button icon not shows???
    By chandantheracer in forum Newbie
    Replies: 2
    Last Post: 25th February 2011, 12:08
  3. Program that just shows a window
    By claudio-cit in forum Newbie
    Replies: 2
    Last Post: 5th July 2008, 09:55
  4. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03
  5. WYSIWYG html, Window show png icon mac no!
    By patrik08 in forum Qt Programming
    Replies: 10
    Last Post: 25th May 2006, 12:01

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.