Example #1
0
void DrListOption::setChoice(int choicenum)
{
    if(choicenum >= 0 && choicenum < (int)m_choices.count())
    {
        setValueText(m_choices.at(choicenum)->name());
    }
}
Example #2
0
ValueSelector::ValueSelector(const QString &text, QWidget *parent) :
    QMaemo5ValueButton(text, parent),
    m_model(0),
    m_selector(new QMaemo5ListPickSelector(this))
{
    setPickSelector(m_selector);
    setValueText(tr("None chosen"));
    connect(m_selector, SIGNAL(selected(QString)), this, SLOT(onSelected()));
}
Example #3
0
void ValueSelector::setValue(const QVariant &v) {
    if (!m_model) {
        return;
    }

    bool found = false;
    int i = 0;

    while ((!found) && (i < m_model->rowCount())) {
        found = m_model->data(m_model->index(i, 0), SelectionModel::ValueRole) == v;

        if (found) {
            m_selector->setCurrentIndex(i);
        }

        i++;
    }

    if (!found) {
        setValueText(tr("None chosen"));
    }
}
Example #4
0
void ValueSelector::setCurrentIndex(int i) {
    m_selector->setCurrentIndex(i);
    setValueText(m_model->data(m_model->index(i, 0), SelectionModel::NameRole).toString());
}
Example #5
0
void DrBase::setOptions(const QMap< QString, QString > &opts)
{
    if(opts.contains(name()))
        setValueText(opts[name()]);
}