Lazarus

Programming => Widgetset => QT => Topic started by: Ocye on September 15, 2012, 11:29:13 am

Title: [solved] Imagelist of popup menu is not updated at runtime
Post by: Ocye on September 15, 2012, 11:29:13 am
I use an imagelist to show icons with popup menu items. When the content of the imagelist is modified at runtime (delete/insert) these changes are not applied to the menu. The imagelist contains the new picture - a simple GetBitmap() and Draw() works well. But how can I update the popup menu?

Tested with Qt for Linux and Darwin (and successfully with Gtk2 and win32/64).

PS: A simple PopupMenu.Images:=nil; ImageList.Delete/Insert; PopupMenu.Images:ImageList; does the trick.
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: Dibo on September 15, 2012, 12:42:01 pm
PS: A simple PopupMenu.Images:=nil; ImageList.Delete/Insert; PopupMenu.Images:ImageList; does the trick.
Yes. I got the same problem with TListView long time ago and this same trick solved problem. But I reported it on bug tracker and it is fixed now. PopMenu probably has same bug with cache.
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: Ocye on September 15, 2012, 12:51:39 pm
Maybe it's not a LCL bug but a Qt feature  :o
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: zeljko on September 15, 2012, 09:50:23 pm
Please open an issue about it and attach example.
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: Ocye on September 15, 2012, 10:48:04 pm
Please open an issue about it and attach example.
done (http://bugs.freepascal.org/view.php?id=22896)
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: zeljko on September 16, 2012, 11:15:28 am
Fixed :)
Title: Re: Imagelist of popup menu is not updated at runtime
Post by: Ocye on September 16, 2012, 11:56:03 am
Thanks!  :D