Customize QMenu
-
Hi All,
I want to customize the QMenu in Qt. I want File,Edit,View and Help Menu to be displayed with text as well as image. I mean File text and image should be displayed same way for other Edit,View and Help menu.
How can i do this ? Any suggestion
Thanks,
Neel -
If you are using designer is very simple. When you add a menu, you'll have settings in sidebar. Just search for icon.
If you are creating menu from code, use this function "setIcon":http://qt-project.org/doc/qt-4.8/qaction.html#icon-prop .
Hope I understood your problem correctly.
Regards,
Jake -
you are right . we can set through setIcon but i want both image and text together in QMenu. Right now at a time from application one will come.
How to do that ?
Thanks,
Neel -
use
@
menu->addAction(icon, text);
@or
@
action->setText(text);
@ -
If the concept is unclear, look at how QActions and QMenu work together first. A good reference is here: http://cartan.cas.suffolk.edu/oopdocbook/html/menus.html
-
thanks for your reply. I will check..