SetText of QCheckBox in stylesheet ?



  • IS it possible to set Text of QCheckBox in stylesheet dependend on state ?
    Already using similar approach to change indicator of checkbox :

    @ ui->checkBox->setStyleSheet(QString("QCheckBox::indicator {"
    "image: url(:/images/checkbox_circle_green.png);"
    "}"
    "QCheckBox::indicator:unchecked {"
    "image: url(:/images/checkbox_circle_red.png);"
    "}"
    ));
    @

    I would like to set text "connect" / "disconnect" on state unchecked / checked.



  • Well, you could always use an image instead of text, but I assume a style sheet does not change content, only its layout.


  • Lifetime Qt Champion

    Hi,

    IIRC, you can change a QObject property using something like

    @QPushButton { qproperty-iconSize: 20px 20px; }@

    It should be adaptable to QCheckBox's text


Log in to reply
 

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