Results 1 to 6 of 6

Thread: QMenu does not show icons from QAction

  1. #1
    Join Date
    May 2011
    Location
    Germany, Hamburg
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QMenu does not show icons from QAction

    Hello,
    I created some QAction objects like this:

    Qt Code:
    1. moveFractalUp = new QAction(QIcon(":/img/res/img/go-up.svg"), "Move up", this);
    2. connect(moveFractalUp, SIGNAL(triggered()), this, SLOT(MoveFractalUp()));
    To copy to clipboard, switch view to plain text mode 

    And I added this actions to my toolbar, like this:
    Qt Code:
    1. navigationToolBar = addToolBar("Navigation");
    2. navigationToolBar->addAction(moveFractalDown);
    To copy to clipboard, switch view to plain text mode 

    This works well. The actions-icons are shown in the toolbar. But now I create a menu like this:
    Qt Code:
    1. fractalNavigationMenu = menuBar()->addMenu("Fractal &navigation");
    2. fractalNavigationMenu->addAction(moveFractalDown);
    To copy to clipboard, switch view to plain text mode 

    The menu entries are created and they are functional, but the icons are not shown.
    What am I doing wrong?

    greeting eumel1990

  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: QMenu does not show icons from QAction

    Do the icons show up if you run your application with "-style plastique" parameters?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2011
    Location
    Germany, Hamburg
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu does not show icons from QAction

    Hi, thanks for your reply. No the icons won't be shown up, even when a set the -style plastique parameter. But it looks sweet

    Greetings eumel1990

  4. #4
    Join Date
    May 2011
    Location
    Germany, Hamburg
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu does not show icons from QAction

    Does anybody have an idea?

  5. #5
    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: QMenu does not show icons from QAction

    Please prepare a minimal compilable example reproducing the problem. Check if the icons show up if you use png instead of svg.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    May 2011
    Location
    Germany, Hamburg
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu does not show icons from QAction

    Sorry for the late answer, I didn't worked on this program...
    I changed my Qt framework to 4.7.4 desktop and now it works. I think my old Qt compilation was bad.
    Greetings eumel1990

Similar Threads

  1. Can't disable a QAction in QMenu
    By punkypogo in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2010, 14:07
  2. how to add QMenu or QAction inside QDesigner
    By eric_vi in forum Qt Tools
    Replies: 1
    Last Post: 2nd August 2009, 16:48
  3. QAction text color (QMenu)
    By StefanK in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2009, 15:14
  4. QPushButton QMenu QAction
    By hgedek in forum Newbie
    Replies: 2
    Last Post: 1st November 2007, 12:29
  5. Replies: 2
    Last Post: 23rd February 2006, 16:38

Tags for this Thread

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.