Fixed signal/slot loop: on property changes model emits signals that are collected by the MainWindow and sent back to the PaintGui/MappingGui (this fixes OSC changes of model objects).

This commit is contained in:
Tats
2016-03-03 22:25:00 -05:00
parent 5fe89ab9ac
commit e87de3d3e9
10 changed files with 213 additions and 74 deletions
+25
View File
@@ -39,3 +39,28 @@ Element::Element(uid id, UidAllocator* allocator) : _name(""), _isLocked(false),
Element::~Element() {
_allocator->free(_id);
}
void Element::setLocked(bool locked)
{
if (locked != _isLocked)
{
_isLocked = locked;
_emitPropertyChanged("locked");
}
}
void Element::setOpacity(float opacity)
{
opacity = qBound(opacity, 0.0f, 1.0f);
if (opacity != _opacity)
{
_opacity = opacity;
_emitPropertyChanged("opacity");
}
}
void Element::_emitPropertyChanged(const QString& propertyName)
{
emit propertyChanged(getId(), propertyName, property(propertyName.toAscii()));
}