void tst_QFormLayout::spacing()
{
    //TODO: confirm spacing behavior
    QWidget *w = new QWidget;
    CustomLayoutStyle *style = new CustomLayoutStyle;
    style->hspacing = 5;
    style->vspacing = 10;
    w->setStyle(style);
    QFormLayout *fl = new QFormLayout(w);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    //QCOMPARE(fl->spacing(), -1);
    fl->setVerticalSpacing(5);
    QCOMPARE(5, fl->horizontalSpacing());
    QCOMPARE(5, fl->verticalSpacing());
    //QCOMPARE(fl->spacing(), 5);
    fl->setVerticalSpacing(-1);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    style->hspacing = 5;
    style->vspacing = 5;
    //QCOMPARE(fl->spacing(), 5);

    fl->setHorizontalSpacing(20);
    //QCOMPARE(fl->spacing(), -1);
    style->vspacing = 20;
    QCOMPARE(fl->horizontalSpacing(), 20);
    QCOMPARE(fl->verticalSpacing(), 20);
    //QCOMPARE(fl->spacing(), 20);
    fl->setHorizontalSpacing(-1);
    //QCOMPARE(fl->spacing(), -1);
    style->hspacing = 20;
    //QCOMPARE(fl->spacing(), 20);



    // Do not assert if spacings are negative (QTBUG-34731)
    style->vspacing = -1;
    style->hspacing = -1;
    QLabel *label = new QLabel(tr("Asserts"));
    QCheckBox *checkBox = new QCheckBox(tr("Yes"));
    fl->setWidget(0, QFormLayout::LabelRole, label);
    fl->setWidget(1, QFormLayout::FieldRole, checkBox);
    w->resize(200, 100);
    w->show();
    QVERIFY(QTest::qWaitForWindowExposed(w));

    delete w;
    delete style;
}
Exemple #2
0
LyricsDialog::LyricsDialog(const Song &s, QWidget *parent)
    : Dialog(parent)
    , prev(s)
{
    QWidget *mw=new QWidget(this);
    QGridLayout *mainLayout=new QGridLayout(mw);
    QWidget *wid = new QWidget(mw);
    QFormLayout *layout = new QFormLayout(wid);
    int row=0;
    QLabel *lbl=new QLabel(i18n("If Cantata has failed to find lyrics, or has found the wrong ones, "
                                "use this dialog to enter new search details. For example, the current "
                                "song may actually be a cover-version - if so, then searching for "
                                "lyrics by the original artist might help.\n\nIf this search does find "
                                "new lyrics, these will still be associated with the original song title "
                                "and artist as displayed in Cantata."), mw);
    lbl->setWordWrap(true);
    QLabel *icn=new QLabel(mw);
    icn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    int iconSize=48;
    icn->setMinimumSize(iconSize, iconSize);
    icn->setMaximumSize(iconSize, iconSize);
    icn->setPixmap(Icon("dialog-information").pixmap(iconSize, iconSize));
    mainLayout->setMargin(0);
    layout->setMargin(0);
    mainLayout->addWidget(icn, 0, 0, 1, 1);
    mainLayout->addWidget(lbl, 0, 1, 1, 1);
    mainLayout->addItem(new QSpacerItem(8, 4, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
    mainLayout->addWidget(wid, 2, 0, 1, 2);
    titleEntry = new LineEdit(wid);
    artistEntry = new LineEdit(wid);

    layout->setWidget(row, QFormLayout::LabelRole, new QLabel(i18n("Title:"), wid));
    layout->setWidget(row++, QFormLayout::FieldRole, titleEntry);
    layout->setWidget(row, QFormLayout::LabelRole, new QLabel(i18n("Artist:"), wid));
    layout->setWidget(row++, QFormLayout::FieldRole, artistEntry);
    setCaption(i18n("Search For Lyrics"));
    setMainWidget(mw);
    setButtons(Ok|Cancel);
    enableButton(Ok, false);
    connect(titleEntry, SIGNAL(textChanged(const QString &)), SLOT(changed()));
    connect(artistEntry, SIGNAL(textChanged(const QString &)), SLOT(changed()));
    titleEntry->setFocus();
    titleEntry->setText(s.title);
    artistEntry->setText(s.artist);
}
void tst_QFormLayout::itemAt()
{
    QFormLayout layout;

    QWidget w1;
    QWidget w2;
    QWidget w3;
    QWidget w4;
    QWidget w5;
    QHBoxLayout l6;

    layout.setWidget(5, QFormLayout::LabelRole, &w1);
    layout.setWidget(3, QFormLayout::FieldRole, &w2);
    layout.setWidget(3, QFormLayout::LabelRole, &w3);
    layout.addRow(&w4, &w5);
    layout.addRow("Foo:", &l6);

    QCOMPARE(layout.count(), 7);

    QBitArray scoreBoard(7);
    for (int i = 0; i < 7; ++i) {
        QLayoutItem *item = layout.itemAt(i);
        QVERIFY(item != 0);

        if (item->widget() == &w1) {
            scoreBoard[0] = true;
        } else if (item->widget() == &w2) {
            scoreBoard[1] = true;
        } else if (item->widget() == &w3) {
            scoreBoard[2] = true;
        } else if (item->widget() == &w4) {
            scoreBoard[3] = true;
        } else if (item->widget() == &w5) {
            scoreBoard[4] = true;
        } else if (item->layout() == &l6) {
            scoreBoard[5] = true;
        } else if (qobject_cast<QLabel *>(item->widget())) {
            scoreBoard[6] = true;
        }
    }
    QCOMPARE(scoreBoard.count(false), 0);
}
Exemple #4
0
GraphInfo::GraphInfo(QWidget* parent)
    : QGroupBox("Информация о графе", parent)
{
	QFormLayout* graphInfoLayout = new QFormLayout(this);

	m_solutionCostLabel       = new QLabel("Стоимость решения:", this);
	m_solutionCostValue       = new QLabel(this);
	m_numberOfOpenNodesLabel  = new QLabel("Количество раскрытых вершин:", this);
	m_numberOfOpenNodesValue  = new QLabel(this);
	m_totalNumberOfNodesLabel = new QLabel("Количество вершин в графе:", this);
	m_totalNumberOfNodesValue = new QLabel(this);

	graphInfoLayout->setWidget(0, QFormLayout::LabelRole, m_solutionCostLabel);
	graphInfoLayout->setWidget(0, QFormLayout::FieldRole, m_solutionCostValue);
	graphInfoLayout->setWidget(1, QFormLayout::LabelRole, m_numberOfOpenNodesLabel);
	graphInfoLayout->setWidget(1, QFormLayout::FieldRole, m_numberOfOpenNodesValue);
	graphInfoLayout->setWidget(2, QFormLayout::LabelRole, m_totalNumberOfNodesLabel);
	graphInfoLayout->setWidget(2, QFormLayout::FieldRole, m_totalNumberOfNodesValue);

	setStyleSheet("GraphInfo: {background-color: rgba(255, 255, 255, 60)}; QLabel: {background-color: rgba(255, 255, 255, 0)};");
}
void tst_QFormLayout::layoutAlone()
{
    QWidget w;
    QFormLayout layout;
    layout.setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
    w.setLayout(&layout);
    QLabel label("Here is a strange test case");
    layout.setWidget(0, QFormLayout::LabelRole, &label);
    QHBoxLayout hlay;
    layout.setLayout(1, QFormLayout::LabelRole, &hlay);
    QCOMPARE(layout.count(), 2);
    w.show();
    layout.activate();
    QTest::qWait(500);
}
void tst_QFormLayout::takeAt()
{
    QFormLayout layout;

    QWidget w1;
    QWidget w2;
    QWidget w3;
    QWidget w4;
    QWidget w5;
    QHBoxLayout l6;

    layout.setWidget(5, QFormLayout::LabelRole, &w1);
    layout.setWidget(3, QFormLayout::FieldRole, &w2);
    layout.setWidget(3, QFormLayout::LabelRole, &w3);
    layout.addRow(&w4, &w5);
    layout.addRow("Foo:", &l6);

    QCOMPARE(layout.count(), 7);

    for (int i = 6; i >= 0; --i) {
        layout.takeAt(0);
        QCOMPARE(layout.count(), i);
    }
}
WorkbenchPage::WorkbenchPage(QWidget* parent):QWidget(parent), uComboBox(0), wSpinBox(0), hSpinBox(0), pLineEdit(0){
    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    setLayout(mainLayout);

    QGroupBox* defaultSizeGroupBox = new QGroupBox(tr("Default Size"), this);
    QFormLayout* defaultSizeLayout = new QFormLayout(defaultSizeGroupBox);
    defaultSizeGroupBox->setLayout(defaultSizeLayout);
    QLabel* uLabel = new QLabel(tr("Unit:"), this);
    QLabel* wLabel = new QLabel(tr("Width:"), this);
    QLabel* hLabel = new QLabel(tr("Height:"), this);
    uComboBox = new QComboBox(this);
    uComboBox->addItem(tr("Pixel"));
    uComboBox->addItem(tr("Millimeter"));
    uComboBox->addItem(tr("Centimeter"));
    uComboBox->addItem(tr("Meter"));
    uComboBox->addItem(tr("Inch"));
    connect(uComboBox, SIGNAL(activated(const QString&)), this, SLOT(setWorkbenchSizeUnitSuffix(const QString&)));
    wSpinBox = new QSpinBox(this);
    hSpinBox = new QSpinBox(this);
    defaultSizeLayout->setWidget(0, QFormLayout::LabelRole, uLabel);
    defaultSizeLayout->setWidget(0, QFormLayout::FieldRole, uComboBox);
    defaultSizeLayout->setWidget(1, QFormLayout::LabelRole, wLabel);
    defaultSizeLayout->setWidget(1, QFormLayout::FieldRole, wSpinBox);
    defaultSizeLayout->setWidget(2, QFormLayout::LabelRole, hLabel);
    defaultSizeLayout->setWidget(2, QFormLayout::FieldRole, hSpinBox);
    
    mainLayout->addWidget(defaultSizeGroupBox);
    
    QGroupBox* autosaveGroupBox = new QGroupBox(tr("Autosave"), this);
    autosaveGroupBox->setCheckable(true);
    QFormLayout* autosaveLayout = new QFormLayout(autosaveGroupBox);
    autosaveGroupBox->setLayout(autosaveLayout);
    QLabel* pLabel = new QLabel(tr("Path:"), this);
    pLineEdit = new QLineEdit(this);
    QToolButton* pToolButton = new QToolButton(this);
    pToolButton->setText(tr("..."));
    connect(pToolButton, SIGNAL(clicked()), this, SLOT(getAutosavePath()));
    QHBoxLayout* pLayout = new QHBoxLayout();
    pLayout->addWidget(pLineEdit);
    pLayout->addWidget(pToolButton);
    autosaveLayout->setWidget(0, QFormLayout::LabelRole, pLabel);
    autosaveLayout->setLayout(0, QFormLayout::FieldRole, pLayout);
//    autosaveLayout->setWidget(0, QFormLayout::FieldRole, pLineEdit);
    
    mainLayout->addWidget(autosaveGroupBox);
}
void ConverterTool::doLayout()
{
   resize(279, 96);
   QHBoxLayout* hLayout = new QHBoxLayout(this);
      QFormLayout* formLayout = new QFormLayout();
         inputLabel = new QLabel(this);
         inputLineEdit = new QLineEdit(this);
            inputLineEdit->setMinimumSize(QSize(100, 0));
            inputLineEdit->setMaximumSize(QSize(128, 16777215));
         outputUnitsLabel = new QLabel(this);
         outputUnitsLineEdit = new QLineEdit(this);
            outputUnitsLineEdit->setMinimumSize(QSize(40, 0));
            outputUnitsLineEdit->setMaximumSize(QSize(40, 16777215));
         outputLabel = new QLabel(this);
         outputLineEdit = new QLineEdit(this);
            outputLineEdit->setMinimumSize(QSize(100, 0));
            outputLineEdit->setMaximumSize(QSize(128, 16777215));
            outputLineEdit->setReadOnly(true);
         formLayout->setWidget(0, QFormLayout::LabelRole, inputLabel);
         formLayout->setWidget(0, QFormLayout::FieldRole, inputLineEdit);
         formLayout->setWidget(1, QFormLayout::LabelRole, outputUnitsLabel);
         formLayout->setWidget(1, QFormLayout::FieldRole, outputUnitsLineEdit);
         formLayout->setWidget(2, QFormLayout::LabelRole, outputLabel);
         formLayout->setWidget(2, QFormLayout::FieldRole, outputLineEdit);
         formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
      QVBoxLayout* vLayout = new QVBoxLayout();
         QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
         pushButton_convert = new QPushButton(this);
            pushButton_convert->setAutoDefault(false);
            pushButton_convert->setDefault(true);
         QSpacerItem* verticalSpacer2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
         vLayout->addItem(verticalSpacer);
         vLayout->addWidget(pushButton_convert);
         vLayout->addItem(verticalSpacer2);
   hLayout->addLayout(formLayout);
   hLayout->addLayout(vLayout);

   retranslateUi();
}
void HydrometerTool::doLayout()
{
   resize(279, 96);
   QHBoxLayout* hLayout = new QHBoxLayout(this);
     QFormLayout* formLayout = new QFormLayout();
     groupBox_inputSg = new QGroupBox(this);
     groupBox_inputSg->setProperty("configSection", QVariant(QStringLiteral("hydrometerTool")));

     label_inputSg = new BtDensityLabel(groupBox_inputSg);
        label_inputSg ->setContextMenuPolicy(Qt::CustomContextMenu);

     lineEdit_inputSg = new BtDensityEdit(groupBox_inputSg);
        lineEdit_inputSg->setMinimumSize(QSize(80, 0));
        lineEdit_inputSg->setMaximumSize(QSize(80, 16777215));


     label_inputTemp = new BtTemperatureLabel(groupBox_inputSg);
        label_inputTemp ->setObjectName(QStringLiteral("label_inputTemp"));
        label_inputTemp ->setContextMenuPolicy(Qt::CustomContextMenu);

     lineEdit_inputTemp = new BtTemperatureEdit(groupBox_inputSg);
        lineEdit_inputTemp->setMinimumSize(QSize(80, 0));
        lineEdit_inputTemp->setMaximumSize(QSize(80, 16777215));
        lineEdit_inputTemp->setObjectName(QStringLiteral("lineEdit_inputTemp"));


    label_outputSg = new BtDensityLabel(groupBox_inputSg);
        label_outputSg ->setContextMenuPolicy(Qt::CustomContextMenu);

    lineEdit_outputSg = new BtDensityEdit(groupBox_inputSg);
        lineEdit_outputSg->setMinimumSize(QSize(80, 0));
        lineEdit_outputSg->setMaximumSize(QSize(80, 16777215));
        lineEdit_outputSg->setProperty("forcedUnit",QVariant(QStringLiteral("displaySG")));
        lineEdit_outputSg->setReadOnly(true);



#ifndef QT_NO_SHORTCUT
  label_inputSg->setBuddy(lineEdit_inputSg);
  label_inputTemp->setBuddy(lineEdit_inputTemp);
  label_outputSg->setBuddy(lineEdit_outputSg);
#endif  //QT_NO_SHORTCUT



  formLayout->setWidget(0, QFormLayout::LabelRole, label_inputSg);
  formLayout->setWidget(0, QFormLayout::FieldRole, lineEdit_inputSg);
  formLayout->setWidget(1, QFormLayout::LabelRole, label_inputTemp);
  formLayout->setWidget(1, QFormLayout::FieldRole, lineEdit_inputTemp);
  formLayout->setWidget(2, QFormLayout::LabelRole, label_outputSg);
  formLayout->setWidget(2, QFormLayout::FieldRole, lineEdit_outputSg);


  formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
  QVBoxLayout* vLayout = new QVBoxLayout();
     QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
        pushButton_convert = new QPushButton(this);
           pushButton_convert->setAutoDefault(false);
           pushButton_convert->setDefault(true);
        QSpacerItem* verticalSpacer2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
           vLayout->addItem(verticalSpacer);
           vLayout->addWidget(pushButton_convert);
           vLayout->addWidget(groupBox_inputSg);
           vLayout->addItem(verticalSpacer2);

       QSpacerItem* verticalSpacer3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
           vLayout->addItem(verticalSpacer3);

  hLayout->addLayout(formLayout);
  hLayout->addLayout(vLayout);


  retranslateUi();
}
void tst_QFormLayout::setWidget()
{
    QFormLayout layout;

    QWidget w1;
    QWidget w2;
    QWidget w3;
    QWidget w4;

    QCOMPARE(layout.count(), 0);
    QCOMPARE(layout.rowCount(), 0);

    layout.setWidget(5, QFormLayout::LabelRole, &w1);
    QCOMPARE(layout.count(), 1);
    QCOMPARE(layout.rowCount(), 6);

    layout.setWidget(3, QFormLayout::FieldRole, &w2);
    layout.setWidget(3, QFormLayout::LabelRole, &w3);
    QCOMPARE(layout.count(), 3);
    QCOMPARE(layout.rowCount(), 6);

    // should be ignored and generate warnings
    layout.setWidget(3, QFormLayout::FieldRole, &w4);
    layout.setWidget(-1, QFormLayout::FieldRole, &w4);

    {
        int row = -1;
        QFormLayout::ItemRole role = QFormLayout::ItemRole(-123);
        layout.getWidgetPosition(&w1, &row, &role);
        QCOMPARE(row, 5);
        QCOMPARE(int(role), int(QFormLayout::LabelRole));
    }

    {
        int row = -1;
        QFormLayout::ItemRole role = QFormLayout::ItemRole(-123);
        layout.getWidgetPosition(&w2, &row, &role);
        QCOMPARE(row, 3);
        QCOMPARE(int(role), int(QFormLayout::FieldRole));
    }

    {
        int row = -1;
        QFormLayout::ItemRole role = QFormLayout::ItemRole(-123);
        layout.getWidgetPosition(&w3, &row, &role);
        QCOMPARE(row, 3);
        QCOMPARE(int(role), int(QFormLayout::LabelRole));
    }

    {
        int row = -1;
        QFormLayout::ItemRole role = QFormLayout::ItemRole(-123);
        layout.getWidgetPosition(&w4, &row, &role);
        QCOMPARE(row, -1);
        QCOMPARE(int(role), -123);
    }

    {
        int row = -1;
        QFormLayout::ItemRole role = QFormLayout::ItemRole(-123);
        layout.getWidgetPosition(0, &row, &role);
        QCOMPARE(row, -1);
        QCOMPARE(int(role), -123);
    }
}
	void setupUi(QDialog *MemberEditDialog) {
		p = MemberEditDialog;

		mainWidget             = new QWidget(MemberEditDialog);
		horizontalLayout       = new QHBoxLayout(mainWidget);
		tabWidget              = new QTabWidget(mainWidget);
		generalTab             = new QWidget();
		generalHLayout         = new QHBoxLayout(generalTab);
		formWidget             = new QWidget(generalTab);
		formTab1LeftLayout     = new QFormLayout(formWidget);
		titleLabel             = new QLabel(formWidget);
		firstNameLabel         = new QLabel(formWidget);
		firstNameLineEdit      = new QLineEdit(formWidget);
		lastNameLabel          = new QLabel(formWidget);
		lastNameLineEdit       = new QLineEdit(formWidget);
		streetLabel            = new QLabel(formWidget);
		zipLabel               = new QLabel(formWidget);
		streetHorizontalWidget = new QWidget(formWidget);
		streetHLayout          = new QHBoxLayout(streetHorizontalWidget);
		streetLineEdit         = new QLineEdit(streetHorizontalWidget);
		numberLabel            = new QLabel(streetHorizontalWidget);
		numberLineEdit         = new QLineEdit(streetHorizontalWidget);
		cityHorizontalWidget   = new QWidget(formWidget);
		cityHLayout            = new QHBoxLayout(cityHorizontalWidget);
		zipLineEdit            = new QLineEdit(cityHorizontalWidget);
		cityLabel              = new QLabel(cityHorizontalWidget);
		cityLineEdit           = new QLineEdit(cityHorizontalWidget);
		titleHorizontalWidget  = new QWidget(formWidget);
		titleHLayout           = new QHBoxLayout(titleHorizontalWidget);
		comboBox               = new QComboBox(titleHorizontalWidget);
		titleExtLabel          = new QLabel(titleHorizontalWidget);
		titleExtLineEdit       = new QLineEdit(titleHorizontalWidget);
		formTab1Right          = new QWidget(generalTab);
		formTab1RightLayout    = new QFormLayout(formTab1Right);
		phoneLabel             = new QLabel(formTab1Right);
		phoneEdit              = new QLineEdit(formTab1Right);
		cellLabel              = new QLabel(formTab1Right);
		cellEdit               = new QLineEdit(formTab1Right);
		emailLabel             = new QLabel(formTab1Right);
		emailEdit              = new QLineEdit(formTab1Right);
		maritalLabel           = new QLabel(formTab1Right);
		maritalCBox            = new QComboBox(formTab1Right);
		accountTab             = new QWidget();
		accountVLayout         = new QVBoxLayout(accountTab);
		tableView              = new QTableView(accountTab);
		tab2BottomLayout       = new QHBoxLayout();
		formTab2BottomLayout   = new QFormLayout();
		ibanLabel              = new QLabel(accountTab);
		ibanLineEdit           = new QLineEdit(accountTab);
		bicLabel               = new QLabel(accountTab);
		bicLineEdit            = new QLineEdit(accountTab);
		ownerLabel             = new QLabel(accountTab);
		ownerLineEdit          = new QLineEdit(accountTab);
		noteLabel              = new QLabel(accountTab);
		noteLineEdit           = new QLineEdit(accountTab);
		buttonsTab2BottomLayout       = new QVBoxLayout();
		addButton             = new QPushButton(accountTab);
		editButton           = new QPushButton(accountTab);
		deleteButton           = new QPushButton(accountTab);
		verticalLayout         = new QVBoxLayout();
		okButton               = new QPushButton(mainWidget);
		applyButton            = new QPushButton(mainWidget);
		verticalSpacer         = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
		leaveButton            = new QPushButton(mainWidget);
		verticalSpacer_2       = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
		cancelButton           = new QPushButton(mainWidget);

		// # layout definitions #

		// tabs on left, buttons on the right
		horizontalLayout->addWidget(tabWidget);
		horizontalLayout->addLayout(verticalLayout);

		// set up buttons on right
    verticalLayout->addWidget(okButton);
    verticalLayout->addWidget(applyButton);
    verticalLayout->addItem(verticalSpacer);
    verticalLayout->addWidget(leaveButton);
    verticalLayout->addItem(verticalSpacer_2);
    verticalLayout->addWidget(cancelButton);

		// set up tabs
		tabWidget->addTab(generalTab, QString());
		tabWidget->addTab(accountTab, QString());
		tabWidget->setCurrentIndex(0);

		// set up general tab
		generalHLayout->addWidget(formWidget);
		generalHLayout->addWidget(formTab1Right);

		// set up account tab
		accountVLayout->addWidget(tableView);
		accountVLayout->addLayout(tab2BottomLayout);

		accountVLayout->setContentsMargins(0, 0, 0, 0);

		// set up lazout of bottom part of account tab
		// form and buttons to add entries to table in a h-box
		tab2BottomLayout->addLayout(formTab2BottomLayout);
		tab2BottomLayout->addLayout(buttonsTab2BottomLayout);

		// buttons column of bottom part of account tab
		buttonsTab2BottomLayout->addWidget(addButton);
		buttonsTab2BottomLayout->addWidget(editButton);
		buttonsTab2BottomLayout->addWidget(deleteButton);


		// ## forms of general tab / general personal data ##

		// left side - personal data, address, etc.
		formTab1LeftLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
		formTab1LeftLayout->setWidget(0, QFormLayout::LabelRole, titleLabel);
		formTab1LeftLayout->setWidget(0, QFormLayout::FieldRole, titleHorizontalWidget);
		formTab1LeftLayout->setWidget(1, QFormLayout::LabelRole, firstNameLabel);
		formTab1LeftLayout->setWidget(1, QFormLayout::FieldRole, firstNameLineEdit);
		formTab1LeftLayout->setWidget(2, QFormLayout::LabelRole, lastNameLabel);
		formTab1LeftLayout->setWidget(2, QFormLayout::FieldRole, lastNameLineEdit);
		formTab1LeftLayout->setWidget(3, QFormLayout::LabelRole, streetLabel);
		formTab1LeftLayout->setWidget(3, QFormLayout::FieldRole, streetHorizontalWidget);
		formTab1LeftLayout->setWidget(4, QFormLayout::LabelRole, zipLabel);
		formTab1LeftLayout->setWidget(4, QFormLayout::FieldRole, cityHorizontalWidget);

		// right side - phone, email,
		formTab1RightLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
		formTab1RightLayout->setWidget(0, QFormLayout::LabelRole, phoneLabel);  // phone
		formTab1RightLayout->setWidget(0, QFormLayout::FieldRole, phoneEdit);
		formTab1RightLayout->setWidget(1, QFormLayout::LabelRole, cellLabel);     // mobile / cell phone number
		formTab1RightLayout->setWidget(1, QFormLayout::FieldRole, cellEdit);
		formTab1RightLayout->setWidget(2, QFormLayout::LabelRole, emailLabel); // email
		formTab1RightLayout->setWidget(2, QFormLayout::FieldRole, emailEdit);
		formTab1RightLayout->setWidget(3, QFormLayout::LabelRole, maritalLabel); // marital status
		formTab1RightLayout->setWidget(3, QFormLayout::FieldRole, maritalCBox);

		// form on bottom of account tab
		formTab2BottomLayout->setWidget(0, QFormLayout::LabelRole, ibanLabel);
		formTab2BottomLayout->setWidget(0, QFormLayout::FieldRole, ibanLineEdit);
		formTab2BottomLayout->setWidget(1, QFormLayout::LabelRole, bicLabel);
		formTab2BottomLayout->setWidget(1, QFormLayout::FieldRole, bicLineEdit);
		formTab2BottomLayout->setWidget(2, QFormLayout::LabelRole, ownerLabel);
		formTab2BottomLayout->setWidget(2, QFormLayout::FieldRole, ownerLineEdit);
		formTab2BottomLayout->setWidget(3, QFormLayout::LabelRole, noteLabel);
		formTab2BottomLayout->setWidget(3, QFormLayout::FieldRole, noteLineEdit);

		// street and number next to each other in one cell
		// so put them in a hbox and that into the form
		streetHLayout->addWidget(streetLineEdit);
		streetHLayout->addWidget(numberLabel);
		streetHLayout->addWidget(numberLineEdit);
		streetHLayout->setContentsMargins(0, 0, 0, 0);
		streetHLayout->setStretch(0, 5);
		streetHLayout->setStretch(2, 1);

		// zip and city in one cell like above
		cityHLayout->addWidget(zipLineEdit);
		cityHLayout->addWidget(cityLabel);
		cityHLayout->addWidget(cityLineEdit);
		cityHLayout->setContentsMargins(0, 0, 0, 0);

		// title and titleext like above
		titleHLayout->addWidget(comboBox);
		titleHLayout->addWidget(titleExtLabel);
		titleHLayout->addWidget(titleExtLineEdit);
		titleHLayout->setContentsMargins(0, 0, 0, 0);

		// zip codes have only 5 digits, also define appropriate size
		zipLineEdit->setMaxLength(5);
		zipLineEdit->setMaximumSize(QSize(80, 16777215));


		// initial siye of dialog. TODO: Save in conf on quit. Restore here.
		MemberEditDialog->resize(1200, 700);
		updateGeometry();


		retranslateUi(MemberEditDialog);

		QMetaObject::connectSlotsByName(MemberEditDialog);
		if (MemberEditDialog->objectName().isEmpty())
			MemberEditDialog->setObjectName(QStringLiteral("MemberEditDialog"));

		mainWidget->setObjectName(QStringLiteral("mainWidget"));
		horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
		tabWidget->setObjectName(QStringLiteral("tabWidget"));
		generalTab->setObjectName(QStringLiteral("generalTab"));
		generalHLayout->setObjectName(QStringLiteral("generalHLayout"));
		formWidget->setObjectName(QStringLiteral("formWidget"));
		formTab1LeftLayout->setObjectName(QStringLiteral("formTab1LeftLayout"));
		titleLabel->setObjectName(QStringLiteral("titleLabel"));
		firstNameLabel->setObjectName(QStringLiteral("firstNameLabel"));
		firstNameLineEdit->setObjectName(QStringLiteral("firstNameLineEdit"));
		lastNameLabel->setObjectName(QStringLiteral("lastNameLabel"));
		lastNameLineEdit->setObjectName(QStringLiteral("lastNameLineEdit"));
		streetLabel->setObjectName(QStringLiteral("streetLabel"));
		zipLabel->setObjectName(QStringLiteral("zipLabel"));
		streetHorizontalWidget->setObjectName(QStringLiteral("streetHorizontalWidget"));
		streetHLayout->setObjectName(QStringLiteral("streetHLayout"));
		streetLineEdit->setObjectName(QStringLiteral("streetLineEdit"));
		numberLabel->setObjectName(QStringLiteral("numberLabel"));
		numberLineEdit->setObjectName(QStringLiteral("numberLineEdit"));
		cityHorizontalWidget->setObjectName(QStringLiteral("cityHorizontalWidget"));
		cityHLayout->setObjectName(QStringLiteral("cityHLayout"));
		zipLineEdit->setObjectName(QStringLiteral("zipLineEdit"));
		cityLabel->setObjectName(QStringLiteral("cityLabel"));
		cityLineEdit->setObjectName(QStringLiteral("cityLineEdit"));
		titleHorizontalWidget->setObjectName(QStringLiteral("titleHorizontalWidget"));
		titleHLayout->setObjectName(QStringLiteral("titleHLayout"));
		comboBox->setObjectName(QStringLiteral("comboBox"));
		titleExtLabel->setObjectName(QStringLiteral("titleExtLabel"));
		titleExtLineEdit->setObjectName(QStringLiteral("titleExtLineEdit"));
		formTab1Right->setObjectName(QStringLiteral("formTab1Right"));
		formTab1RightLayout->setObjectName(QStringLiteral("formTab1RightLayout"));
		phoneLabel->setObjectName(QStringLiteral("phoneLabel"));
		phoneEdit->setObjectName(QStringLiteral("phoneEdit"));
		cellLabel->setObjectName(QStringLiteral("cellLabel"));
		cellEdit->setObjectName(QStringLiteral("cellEdit"));
		emailLabel->setObjectName(QStringLiteral("emailLabel"));
		emailEdit->setObjectName(QStringLiteral("emailEdit"));
		maritalLabel->setObjectName(QStringLiteral("maritalLabel"));
		maritalCBox->setObjectName(QStringLiteral("maritalCBox"));
		accountTab->setObjectName(QStringLiteral("accountTab"));
		accountVLayout->setObjectName(QStringLiteral("accountVLayout"));
		tableView->setObjectName(QStringLiteral("tableView"));
		tab2BottomLayout->setObjectName(QStringLiteral("tab2BottomLayout"));
		formTab2BottomLayout->setObjectName(QStringLiteral("formTab2BottomLayout"));
		ibanLabel->setObjectName(QStringLiteral("ibanLabel"));
		ibanLineEdit->setObjectName(QStringLiteral("ibanLineEdit"));
		bicLabel->setObjectName(QStringLiteral("bicLabel"));
		bicLineEdit->setObjectName(QStringLiteral("bicLineEdit"));
		ownerLabel->setObjectName(QStringLiteral("ownerLabel"));
		ownerLineEdit->setObjectName(QStringLiteral("ownerLineEdit"));
		noteLabel->setObjectName(QStringLiteral("noteLabel"));
		noteLineEdit->setObjectName(QStringLiteral("noteLineEdit"));
		buttonsTab2BottomLayout->setObjectName(QStringLiteral("buttonsTab2BottomLayout"));
		addButton->setObjectName(QStringLiteral("addButton"));
		editButton->setObjectName(QStringLiteral("editButton"));
		deleteButton->setObjectName(QStringLiteral("deleteButton"));
		verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
		okButton->setObjectName(QStringLiteral("okButton"));
		applyButton->setObjectName(QStringLiteral("applyButton"));
		leaveButton->setObjectName(QStringLiteral("leaveButton"));
		cancelButton->setObjectName(QStringLiteral("cancelButton"));



	} // setupUi
void REIXSXASScanConfigurationView::setupUi()
{
	setWindowTitle("Form");

	// mono groupBox layout
	QFormLayout *monoGroupBoxFormLayout = new QFormLayout();
	monoGroupBoxFormLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
	monoGroupBoxFormLayout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

	applyGratingBox_ = new QCheckBox("Grating");
	gratingBox_ = new QComboBox();
	monoGroupBoxFormLayout->setWidget(0, QFormLayout::LabelRole, applyGratingBox_);
	monoGroupBoxFormLayout->setWidget(0, QFormLayout::FieldRole, gratingBox_);

	applyMirrorBox_ = new QCheckBox("Mirror");
	mirrorBox_ = new QComboBox();
	monoGroupBoxFormLayout->setWidget(1, QFormLayout::LabelRole, applyMirrorBox_);
	monoGroupBoxFormLayout->setWidget(1, QFormLayout::FieldRole, mirrorBox_);

	applySlitWidthBox_ = new QCheckBox("Slit Width");
	slitWidthBox_ = createDoubleSpinBox(0, -500, 500, " um", 1, 5);
	monoGroupBoxFormLayout->setWidget(2, QFormLayout::LabelRole, applySlitWidthBox_);
	monoGroupBoxFormLayout->setWidget(2, QFormLayout::FieldRole, slitWidthBox_);

	monoGroupBoxFormLayout->setItem(3, QFormLayout::FieldRole, new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));

	estimatedTimeLabel_ = new QLabel("0 s");
	monoGroupBoxFormLayout->setWidget(4, QFormLayout::LabelRole, new QLabel("Estimated time:"));
	monoGroupBoxFormLayout->setWidget(4, QFormLayout::FieldRole, estimatedTimeLabel_);

	totalPointsLabel_ = new QLabel("0");
	monoGroupBoxFormLayout->setWidget(5, QFormLayout::LabelRole, new QLabel("Total points:"));
	monoGroupBoxFormLayout->setWidget(5, QFormLayout::FieldRole, totalPointsLabel_);


	// polarization groupBox layout
	QFormLayout *polarizationGroupBoxFormLayout = new QFormLayout();

	applyPolarizationBox_ = new QCheckBox("Polarization");
	polarizationBox_ = new QComboBox();
	polarizationGroupBoxFormLayout->setWidget(0, QFormLayout::LabelRole, applyPolarizationBox_);
	polarizationGroupBoxFormLayout->setWidget(0, QFormLayout::FieldRole, polarizationBox_);

	polarizationAngleBox_ = createDoubleSpinBox(0, -180, 180, " deg", 1, 10);
	polarizationGroupBoxFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Angle"));
	polarizationGroupBoxFormLayout->setWidget(1, QFormLayout::FieldRole, polarizationAngleBox_);

	// scan metal info layout
	QFormLayout *scanMetaInfoFormLayout = new QFormLayout();
	scanMetaInfoFormLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);

	nameEdit_ = new QLineEdit();
	scanMetaInfoFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Name"));
	scanMetaInfoFormLayout->setWidget(0, QFormLayout::FieldRole, nameEdit_);

	sampleSelector_ = new AMSamplePre2013Selector(AMDatabase::database("user"));
	scanMetaInfoFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Sample"));
	scanMetaInfoFormLayout->setWidget(1, QFormLayout::FieldRole, sampleSelector_);

	namedAutomaticallyBox_ = new QCheckBox("from current sample");
	scanMetaInfoFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Set automatically"));
	scanMetaInfoFormLayout->setWidget(2, QFormLayout::FieldRole, namedAutomaticallyBox_);


	// layout the components
	topFrame_ = new AMTopFrame("Setup XAS Scan", QIcon(":/utilities-system-monitor.png"));

	QGroupBox *monoGroupBox = new QGroupBox("Monochromator");
	monoGroupBox->setLayout(monoGroupBoxFormLayout);

	QGroupBox *polarizationGroupBox = new QGroupBox("Polarization");
	polarizationGroupBox->setLayout(polarizationGroupBoxFormLayout);

	QGroupBox *scanMetaInfoGroupBox = new QGroupBox("Scan Meta-Information");
	scanMetaInfoGroupBox->setLayout(scanMetaInfoFormLayout);

	QHBoxLayout *horizontalLayout = new QHBoxLayout();
	horizontalLayout->addWidget(monoGroupBox);
	horizontalLayout->addItem(new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
	horizontalLayout->addWidget(polarizationGroupBox);
	horizontalLayout->addItem(new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
	horizontalLayout->addWidget(scanMetaInfoGroupBox);

	QVBoxLayout *innerVLayout = new QVBoxLayout();
	innerVLayout->setSpacing(0);
	innerVLayout->setContentsMargins(12, 12, 12, 12);
	innerVLayout->addLayout(horizontalLayout);
	innerVLayout->insertWidget(0, new AMStepScanAxisView("Region Configuration", config_));
	innerVLayout->addStretch();

	QVBoxLayout *outerVLayout = new QVBoxLayout();
	outerVLayout->insertWidget(0, topFrame_);
	outerVLayout->setContentsMargins(0, 0, 0, 0);
	outerVLayout->addLayout(innerVLayout);
	setLayout(outerVLayout);

}
void REIXSXESSpectrometerControlEditor::setupUi()
{
	setWindowTitle("Spectrometer");
	setTitle("Spectrometer");

	QFormLayout *formLayout = new QFormLayout();
	formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);

	setLayout(formLayout);

	QLabel * gratingLabel = new QLabel("Grating");
	gratingSelectorBox_ = new QComboBox();

	formLayout->setWidget(0, QFormLayout::LabelRole, gratingLabel);
	formLayout->setWidget(0, QFormLayout::FieldRole, gratingSelectorBox_);

	gratingFeedbackLabel_ = new QLabel("Currently: LEG");
	energyFeedbackLabel_ = new QLabel("at 395 e");
	formLayout->setWidget(2, QFormLayout::LabelRole, gratingFeedbackLabel_);
	formLayout->setWidget(2, QFormLayout::FieldRole, energyFeedbackLabel_);

	QLabel *energyLabel = new QLabel("Energy");
	energyBox_ = createDoubleSpinBox(395, 80, 2400, " eV", 4);

	formLayout->setWidget(3, QFormLayout::LabelRole, energyLabel);
	formLayout->setWidget(3, QFormLayout::FieldRole, energyBox_);

	QLabel *labelDefocus = new QLabel("Defocus");
	defocusOffsetBox_ = createDoubleSpinBox(0, -200, 200, " mm");

	formLayout->setWidget(5, QFormLayout::LabelRole, labelDefocus);
	formLayout->setWidget(5, QFormLayout::FieldRole, defocusOffsetBox_);

	QLabel *labelTiltOffset = new QLabel("Tilt Offset");
	tiltOffsetBox_ = createDoubleSpinBox(0, -8, 8, " deg");

	formLayout->setWidget(6, QFormLayout::LabelRole, labelTiltOffset);
	formLayout->setWidget(6, QFormLayout::FieldRole, tiltOffsetBox_);

	energyRangeLabel_ = new QLabel("361 eV - 438 eV (78eV)");
	formLayout->setWidget(7, QFormLayout::FieldRole, energyRangeLabel_);

	stopButton_ = new QPushButton(QIcon(":/Close.png"), "Stop!");
	moveNowButton_ = new QPushButton(QIcon(":/system-software-update.png"), "Move Now");

	formLayout->setWidget(8, QFormLayout::LabelRole, stopButton_);
	formLayout->setWidget(8, QFormLayout::FieldRole, moveNowButton_);

	QLabel* maskLabel = new QLabel("Grating Mask");
	maskComboBox_ = new QComboBox();
	maskComboBox_->insertItems(0, QStringList() << "Pinhole" << "Mask" << "Out" );

	formLayout->setWidget(10, QFormLayout::LabelRole, maskLabel);
	formLayout->setWidget(10, QFormLayout::FieldRole, maskComboBox_);

	maskFeedbackLabel_ = new QLabel("Currently: Unknown");
	formLayout->setWidget(11, QFormLayout::FieldRole, maskFeedbackLabel_);

	QFont font = gratingFeedbackLabel_->font();
	font.setPointSize(AM_FONT_SMALL);
	gratingFeedbackLabel_->setFont(font);
	energyFeedbackLabel_->setFont(font);
}
    SeExprEdAddDialog::SeExprEdAddDialog(int& count,QWidget* parent)
        :QDialog(parent)
    {
        QVBoxLayout *verticalLayout;
        verticalLayout = new QVBoxLayout();
        verticalLayout->setSpacing(3);
        verticalLayout->setMargin(3);
        setLayout(verticalLayout);
        QHBoxLayout *horizontalLayout = new QHBoxLayout();

        horizontalLayout->addWidget(new QLabel("Variable"));
        // TODO would be nice to unique this over multiple sessions
        variableName = new QLineEdit(QString("$var%1").arg(count++));

        horizontalLayout->addWidget(variableName);
        verticalLayout->addLayout(horizontalLayout);

        tabWidget = new QTabWidget();

        // Curve
        {
            QWidget* curveTab = new QWidget();
            QFormLayout* curveLayout = new QFormLayout(curveTab);
            curveLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("Lookup"));
            curveLookup=new QLineEdit("$u");
            curveLayout->setWidget(0,QFormLayout::FieldRole,curveLookup);
            tabWidget->addTab(curveTab, QString("Curve"));
        }

        // Color Curve
        {
            QWidget* colorCurveTab = new QWidget();
            QFormLayout* colorCurveLayout = new QFormLayout(colorCurveTab);
            colorCurveLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("Lookup"));
            colorCurveLookup=new QLineEdit("$u");
            colorCurveLayout->setWidget(0,QFormLayout::FieldRole,colorCurveLookup);
            tabWidget->addTab(colorCurveTab, QString("Color Curve"));
        }

        // Integer
        {
            QWidget* intTab = new QWidget();
            QFormLayout* intFormLayout = new QFormLayout(intTab);
            intFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
            intFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
            intFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
            intDefault = new QLineEdit("0");
            intFormLayout->setWidget(0, QFormLayout::FieldRole, intDefault);
            intMin = new QLineEdit("0");
            intFormLayout->setWidget(1, QFormLayout::FieldRole, intMin);
            intMax = new QLineEdit("10");
            intFormLayout->setWidget(2, QFormLayout::FieldRole, intMax);
            tabWidget->addTab(intTab, QString("Int"));
        }

        // Float
        {
            QWidget* floatTab = new QWidget();
            QFormLayout* floatFormLayout = new QFormLayout(floatTab);
            floatFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
            floatFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
            floatFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
            floatDefault = new QLineEdit("0");
            floatFormLayout->setWidget(0, QFormLayout::FieldRole, floatDefault);
            floatMin = new QLineEdit("0");
            floatFormLayout->setWidget(1, QFormLayout::FieldRole, floatMin);
            floatMax = new QLineEdit("1");
            floatFormLayout->setWidget(2, QFormLayout::FieldRole, floatMax);

            tabWidget->addTab(floatTab, QString("Float"));
        }

        // Vector
        {
            QWidget* vectorTab = new QWidget();
            QFormLayout* vectorFormLayout = new QFormLayout(vectorTab);
            vectorFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
            vectorFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
            vectorFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
            vectorDefault0 = new QLineEdit("0");
            vectorDefault1 = new QLineEdit("0");
            vectorDefault2 = new QLineEdit("0");
            QHBoxLayout* compLayout=new QHBoxLayout();
            compLayout->addWidget(vectorDefault0);
            compLayout->addWidget(vectorDefault1);
            compLayout->addWidget(vectorDefault2);
            vectorFormLayout->setLayout(0, QFormLayout::FieldRole, compLayout);
            vectorMin = new QLineEdit("0");
            vectorFormLayout->setWidget(1, QFormLayout::FieldRole, vectorMin);
            vectorMax = new QLineEdit("1");
            vectorFormLayout->setWidget(2, QFormLayout::FieldRole, vectorMax);

            tabWidget->addTab(vectorTab, QString("Vector"));
        }

        // Color
        {
            QWidget* colorTab = new QWidget();
            QFormLayout* colorLayout = new QFormLayout(colorTab);
            colorWidget=new QPushButton();
            colorWidget->setFixedWidth(30);
            colorWidget->setFixedWidth(30);
            colorLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("Color"));
            colorLayout->setWidget(0,QFormLayout::FieldRole,colorWidget);
            color=Qt::red;
            QPixmap colorPix(30,30);
            colorPix.fill(color);
            colorWidget->setIcon(QIcon(colorPix));
            tabWidget->addTab(colorTab, QString("Color"));

            connect(colorWidget,SIGNAL(clicked()),this,SLOT(colorChooseClicked()));
        }

        // Color Swatch
        {
            QWidget* swatchTab = new QWidget();
            QFormLayout* swatchLayout = new QFormLayout(swatchTab);
            swatchLookup=new QLineEdit("$u");
            swatchLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("Lookup"));
            swatchLayout->setWidget(0,QFormLayout::FieldRole,swatchLookup);
            rainbowPaletteBtn = new QRadioButton("Rainbow");
            rainbowPaletteBtn->setChecked(true);
            grayPaletteBtn = new QRadioButton("Shades of Gray");
            swatchLayout->setWidget(1,QFormLayout::LabelRole,new QLabel("Colors"));
            swatchLayout->setWidget(1,QFormLayout::FieldRole,rainbowPaletteBtn);
            swatchLayout->setWidget(2,QFormLayout::LabelRole,new QLabel(""));
            swatchLayout->setWidget(2,QFormLayout::FieldRole,grayPaletteBtn);
            tabWidget->addTab(swatchTab, QString("Swatch"));
        }

        // String literal
        {
            QWidget* stringTab = new QWidget();
            QFormLayout* stringLayout = new QFormLayout(stringTab);
            stringTypeWidget=new QComboBox();
            stringTypeWidget->addItem("string");
            stringTypeWidget->addItem("file");
            stringTypeWidget->addItem("directory");
            stringDefaultWidget=new QLineEdit();
            stringNameWidget=new QLineEdit("str1");

            stringLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("String Name"));
            stringLayout->setWidget(0,QFormLayout::FieldRole,stringNameWidget);
            stringLayout->setWidget(1,QFormLayout::LabelRole,new QLabel("String Type"));
            stringLayout->setWidget(1,QFormLayout::FieldRole,stringTypeWidget);
            stringLayout->setWidget(2,QFormLayout::LabelRole,new QLabel("String Default"));
            stringLayout->setWidget(3,QFormLayout::FieldRole,stringDefaultWidget);

            tabWidget->addTab(stringTab, QString("String"));
        }

#ifdef SEEXPR_USE_ANIMLIB
        // Anim Curve
        {
            QWidget* curveTab = new QWidget();
            QFormLayout* curveLayout = new QFormLayout(curveTab);
            curveLayout->setWidget(0,QFormLayout::LabelRole,new QLabel("Lookup"));
            curveLayout->setWidget(1,QFormLayout::LabelRole,new QLabel("Link"));
            animCurveLookup=new QLineEdit("$frame");
            animCurveLink=new QLineEdit("");
            curveLayout->setWidget(0,QFormLayout::FieldRole,animCurveLookup);
            curveLayout->setWidget(1,QFormLayout::FieldRole,animCurveLink);
            tabWidget->addTab(curveTab, QString("AnimCurve"));
        }
#endif

        verticalLayout->addWidget(tabWidget);

        QDialogButtonBox* buttonBox = new QDialogButtonBox();
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);

        verticalLayout->addWidget(buttonBox);


        QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
        QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

        tabWidget->setCurrentIndex(0);

    }
Exemple #15
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	QDialog d(0);
	QVBoxLayout *gl = new QVBoxLayout();

	QFormLayout *lay = new QFormLayout();
	lay->setWidget(0, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Имя: "), &d));
	lay->setWidget(0, QFormLayout::FieldRole, new QLineEdit(&d));

	lay->setWidget(1, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Фамилия: "), &d));
	lay->setWidget(1, QFormLayout::FieldRole, new QLineEdit(&d));

	lay->setWidget(2, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Отчество: "), &d));
	lay->setWidget(2, QFormLayout::FieldRole, new QLineEdit(&d));
	gl->addLayout(lay);

	QFrame *line = new QFrame(&d);
	line->setFrameShape(QFrame::HLine);
	line->setFrameShadow(QFrame::Sunken);
	gl->addWidget(line);

	lay = new QFormLayout();
	QComboBox *cbox = new QComboBox(&d);
	cbox->insertItem(0, QString::fromLocal8Bit("женский"));
	cbox->insertItem(1, QString::fromLocal8Bit("мужской"));
	lay->setWidget(0, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Пол: "), &d));
	lay->setWidget(0, QFormLayout::FieldRole, cbox);

	lay->setWidget(1, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Дата рождения: "), &d));
	lay->setWidget(1, QFormLayout::FieldRole, new QDateEdit(&d));
	gl->addLayout(lay);

	line = new QFrame(&d);
	line->setFrameShape(QFrame::HLine);
	line->setFrameShadow(QFrame::Sunken);
	gl->addWidget(line);

	lay = new QFormLayout();
	lay->setWidget(0, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Адрес: "), &d));
	lay->setWidget(0, QFormLayout::FieldRole, new QLineEdit(&d));

	lay->setWidget(1, QFormLayout::LabelRole, new QLabel(QString::fromLocal8Bit("Телефон: "), &d));
	lay->setWidget(1, QFormLayout::FieldRole, new QLineEdit(&d));
	gl->addLayout(lay);

	QHBoxLayout *lay2 = new QHBoxLayout();
	QPushButton *ok = new QPushButton("OK", &d);
	ok->setDefault(true);
	ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	lay2->addWidget(ok);
	QPushButton *cancel = new QPushButton(QString::fromLocal8Bit("Отмена"), &d);
	cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	lay2->addWidget(cancel);
	gl->addItem(lay2);

	d.setLayout(gl);
	d.setWindowTitle("Address book");
	d.show();
	return app.exec();
}