FloatEnvironmentDialog::FloatEnvironmentDialog(KConfig *config, KileInfo *ki, QWidget *parent) : Wizard(config, parent), m_ki(ki) { QWidget *page = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(page); m_FloatDialog.setupUi(page); m_prefix = "fig:"; m_FloatDialog.m_edLabel->setText(m_prefix); slotEnvironmentClicked(); setFocusProxy(m_FloatDialog.m_edCaption); mainLayout->addWidget(buttonBox()); connect(buttonBox(), &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox(), &QDialogButtonBox::rejected, this, &QDialog::reject); connect(m_FloatDialog.m_rbFigure, &QRadioButton::clicked, this, &FloatEnvironmentDialog::slotEnvironmentClicked); connect(m_FloatDialog.m_rbTable, &QRadioButton::clicked, this, &FloatEnvironmentDialog::slotEnvironmentClicked); connect(this, &QDialog::accepted, this, &FloatEnvironmentDialog::slotAccepted); }
FloatEnvironmentDialog::FloatEnvironmentDialog(KConfig *config, KileInfo *ki, QWidget *parent) : Wizard(config,parent), m_ki(ki) { QWidget *page = new QWidget(this); setMainWidget(page); QGridLayout *grid = new QGridLayout(page, 6,2, 8,8); // environment groupbox QButtonGroup *egroup = new QButtonGroup( i18n("Environment"),page); egroup->setColumnLayout(0, Qt::Vertical ); egroup->layout()->setSpacing( 6 ); egroup->layout()->setMargin( 11 ); QGridLayout *egrouplayout = new QGridLayout( egroup->layout() ); egrouplayout->setAlignment( Qt::AlignTop ); m_rbFigure = new QRadioButton(i18n("&Figure"), egroup); m_rbTable = new QRadioButton(i18n("T&able"), egroup); egrouplayout->addWidget( m_rbFigure, 0,0 ); egrouplayout->addWidget( m_rbTable, 0,1 ); // position groupbox QButtonGroup *pgroup = new QButtonGroup( i18n("Position"),page); pgroup->setColumnLayout(0, Qt::Vertical ); pgroup->layout()->setSpacing( 6 ); pgroup->layout()->setMargin( 11 ); QGridLayout *pgrouplayout = new QGridLayout( pgroup->layout() ); pgrouplayout->setAlignment( Qt::AlignTop ); QLabel *label1 = new QLabel(i18n("Here exact:"), pgroup); QLabel *label2 = new QLabel(i18n("Top of page:"), pgroup); QLabel *label3 = new QLabel(i18n("Bottom of page:"), pgroup); QLabel *label4 = new QLabel(i18n("Extra page:"), pgroup); m_cbHere = new QCheckBox(pgroup); m_cbTop = new QCheckBox(pgroup); m_cbBottom = new QCheckBox(pgroup); m_cbPage = new QCheckBox(pgroup); pgrouplayout->addWidget( label1, 0,0 ); pgrouplayout->addWidget( label2, 1,0 ); pgrouplayout->addWidget( label3, 0,2 ); pgrouplayout->addWidget( label4, 1,2 ); pgrouplayout->addWidget( m_cbHere, 0,1 ); pgrouplayout->addWidget( m_cbTop, 1,1 ); pgrouplayout->addWidget( m_cbBottom, 0,3 ); pgrouplayout->addWidget( m_cbPage, 1,3 ); // center environment QLabel *label5 = new QLabel(i18n("Center:"),page); m_cbCenter = new QCheckBox(page); // Caption QLabel *label6 = new QLabel(i18n("Ca&ption:"),page); m_edCaption = new KLineEdit("",page); m_edCaption->setMinimumWidth(300); label6->setBuddy(m_edCaption); // Label QLabel *label7 = new QLabel(i18n("&Label:"),page); m_edLabel = new KLineEdit("",page); m_edLabel->setMinimumWidth(300); label7->setBuddy(m_edLabel); // add widgets grid->addMultiCellWidget( egroup, 0,0,0,1 ); grid->addMultiCellWidget( pgroup, 1,1,0,1 ); grid->addWidget(label5,2,0); grid->addWidget(label6,3,0); grid->addWidget(label7,4,0); grid->addWidget(m_cbCenter,2,1); grid->addWidget(m_edCaption,3,1); grid->addWidget(m_edLabel,4,1); // default values m_cbCenter->setChecked(true); m_cbHere->setChecked(true); m_cbTop->setChecked(true); m_cbPage->setChecked(true); m_rbFigure->setChecked(true); m_prefix = "fig:"; m_edLabel->setText(m_prefix); slotEnvironmentClicked(); grid->setRowStretch(5,1); setFocusProxy( m_edCaption ); // signals and slots connect(m_rbFigure, SIGNAL(clicked()), this, SLOT(slotEnvironmentClicked())); connect(m_rbTable, SIGNAL(clicked()), this, SLOT(slotEnvironmentClicked())); }