diff --git a/qad/blockview/blockitem.cpp b/qad/blockview/blockitem.cpp index fe64601..8316b6d 100644 --- a/qad/blockview/blockitem.cpp +++ b/qad/blockview/blockitem.cpp @@ -270,7 +270,7 @@ QByteArray BlockItem::save() const { pp[p->text()] = p->properties(); } cs << cs.chunk(1, pos()) << cs.chunk(2, rotation()) << cs.chunk(3, props) << cs.chunk(5, pp) << cs.chunk(6, size()); - cs << cs.chunk(10, data(2000)) << cs.chunk(11, data(2001)) << cs.chunk(0xFF, _blockitem_current_version_); + cs << cs.chunk(10, data(2000)) << cs.chunk(11, data(2001)) << cs.chunk(12, prop_bindings) << cs.chunk(0xFF, _blockitem_current_version_); return cs.data(); } @@ -297,6 +297,7 @@ void BlockItem::load(const QByteArray & data) { case 6: setSize(cs.getData()); break; case 10: setData(2000, cs.getData()); break; case 11: setData(2001, cs.getData()); break; + case 12: prop_bindings = cs.getData > >(); break; case 0xFF: cs.get(version); break; } } @@ -418,6 +419,86 @@ void BlockItem::arrangePins() { #undef _POS +void BlockItem::removeBindings(const QString & bind_name) { + for(int i=0; i pb(prop_name, bind_name); + prop_bindings.removeAll(pb); + prop_bindings << pb; +} + + +void BlockItem::applyBinding(const QString & bind_name, const QVariant & bind_value) { + for(int i=0; i > & bindings) { + prop_bindings = bindings; +} + + +QList > BlockItem::getBindings() { + return prop_bindings; +} + + +QString BlockItem::getBindName(const QString & prop_name) const { + for(int i=0; i > & bindings); + QList > getBindings(); + QString getBindName(const QString & prop_name) const; + QStringList getBindNames() const; + QStringList getBindProps() const; + enum {Type = UserType + 1}; - + protected: void _resize(QSizeF s); void _moveToTop(bool only_decors = false); @@ -78,13 +89,14 @@ protected: double bottom() const {return boundingRect().bottom();} void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); QVariant itemChange(GraphicsItemChange change, const QVariant & value); - + QGraphicsRectItem g_main, g_selection; int pins_margin; QColor col; QMap > pins_; QList decors_; - + QList > prop_bindings; // + private: double thickness() const; void setThickness(double w);