[英]How to align QFormLayout in a QGroupBox by Horizontal center
我无法理解如何按中心对齐分组框中的表单布局。
这就是我希望它工作的方式。 (正确的)
这就是它现在的工作方式。 (错误的)
这是代码。
mainWinGroupBox = new QGroupBox(tr("Window Settings"));
mainWinGroupBox->setAlignment(Qt::AlignHCenter);
auto fWinLayout = new QFormLayout;
fWinLayout->setFormAlignment(Qt::AlignHCenter);
fWinLayout->addRow(tr("&Tray:"), trayCheckBox);
WindowWidthSB->setFixedSize(42, 20);
WindowWidthSB->setRange(0, 1920);
WindowWidthSB->setSingleStep(10);
fWinLayout->addRow(tr("&Window Width:"), WindowWidthSB);
WindowHeightSB->setFixedSize(42, 20);
WindowHeightSB->setRange(0, 1080);
WindowHeightSB->setSingleStep(10);
fWinLayout->addRow(tr("&Window Height:"), WindowHeightSB);
mainWinGroupBox->setLayout(fWinLayout);
您可以将标签与此属性QFormLayout::labelAlignment 对齐。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.