[Qt] No icons on QT top-level menuitems

zeljko zeljko at holobit.net
Wed Nov 9 11:39:16 CET 2011


On Wednesday 09 of November 2011 11:24:44 Juha Manninen wrote:
> Zeljan
> 
> I changed :
> 
> TQtWSMenuItem.AttachMenu
> TQtWSMenuItem.CreateMenuFromMenuItem
> TQtWSMenuItem.CreateHandle
> 
> and added method TQtMenuBar.addMenuWithIcon.
> 
> The problem I was trying to solve is that icons don't show on top-level QT
> menuitems. They show nicely with GTK2 and Windows bindings.
> There was another related problem: when there was an icon (ImageIndex)
> defined for a top-level menuitem then icons from all sub-menus disappeared,
> too.
> It was easy to fix by not setting icon for the QT top-level menus in
> CreateHandle.
> 
> I still failed to fix the problem properly. I was able to get either text
> or icon to show but not both. Is it possible that QT can't do it?
> There is even an API call that takes both icon and title as params. See
> below.
> 
> My experimental TQtMenuBar.addMenuWithIcon calls
>   QMenuBar_addMenu(handle: QMenuBarH; icon: QIconH; title: PWideString)
> in hope that both text and icon would show. They don't. Only icon shows and
> sub-menus don't work. The func returns QMenuH which should be used somehow
> I guess.
> 
> I also refactored TQtMenuBar.SetActions out from TQtMenuBar.insertMenu.
> While debugging it I noticed that after each menu item addition it clears
> GlobalActions and then fills it.
> It slows down polynomially when menu items are added. Yet, it does not
> cause a visible slowdown.
> 
> I don't have more ideas. Could you please look at the icon related code.

When did you changed ? svn ?

Icons are shown in menus if theme/style says so, so I don't know why would you 
change code ? I don't understand what's goal of such change.

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20111109/f2f5cdce/attachment-0002.html>


More information about the Qt mailing list