Results 1 to 2 of 2

Thread: Bold a menu.addAction item

  1. #1
    Join Date
    Jan 2017
    Posts
    54
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Bold a menu.addAction item

    I would like to bold the first line in a menu.

    Qt Code:
    1. menu = QMenu()
    2. menu.addAction('Reports if Single or Married')
    3. menu.addAction(' Your Annual SS at Each Start Month/Age', self.yourssmonthly)
    4. menu.addAction(' Spouse Annual SS at Each Start Month/Age', self.spssmonthly)
    5. menu.addAction(' Your and Spouse Annual SS on One Page', self.both_annual)
    To copy to clipboard, switch view to plain text mode 

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

    thanks

  2. #2
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Bold a menu.addAction item

    addAction returns a a QAction. That action has a font-property, and that font can be bold.

    So something like

    Qt Code:
    1. QAction* action = menu.addAction("...");
    2. QFont font = action->font();
    3. font.setBold(true);
    4. action->setFont(font);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 3
    Last Post: 27th March 2018, 07:19
  2. using invokeMethod for menu addAction
    By dwizard in forum Newbie
    Replies: 1
    Last Post: 27th June 2013, 07:31
  3. Replies: 1
    Last Post: 4th November 2011, 12:25
  4. Replies: 12
    Last Post: 21st November 2008, 05:42
  5. Menu Item has no highlight
    By blackfox in forum Qt Programming
    Replies: 6
    Last Post: 24th September 2008, 13:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.