PDA

View Full Version : Why QAction inside Qmenu doesn't display Icon ?



jpujolf
18th December 2009, 00:09
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 !! :confused: :confused:

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

Lykurg
18th December 2009, 01:19
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?

jpujolf
18th December 2009, 02:35
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...

Lykurg
18th December 2009, 08:41
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.

jpujolf
18th December 2009, 08:55
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... :D


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 :crying:


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 !!

yonnak
18th December 2009, 12:15
Hi,

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

Could be that....

jpujolf
18th December 2009, 12:36
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.

yonnak
18th December 2009, 16:55
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.

jpujolf
21st December 2009, 13:51
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. :confused: :confused:

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...