本文整理汇总了C++中QDateTimeEdit::blockSignals方法的典型用法代码示例。如果您正苦于以下问题:C++ QDateTimeEdit::blockSignals方法的具体用法?C++ QDateTimeEdit::blockSignals怎么用?C++ QDateTimeEdit::blockSignals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTimeEdit
的用法示例。
在下文中一共展示了QDateTimeEdit::blockSignals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
};
}