简体   繁体   English

如何将 QCheckBox 小部件的复选框放在右侧,文本左对齐

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

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? Qt 是否提供了一种使用 Qt 样式表配置 QCheckBox 布局的方法,以便文本保持与右侧对齐但复选框位于最右侧?

You can use QCheckBox::setLayoutDirection(Qt::LayoutDirection direction) :您可以使用QCheckBox::setLayoutDirection(Qt::LayoutDirection direction)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM