Example #1
0
void SubmitFieldWidget::createField(const QString &f)
{
    FieldEntry fe;
    fe.createGui(d->removeFieldIcon);
    fe.combo->addItems(d->fields);
    if (!f.isEmpty()) {
        const int index = fe.combo->findText(f);
        if (index != -1) {
            setComboBlocked(fe.combo, index);
            fe.comboIndex = index;
        }
    }

    connect(fe.browseButton, &QAbstractButton::clicked, this, &SubmitFieldWidget::slotBrowseButtonClicked);
    if (!d->hasBrowseButton)
        fe.browseButton->setVisible(false);

    if (d->completer)
        fe.lineEdit->setCompleter(d->completer);

    connect(fe.combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
            this, &SubmitFieldWidget::slotComboIndexChanged);
    connect(fe.clearButton, &QAbstractButton::clicked,
            this, &SubmitFieldWidget::slotRemove);
    d->layout->addLayout(fe.layout);
    d->fieldEntries.push_back(fe);
}
Example #2
0
void SubmitFieldWidget::removeField(int index)
{
    FieldEntry fe = d->fieldEntries.takeAt(index);
    QLayoutItem * item = d->layout->takeAt(index);
    fe.deleteGuiLater();
    delete item;
}
Example #3
0
void SubmitFieldWidget::createField(const QString &f)
{
    FieldEntry fe;
    fe.createGui(m_d->removeFieldIcon);
    fe.combo->addItems(m_d->fields);
    if (!f.isEmpty()) {
        const int index = fe.combo->findText(f);
        if (index != -1) {
            setComboBlocked(fe.combo, index);
            fe.comboIndex = index;
        }
    }

    connect(fe.browseButton, SIGNAL(clicked()), this, SLOT(slotBrowseButtonClicked()));
    if (!m_d->hasBrowseButton)
        fe.browseButton->setVisible(false);

    if (m_d->completer)
        fe.lineEdit->setCompleter(m_d->completer);

    connect(fe.combo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(slotComboIndexChanged(int)));
    connect(fe.clearButton, SIGNAL(clicked()),
            this, SLOT(slotRemove()));
    m_d->layout->addLayout(fe.layout);
    m_d->fieldEntries.push_back(fe);
}