Important: Please read the Qt Code of Conduct -

QCheckBox, box at the right text at the left, how?

  • I want instead of
    qcheckbox: box text
    qcheckbox: text box.

    I try this:
    auto cb = new QCheckBox(text, this);
    cb->setStyleSheet(QStringLiteral(" QCheckBox { text-align: left top; } QCheckBox::indicator { subcontrol-origin: padding; subcontrol-position: right top; }"));

    Yes, "box" at now placed at the right, but "text" is disappear,
    Looks like it paint at the right of the box, and becase of box placed at the right of widget,
    it is not visible.

    So question, how can I place text at the left of the box, may be without stylesheet usage,
    if stylesheet is buggy.

  • you just need to use the setLayout direction

  • Thanks,



Log in to reply