Results 1 to 5 of 5

Thread: Secont ToolBar with Icon

  1. #1
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Secont ToolBar with Icon

    Hallo Forum,

    I am new in Qt and I have a Question in Designing a GUI in Qt 4.7.1.
    We have a "Standard GUI" with a ToolBar with a lot of Icons, listed in the file
    gui/res/images.qrc
    In a special "Service Mode" we create a second Toolbar which is added while Runtime, those icons are listed an other folder in the file
    gui-service/res/images.qrc
    Problem: The Service Action works well, but there icons are serched in the "Standard Path".
    How it is possible to get access to the icons listed in the file app-gui.service/res/images.qrc?

    Thank You.

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Secont ToolBar with Icon

    Hi,

    Try this:
    Qt Code:
    1. QIcon qIcon(":/myResource/icon1.png");
    To copy to clipboard, switch view to plain text mode 

    Note that ":" points to the resource file.
    Òscar Llarch i Galán

  3. #3
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Secont ToolBar with Icon

    Thanks.

    Sorry, mistake of me.
    The other file gui-service/res/images.qrc is not a part of the "normal GUI" ui-File.
    At first we had a second Service-GUI.ui file.
    Now our ServiceGui class is subclassed from the normal GUI class, so the qrc file is stand allown.

    Rod

  4. #4
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Secont ToolBar with Icon

    You can use the static function QResource::registerResource
    after you have used rcc on the .qrc file

    More info on http://qt-project.org/doc/qt-4.8/resources.html

  5. #5
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Secont ToolBar with Icon

    @Rhayader: Thank You, the link was precise, now it works perfect.

Similar Threads

  1. Replies: 5
    Last Post: 19th March 2010, 05:33
  2. Select element ID from SVG file for toolbar icon?
    By JesperWe in forum Qt Programming
    Replies: 0
    Last Post: 18th December 2009, 16:21
  3. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03
  4. Toolbar and icon size
    By MrGarbage in forum Qt Programming
    Replies: 0
    Last Post: 8th January 2008, 21:27
  5. toolbar icon sizes...
    By soul_rebel in forum KDE Forum
    Replies: 2
    Last Post: 20th March 2006, 19:21

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.