QComboBox 没有右对齐

QComboBox not aligning to right

我有一个 QHBoxLayout,我想在右边添加一些 children,在左边添加一些:

label = new QLabel(...);
layout->addItem(label);
layout->setAlignment(label, Qt::AlignLeft);
select = new QComboBox(...);
layout->addItem(select);
layout->setAlignment(select, Qt::AlignRight);

但是 select 没有右对齐...有什么想法吗?

QCheckBoxQLabel 都没有,但使用 QSlider

可以正常工作
QHBoxLayout * layout = new QHBoxLayout(this);
QLabel * label = new QLabel("this is label");
layout->addWidget(label, Qt::AlignLeft);
layout->setAlignment(label, Qt::AlignLeft);
QComboBox * select = new QComboBox(this);
layout->addWidget(select);
layout->setAlignment(select, Qt::AlignRight);