本文整理汇总了C++中QDialogButtonBox::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::layout方法的具体用法?C++ QDialogButtonBox::layout怎么用?C++ QDialogButtonBox::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
SettingsPageAirspaceWarningsNumPad::SettingsPageAirspaceWarningsNumPad(QWidget *parent) :
QWidget(parent, Qt::WindowStaysOnTopHint)
{
setObjectName("SettingsPageAirspaceWarningsNumPad");
setAttribute( Qt::WA_DeleteOnClose );
setWindowFlags( Qt::Tool );
setWindowModality( Qt::WindowModal );
setWindowTitle(tr("Airspace warning settings"));
if( MainWindow::mainWindow() )
{
// Resize the window to the same size as the main window has. That will
// completely hide the parent window.
resize( MainWindow::mainWindow()->size() );
}
// save current altitude unit. This unit must be considered during
// storage. The internal storage is always in meters.
m_altUnit = Altitude::getUnit();
QVBoxLayout *topLayout = new QVBoxLayout(this);
QGroupBox* warningGroup = new QGroupBox(this);
QHBoxLayout* warningLayout = new QHBoxLayout(warningGroup);
m_enableWarning = new QCheckBox(tr("Enable Warnings"));
m_enableWarning->setChecked(true);
connect( m_enableWarning, SIGNAL(toggled(bool)), SLOT(slot_enabledToggled(bool)));
warningLayout->addWidget( m_enableWarning );
topLayout->addWidget( warningGroup );
m_distanceGroup = new QGroupBox(tr("Distances"), this);
topLayout->addWidget(m_distanceGroup);
int row = 0;
QGridLayout* mVGroupLayout = new QGridLayout(m_distanceGroup);
mVGroupLayout->setHorizontalSpacing(10);
mVGroupLayout->setVerticalSpacing(10);
mVGroupLayout->setRowMinimumHeight ( row++, 8 );
// row 0
QLabel* lbl;
lbl = new QLabel(tr("Lateral"), m_distanceGroup);
mVGroupLayout->addWidget(lbl, row, 0 );
lbl = new QLabel(tr("Above"), m_distanceGroup);
mVGroupLayout->addWidget(lbl, row, 1 );
lbl = new QLabel(tr("Below"), m_distanceGroup);
mVGroupLayout->addWidget(lbl, row, 2 );
row++;
//row 1
lbl = new QLabel(tr("Near"), m_distanceGroup);
mVGroupLayout->addWidget(lbl, row, 3, Qt::AlignLeft|Qt::AlignVCenter);
m_horiWarnDist = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_horiWarnDist, row, 0);
m_aboveWarnDist = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_aboveWarnDist, row, 1);
m_belowWarnDist = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_belowWarnDist, row, 2);
row++;
// row 2
lbl = new QLabel(tr("Very Near"), m_distanceGroup);
mVGroupLayout->addWidget(lbl, row, 3, Qt::AlignLeft|Qt::AlignVCenter);
m_horiWarnDistVN = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_horiWarnDistVN, row, 0);
m_aboveWarnDistVN = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_aboveWarnDistVN, row, 1);
m_belowWarnDistVN = createNumEd( m_distanceGroup );
mVGroupLayout->addWidget(m_belowWarnDistVN, row, 2);
row++;
topLayout->addSpacing(20);
topLayout->addStretch(10);
m_defaults = new QPushButton(tr("Default"));
QDialogButtonBox* buttonBox = new QDialogButtonBox( Qt::Horizontal );
buttonBox->layout()->setSpacing(30);
buttonBox->addButton( m_defaults, QDialogButtonBox::ActionRole );
buttonBox->addButton( QDialogButtonBox::Ok );
buttonBox->addButton( QDialogButtonBox::Cancel );
topLayout->addWidget( buttonBox );
connect(m_defaults, SIGNAL(clicked()), this, SLOT(slot_defaults()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slot_save()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(slot_reject()));
slot_load();
}