Exemplo n.º 1
0
void SectionSetupForm::selectSection() {
    Section * select_section;
    try {
        select_section = getCurrentSection();
    } catch (const char * err_text) {
        return;
    }
    showSectionInfoInWidgets(select_section);
}
Exemplo n.º 2
0
void SpinBoxRange::stepBy(int steps)
{
    int selection = 0;
    switch (getCurrentSection())
    {
    case SectionMin:
        _valMin += steps;
        if (_valMin < MINI)
            _valMin = MINI;
        else if (_valMin > MAXI)
            _valMin = MAXI;
        if (_valMin > _valMax)
            _valMax = _valMin;

        // Sélection à gauche
        selection = -1;

        break;
    case SectionMax:
        _valMax += steps;
        if (_valMax < MINI)
            _valMax = MINI;
        else if (_valMax > MAXI)
            _valMax = MAXI;
        if (_valMax < _valMin)
            _valMin = _valMax;

        // Sélection à droite
        selection = 1;

        break;
    case SectionNone:
        break;
    }
    formatText();

    if (selection == -1)
    {
        QString txt = lineEdit()->text();
        int posSeparator = txt.indexOf(QRegExp("[0-9]" + SEPARATOR)) + 1;
        lineEdit()->setSelection(0, posSeparator);
    }
    else if (selection == 1)
    {
        QString txt = lineEdit()->text();
        int posSeparator = txt.indexOf(QRegExp("[0-9]" + SEPARATOR)) + 1;
        lineEdit()->setSelection(posSeparator + SEPARATOR.size(), txt.size() - posSeparator + SEPARATOR.size());
    }

    emit(valueChanged());
}
Exemplo n.º 3
0
void SectionSetupForm::changeSectionInfo() {
    try {
        Section * select_section = getCurrentSection();
        Section * section_new_data = new Section();
        setToSectionFromWidgets(section_new_data);
        section_catalog->editSection(select_section, section_new_data);
        showChangedSection(select_section, widget.sectionsTableWidget->currentRow());
    } catch (const Error &err) {
        //errorMessage("Не удалось обновить информацию о текущей секции");
        catchError(err);
        selectSection();
    } catch(const char* err_text) {
        errorMessage(err_text);
        return;
    }
}
Exemplo n.º 4
0
QAbstractSpinBox::StepEnabled SpinBoxRange::stepEnabled() const
{
    StepEnabled stepEnabled = 0;
    switch (getCurrentSection())
    {
    case SectionMin:
        if (_valMin != MINI)
            stepEnabled |= StepDownEnabled;
        if (_valMin != MAXI)
            stepEnabled |= StepUpEnabled;
        break;
    case SectionMax:
        if (_valMax != MINI)
            stepEnabled |= StepDownEnabled;
        if (_valMax != MAXI)
            stepEnabled |= StepUpEnabled;
        break;
    case SectionNone:
        break;
    }

    return stepEnabled;
}