PDA

View Full Version : Bold a menu.addAction item



dennisvz
3rd May 2019, 02:01
I would like to bold the first line in a menu.



menu = QMenu()
menu.addAction('Reports if Single or Married')
menu.addAction(' Your Annual SS at Each Start Month/Age', self.yourssmonthly)
menu.addAction(' Spouse Annual SS at Each Start Month/Age', self.spssmonthly)
menu.addAction(' Your and Spouse Annual SS on One Page', self.both_annual)


I would like to bold the "Reports if Single or Married" line only -- not the rest of the items, but need help.

thanks

tuli
3rd May 2019, 08:08
addAction returns a a QAction. That action has a font-property, and that font can be bold.

So something like


QAction* action = menu.addAction("...");
QFont font = action->font();
font.setBold(true);
action->setFont(font);