[英]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.