Пример #1
0
//! Updates the property value from the current lookups.
void LookupListModel::updatePropertyValueFromLookups()
{
	// Make the update.
	QJsonObject pvAsObject = m_propertyValue.toObject();
	QJsonObject typedValue = pvAsObject[ "TypedValue" ].toObject();
	switch( m_dataType )
	{
	// Single-select lookup.
	case 9:
		if( m_lookups.count() > 0 )
			typedValue[ "Lookup" ] = m_lookups[ 0 ];
		else
			typedValue[ "Lookup" ] = QJsonValue();
		break;

	// Multi-select lookups
	case 10 :
		typedValue[ "Lookups" ] = m_lookups;
		break;

	// Unexpected property value.
	default:
		qCritical( "TODO: Error reporting" );
		break;
	}
	pvAsObject[ "TypedValue" ] = typedValue;
	m_propertyValue = pvAsObject;

	// The property value was changed.
	emit propertyValueChanged();
}
void QDesignerPropertyEditor::emitPropertyValueChanged(const QString &name, const QVariant &value, bool enableSubPropertyHandling)
{
    // Avoid duplicate signal emission - see below
    m_propertyChangedForwardingBlocked = true;
    emit propertyValueChanged(name, value, enableSubPropertyHandling);
    emit propertyChanged(name, value);
    m_propertyChangedForwardingBlocked = false;
}
Пример #3
0
//BEGIN Class PropertyEditorItem
PropertyEditorItem::PropertyEditorItem( PropertyEditorItem * par, Property * property )
	: KListViewItem( par, property->editorCaption(), property->displayString() )
{
	setExpandable( false );
	m_property=property;
	connect( m_property, SIGNAL(valueChanged( QVariant, QVariant )), this, SLOT(propertyValueChanged()) );

	updateValue();

	//3 rows per item is enough?
	setMultiLinesEnabled( true );
	setHeight(static_cast<PropertyEditor*>(listView())->baseRowHeight()*3);
}
Пример #4
0
//! Sets property value.
void LookupListModel::setPropertyValue( const QJsonValue propertyValue )
{
	// Don't update if the property value has not changed.
	if( m_propertyValue == propertyValue )
		return;

	// Extract lookups.
	int oldLookupCount = this->lookupCount();
	QJsonObject asObject = propertyValue.toObject();
	QJsonObject typedValue = asObject[ "TypedValue" ].toObject();
	m_dataType = typedValue[ "DataType" ].toDouble();
	bool hasValue = typedValue[ "HasValue" ].toBool();
	QJsonArray lookups;
	if( m_dataType == 9 && hasValue )
	{
		// Single-select lookup.
		lookups.append( typedValue[ "Lookup" ] );
	}
	else if( m_dataType == 10 && hasValue )
	{
		// Multi-select lookup.
		lookups = typedValue[ "Lookups" ].toArray();
	}
	else if( ! hasValue )
	{
		// No value.
	}
	else
	{
		// Unexpected data type.
		qCritical( "TODO: Error reporting." );
		return;
	}

	// Update the model data.
	this->beginResetModel();
	{
		m_propertyValue = propertyValue;
		m_lookups = lookups;
	}
	this->endResetModel();

	// Lookup count changed?
	if( oldLookupCount != this->lookupCount() )
		emit lookupCountChanged();

	// Property value was changed.
	emit propertyValueChanged();
}
void DoublePropertyWizardPane::updateValue(const QString& text)
{
    auto hdlr = handlerCast<DoublePropertyHandler>();

    // verify that value is valid and within range before setting it
    double value = hdlr->toDouble(text);
    bool valid = isValidAndInRange(hdlr, text);
    if (valid && value!=hdlr->value())
    {
        hdlr->setValue(value);
        emit propertyValueChanged();
    }
    setPropertyConfigured(valid);
    emit propertyValidChanged(valid);
}
Пример #6
0
void PropertyBuffer::intersectedValueChanged(Property *property)
{
//     qWarning("PropertyBuffer::intersectedValueChanged");
    QString propertyName = property->name();
    if (!contains(propertyName))
        return;

    MultiProperty mp(property);
    if (mp == *m_list[propertyName])
    {
        Property *prop;
        QPtrList<Property> props = properties(propertyName);
        for (prop = props.first(); prop; prop = props.next())
            emit propertyValueChanged(prop);
    }
}
void QDesignerPropertyEditor::slotPropertyChanged(const QString &name, const QVariant &value)
{
    // Forward signal from Integration using the old interfaces.
    if (!m_propertyChangedForwardingBlocked)
        emit propertyValueChanged(name, value, true);
}
void QDesignerPropertyEditor::slotPropertyChanged(const QString &name, const QVariant &value)
{
    emit propertyValueChanged(name, value, true);
}