How can i update QMenu and sub menu title text 's dynamically
-
i have QMenu that holds sub menu
i like to be able to update each menu title string dynamccly for example
i have this menu@[main menu ] Groups 2
[sub menu] group_X 3
[sub menu] group_Y 1@i like to be able to change only the numbers part of the string in each menu entry from my application
which approach should i peek ?Thanks
-
You can simply change the text property of the "QAction":http://doc.qt.nokia.com/latest/qaction.html#text-prop that the menu item represents.
-
You can't. The "%1" is "lost" when you call QString::arg().
If you want to just update the "%1" part, you need to store the original QString somewhere, and use it again, with arg(), to create the updated menu title.
Alternatively, you could search the existing title for a number, and replace the number.