git-svn-id: svn://db.shs.com.ru/libs@316 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-11-15 14:27:51 +00:00
parent efeb95c1c3
commit ed362a6b55
8 changed files with 473 additions and 215 deletions

View File

@@ -4,10 +4,24 @@
#include "blockitem.h"
/// data:
/// 1002 - flag for move parent (true)
/// 1003 - flag for visualize selection (true)
/// 1004 - BlockItemPin ("pin")
/// 1005 - BlockBusItem ("connection")
/// 1006 - BlockItem ("item")
/// 1007 - BlockItem selection ("item_selection")
/// 1008 - item is NOT decor, ignore for function decors() (true)
/// 1009 - item is scene decor ("decor")
/// 1010 - BlockItem decor (src text for QGraphicsSimpleTextItem)
/// 1011 - item is BlockItem decor ("decor")
/// 1100 - flag for correct move (true)
class BlockBusItem: public QGraphicsObject, public PropertyStorage {
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
//Q_PROPERTY(double width READ width WRITE setWidth)
Q_PROPERTY(double pointSize READ pointSize WRITE setPointSize DESIGNABLE false SCRIPTABLE false)
friend class BlockView;
public:
BlockBusItem(bool temp = false);
@@ -22,7 +36,7 @@ public:
int busType() const {return bus_type;}
QString busName() const {return bus_name;}
void appendPoint(const QPointF & p);
void appendPoint(qreal x, qreal y) {appendPoint(QPointF(x, y));}
void appendPoint(qreal x, qreal y);
void testPoint(QPointF pos, int * sel_point, int * sel_segment);
void clear();
/*void setStart(const QPointF & p) {pol[0] = p; scene()->update();}
@@ -36,11 +50,11 @@ public:
void setBrush(const QBrush & b) {b_ = b; update();}
QBrush brush() const {return b_;}
//void disconnectBrick() {BrickBase::disconnect(brickFrom, portFrom, brickTo, portTo);}
void movePolyline(const QPointF & dp) {pol.translate(dp); prepareGeometryChange();}
void movePoint(int index, const QPointF & dp) {pol[index] += dp; prepareGeometryChange();}
void movePolyline(const QPointF & dp);
void movePoint(int index, const QPointF & dp);
double width() const {return pen_width;}
void setWidth(const double & w) {pen_width = w; update();}
void setColor(const QColor & c) {pu.setColor(c); bu.setColor(c); update();}
void setWidth(const double & w);
void setColor(const QColor & c);
int addPoint(const QPointF & point, bool update = true);
int segmentPointPair(int point, int * seg = 0) const;
void removePoint(int index);
@@ -104,6 +118,12 @@ protected:
int selPoint, selSegment, max_ep, bus_type, state_;
bool moved, deleted, mark_in, mark_out, new_segment, mm_cancel, lm_point;
private:
double pointSize() const {return point_size;}
void setPointSize(double s);
double point_size;
QPropertyAnimation anim_point_size;
};