Results 1 to 9 of 9

Thread: Why QAction inside Qmenu doesn't display Icon ?

  1. #1
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Why QAction inside Qmenu doesn't display Icon ?

    Hi all,

    I recently migrated my "old" Qt 4.5.3 QtCreator 1.2.0 to 4.6.0 / 1.3.0. All is working OK, but I've found a little bug, I presume, that is annoying for me and final users.

    It only happens on Qt 4.6.0 machines ( 4 people, 2 migrated 2 with old versions ) and both 4.6.0 have the same problem.

    If you compile the attached micro-program that only shows a QMainWindow and has a contextual menu ( right mouse button ). It doesn't show icons associated to actions !!

    The icons were there and where shown with Qt 4.5.3, and suddenly dissapeared when I upgraded to the next version.

    Anyone can test & reproduce the bug ? It's a minor one, but all my application's contextual menus are full of icons and none of them is shown now...

    Grrrr

    Before opening a bug in Nokia's bug tracker I want to be sure it's a common problem ( I want to test it in more than 2 machines... )

    Thanks a lot
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    sorry, works fine on my machine. Do you have compiled the png support probably and/or removed all the old files inclusive the MAKE file?

  3. #3
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    I've made this little and simple test to show the error. And fails on my machine. I have Ubuntu 9.10-64 bit anb Qt SDK installed from "qt-sdk-linux-x86_64-commercial-2009.05.bin" file. It also installed QtCreator 1.3.0

    I can show png files, in my app. I really do it, so it may not be png support. But if I try to show an icon as an action in a QMenu, a blank space is shown in place of the icon. Strange behaviour...

    I attach an screenshot of what I mean. The top toolbar has the same actions used in the context menu. They're shown in the toolbar but not in the context menu.

    That's what I would say. As you can see, the contextual menu, that has to show a plus sign can show it in a QToolBar's action, but not on QMenu's action ). Almost weird...
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    Quote Originally Posted by jpujolf View Post
    I can show png files, in my app. I really do it, so it may not be png support.
    Yeah, I belief you it was just a guess since it works on my side: Kubuntu 9.10 with the open source variant of 2009.05.

    Another guess is that maybe your application style does not set the icon. Try "./Test -style plastique" and see if the icons are shown.

    If not I would open a bug. And if you have time, you fist can try the open source version and see if it is related to the commercial version.

  5. The following user says thank you to Lykurg for this useful post:

    jpujolf (18th December 2009)

  6. #5
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    Quote Originally Posted by Lykurg View Post
    Yeah, I belief you it was just a guess since it works on my side: Kubuntu 9.10 with the open source variant of 2009.05.
    OK, don't worry. I only was trying to explaion me better...

    Another guess is that maybe your application style does not set the icon. Try "./Test -style plastique" and see if the icons are shown.
    I tested, and it doesn't work

    If not I would open a bug. And if you have time, you fist can try the open source version and see if it is related to the commercial version.
    I will make a try, but I've opened a bug already, because it's clearly a bug.

    Does not break functionality but looses totally the look & feel of my application.

    Thanks anyway !!
    Last edited by jpujolf; 18th December 2009 at 08:56. Reason: reformatted to look better

  7. #6
    Join Date
    Oct 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    Hi,

    If you are using Qt 4.6, there is a new property on QAction named "iconVisibleInMenu"

    Could be that....

  8. #7
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    Quote Originally Posted by yonnak View Post
    Hi,

    If you are using Qt 4.6, there is a new property on QAction named "iconVisibleInMenu"

    Could be that....
    Could be, but this property appeared on Qt 4.4, and I've experienced the misfunction from 4.5.3 to 4.6 and rarely trolls change behaviour in that sense without any advise

    I think it's a regression. I've been looking at QMenu's code and I cannot see nothing wrong.

  9. #8
    Join Date
    Oct 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Why QAction inside Qmenu doesn't display Icon ?

    I was thinking about that because I had the same problem.
    It was OK with 4.5 but in 4.6, no more icons in the main menuBar, checking this property for each action in designer and recompiling it solved the problem.

    Edit Maybe not linked with 4.6 but with the new version of QtCreator, as long as I install the complete SDK.

  10. #9
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [SOLVED] Why QAction inside Qmenu doesn't display Icon ?

    As yonnak said, is was "iconVisibleInMenu" property. Beginning at 4.6.0 version is set to false ( on 4.5.3 was set to true by default )

    So is a behaviour change. I don't know why, but trolls decided to set this flag to false without advice.

    So changing ALL the places where i use a QAction solved the problem. Not nice, but is a workaround for me.

    Anyway, the "BUG" is open, to obtain at least an explanation about this change...

Similar Threads

  1. how to add QMenu or QAction inside QDesigner
    By eric_vi in forum Qt Tools
    Replies: 1
    Last Post: 2nd August 2009, 17:48
  2. QAction Icon
    By ashishsaryar in forum Qt Programming
    Replies: 3
    Last Post: 31st December 2008, 08:24
  3. QStyle : how to make the QMenu display in middle?
    By nish in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 27th November 2008, 11:39
  4. How to change Icon size in QMenu?
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 3rd September 2008, 15:16
  5. Replies: 2
    Last Post: 23rd February 2006, 17:38

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.