当前位置: 首页>>代码示例>>C++>>正文


C++ QSpinBox::blockSignals方法代码示例

本文整理汇总了C++中QSpinBox::blockSignals方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::blockSignals方法的具体用法?C++ QSpinBox::blockSignals怎么用?C++ QSpinBox::blockSignals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSpinBox的用法示例。


在下文中一共展示了QSpinBox::blockSignals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slotSingleStepChanged

void QtSpinBoxFactory::slotSingleStepChanged(QtProperty *property, int step)
{
    if (!m_createdEditors.contains(property))
        return;
    QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QSpinBox *editor = itEditor.next();
        editor->blockSignals(true);
        editor->setSingleStep(step);
        editor->blockSignals(false);
    }
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:12,代码来源:qteditorfactory.cpp

示例2: slotPropertyChanged

void QtSpinBoxFactory::slotPropertyChanged(QtProperty *property, int value)
{
    if (!m_createdEditors.contains(property))
        return;
    QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QSpinBox *editor = itEditor.next();
        if (editor->value() != value) {
            editor->blockSignals(true);
            editor->setValue(value);
            editor->blockSignals(false);
        }
    }
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:14,代码来源:qteditorfactory.cpp

示例3: slotRangeChanged

void QtSpinBoxFactory::slotRangeChanged(QtProperty *property, int min, int max)
{
    if (!m_createdEditors.contains(property))
        return;

    QtIntPropertyManager *manager = this->propertyManager(property);
    if (!manager)
        return;

    QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QSpinBox *editor = itEditor.next();
        editor->blockSignals(true);
        editor->setRange(min, max);
        editor->setValue(manager->value(property));
        editor->blockSignals(false);
    }
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:18,代码来源:qteditorfactory.cpp

示例4: roundSBToPowerOfTwo

void MainWindow::roundSBToPowerOfTwo(int value)
{
    QSpinBox *sb = (QSpinBox *)sender();
    sb->blockSignals(true);

    int prevValue = (sb == ui->rangeMinSB) ? rangeMinSBPrevValue : rangeMaxSBPrevValue;
    int nextValue = value;

    if (prevValue < value)
        nextValue = qNextPowerOfTwo(value);
    else if(prevValue > value)
        nextValue = qNextPowerOfTwo(value) >> 1;

    if (sb == ui->rangeMinSB)
        rangeMinSBPrevValue = nextValue;
    else
        rangeMaxSBPrevValue = nextValue;

    sb->setValue(nextValue);
    sb->blockSignals(false);
}
开发者ID:stampho,项目名称:qt-fourier-demo,代码行数:21,代码来源:mainwindow.cpp

示例5: updateWidget

void EncTtsCfgGui::updateWidget()
{
    // get sender setting
    EncTtsSetting* setting = qobject_cast<EncTtsSetting*>(QObject::sender());
    if(setting == NULL) return;
    // get corresponding widget
    QWidget* widget = m_settingsWidgetsMap.value(setting);

    // update Widget based on setting type
    switch(setting->type())
    {
        case EncTtsSetting::eDOUBLE:
        {
            QDoubleSpinBox* spinbox = (QDoubleSpinBox*) widget;
            spinbox->setMinimum(setting->min().toDouble());
            spinbox->setMaximum(setting->max().toDouble());
            spinbox->blockSignals(true);
            spinbox->setValue(setting->current().toDouble());
            spinbox->blockSignals(false);
            break;
        }
        case EncTtsSetting::eINT:
        {
            QSpinBox* spinbox = (QSpinBox*) widget;
            spinbox->setMinimum(setting->min().toInt());
            spinbox->setMaximum(setting->max().toInt());
            spinbox->blockSignals(true);
            spinbox->setValue(setting->current().toInt());
            spinbox->blockSignals(false);
            break;
        }
        case EncTtsSetting::eSTRING:
        {
            QLineEdit* lineedit = (QLineEdit*) widget;

            lineedit->blockSignals(true);
            lineedit->setText(setting->current().toString());
            lineedit->blockSignals(false);
            break;
        }
        case EncTtsSetting::eREADONLYSTRING:
        {
            QLabel* label = (QLabel*) widget;

            label->blockSignals(true);
            label->setText(setting->current().toString());
            label->blockSignals(false);
            break;
        }
        case EncTtsSetting::eSTRINGLIST:
        {
            QComboBox* combobox = (QComboBox*) widget;

            combobox->blockSignals(true);
            combobox->clear();
            combobox->addItems(setting->list());
            int index = combobox->findText(setting->current().toString());
            combobox->setCurrentIndex(index);
            combobox->blockSignals(false);

            break;
        }
        case EncTtsSetting::eBOOL:
        {
            QCheckBox* checkbox = (QCheckBox*) widget;

            checkbox->blockSignals(true);
            checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked);
            checkbox->blockSignals(false);
            break;
        }
        default:
        {
            LOG_WARNING() << "unknown EncTTsSetting";
            break;
        }
    }
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:78,代码来源:encttscfggui.cpp

示例6: propertyUpdated

void protoObject::propertyUpdated(QString propertyName){
    QObject *receiver = mapper->mapping(propertyName);
    QWidget *widget;

    if (receiver) return; //if not binding, just leave

    widget = qobject_cast<QLabel*>(receiver);
    if (widget) {
        QLabel* edit = qobject_cast<QLabel*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setText(edit->text().arg(value));
        edit->blockSignals(false);
    };

    widget = qobject_cast<QLineEdit*>(receiver);
    if (widget) {
        QLineEdit* edit = qobject_cast<QLineEdit*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setText(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QComboBox*>(receiver);
    if (widget) {
        QComboBox* edit = qobject_cast<QComboBox*>(receiver);
        edit->blockSignals(true);
        edit->setCurrentIndex(edit->findData(this->property(propertyName.toLatin1()), Qt::UserRole));
        edit->blockSignals(false);
    };

    widget = qobject_cast<QRadioButton*>(receiver);
    if (widget) {
        QRadioButton* edit = qobject_cast<QRadioButton*>(receiver);
        bool value = this->property(propertyName.toLatin1()).toBool();
        edit->blockSignals(true);
        edit->setChecked(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QCheckBox*>(receiver);
    if (widget) {
        QCheckBox* edit = qobject_cast<QCheckBox*>(receiver);
        bool value = this->property(propertyName.toLatin1()).toBool();
        edit->blockSignals(true);
        edit->setChecked(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QPlainTextEdit*>(receiver);
    if (widget) {
        QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setPlainText(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QSpinBox*>(receiver);
    if (widget) {
        QSpinBox* edit = qobject_cast<QSpinBox*>(receiver);
        int value = this->property(propertyName.toLatin1()).toInt();
        edit->blockSignals(true);
        edit->setValue(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QDoubleSpinBox*>(receiver);
    if (widget) {
        QDoubleSpinBox* edit = qobject_cast<QDoubleSpinBox*>(receiver);
        double value = this->property(propertyName.toLatin1()).toDouble();
        edit->blockSignals(true);
        edit->setValue(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QDateTimeEdit*>(receiver);
    if (widget) {
        QDateTimeEdit* edit = qobject_cast<QDateTimeEdit*>(receiver);
        QDateTime value = this->property(propertyName.toLatin1()).toDateTime();
        edit->blockSignals(true);
        edit->setDateTime(value);
        edit->blockSignals(false);
    };
}
开发者ID:jcapoduri,项目名称:ndlite,代码行数:86,代码来源:protoobject.cpp


注:本文中的QSpinBox::blockSignals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。