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



  • 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 :)....



  • 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 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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.