void ServiceChooser::setCurrentService(const QByteArray &service) { QRadioButton *button = m_buttons.value(service); if (!button) return; button->blockSignals(true); button->setChecked(true); emit serviceChanged(service, m_currentService); m_currentService = service; button->blockSignals(false); }
void SelectProfileWidget::setSelectedProfile(const Jid &AServiceJid) { QRadioButton *button = FProfiles.value(AServiceJid); if (button && button->isEnabled()) { button->blockSignals(true); button->setChecked(true); button->blockSignals(false); emit selectedProfileChanged(); } }
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); }; }