Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] How to make a part of a checkbox's text bold?
QtWS25 Last Chance

[Solved] How to make a part of a checkbox's text bold?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 9.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    SO
    @ui->checkBox_3->setText("<b>"+(tr("I want this bold"))+"</b> ("+(tr("And this not bold"))+")");@
    The text of the checkbox will be somehow like <b>I want this bold</b> (And this not bold)
    I know that Checkboxes don't understand rich text. So what should i do?

    PS The editor makes the < b > [ b ] without spaces :)....

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      What I would do, is don't use the test of the checkbox itself, but use a QLabel instead. QLabel does understand rich text.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dbzhang800
        wrote on last edited by
        #3

        [quote author="Andre" date="1309931519"]What I would do, is don't use the test of the checkbox itself, but use a QLabel instead. QLabel does understand rich text. [/quote]

        I agree with you and I think this is the easiest way.

        Subclass QProxyStyle and override
        @
        void QProxyStyle::drawControl (ComplexControl control, const QStyleOptionComplex * option, QPainter * painter, const QWidget * widget = 0 ) const [virtual]
        @
        for QStyle::CE_CheckBoxLabel may be possible.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leon
          wrote on last edited by
          #4

          Οκ i will put a label.. No problem!

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved