From 10:00 CET Friday 22nd November we will adjust how the server works to deal with some recently reported problems. Therefore there may be a load problem, if you experience more problems than usual trying to access the forum then please PM AndyS or any of the moderators so they can inform me.


[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