How to place the checkbox of a QCheckBox widget on the right, and text left-justified

646 Views Asked by At

Does Qt offer a way to configure the layout of a QCheckBox with Qt Stylesheets so that the text remains aligned to the right but the checkbox is placed on the far right?

1

There are 1 best solutions below

0
Mat On

You can use QCheckBox::setLayoutDirection(Qt::LayoutDirection direction):

auto chkB = new QCheckBox("some example");
 chkB->setLayoutDirection(Qt::RightToLeft);