Results 1 to 7 of 7

Thread: QToolbar - change icon at runtime ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QToolbar - change icon at runtime ?

    use the name of the action instead of ations()->first()

  2. #2
    Join Date
    Oct 2010
    Posts
    95
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QToolbar - change icon at runtime ?

    Thanks,

    How can I use the name of the action, there is no findAction("") method ?

    Also actions() is empty in my main window ! do you know why ?

  3. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QToolbar - change icon at runtime ?

    somewhere in your code must be something like this:

    Qt Code:
    1. QAction myAction;
    To copy to clipboard, switch view to plain text mode 

    if you create your form via QtDesigner, you have to create all actions via the action editor. there you give each action a name. You can access your actions the same way as each other gui-element.

  4. #4
    Join Date
    Feb 2010
    Location
    Poland
    Posts
    27
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QToolbar - change icon at runtime ?

    Qt Code:
    1. ui->toolBar->actions().first()->setIcon(QIcon(":/images/pause.png"));
    To copy to clipboard, switch view to plain text mode 
    ?

Similar Threads

  1. override shortcut icon in QToolBar
    By sudhansu in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2010, 08:20
  2. Flat Icon in a QToolBar
    By schall_l in forum Qt Programming
    Replies: 8
    Last Post: 23rd June 2009, 09:31
  3. how change language at runtime?
    By mattia in forum Newbie
    Replies: 3
    Last Post: 14th November 2007, 18:36
  4. Various icon sizes for QToolButtons on QToolbar
    By Erlendhg in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2007, 18:35
  5. QToolBar icon size
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 29th March 2007, 13:12

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.