git-svn-id: svn://db.shs.com.ru/libs@166 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -154,10 +154,10 @@ BlockItemPin * BlockItem::addPin(Qt::Alignment align, int bus_type, const QStrin
|
|||||||
|
|
||||||
void BlockItem::removePin(BlockItemPin * pin) {
|
void BlockItem::removePin(BlockItemPin * pin) {
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
QMutableMapIterator<Qt::Alignment, QList<BlockItemPin * > > it(pins_);
|
QMutableMapIterator<Qt::Alignment, QVector<BlockItemPin * > > it(pins_);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
it.value().removeAll(pin);
|
it.value().remove(it.value().indexOf(pin));
|
||||||
}
|
}
|
||||||
delete pin;
|
delete pin;
|
||||||
arrangePins();
|
arrangePins();
|
||||||
@@ -210,7 +210,7 @@ QVector<BlockItemPin * > BlockItem::takePins() {
|
|||||||
|
|
||||||
|
|
||||||
void BlockItem::clearPins() {
|
void BlockItem::clearPins() {
|
||||||
QList<QList<BlockItemPin * > > mp = pins_.values();
|
QList<QVector<BlockItemPin * > > mp = pins_.values();
|
||||||
for (int i = 0; i < mp.size(); ++i)
|
for (int i = 0; i < mp.size(); ++i)
|
||||||
qDeleteAll(mp[i]);
|
qDeleteAll(mp[i]);
|
||||||
pins_.clear();
|
pins_.clear();
|
||||||
@@ -233,10 +233,10 @@ void BlockItem::clearDecors() {
|
|||||||
|
|
||||||
|
|
||||||
QVector<BlockItemPin * > BlockItem::pins() const {
|
QVector<BlockItemPin * > BlockItem::pins() const {
|
||||||
QList<QList<BlockItemPin * > > mp = pins_.values();
|
QList<QVector<BlockItemPin * > > mp = pins_.values();
|
||||||
QVector<BlockItemPin * > ret;
|
QVector<BlockItemPin * > ret;
|
||||||
for (int i = 0; i < mp.size(); ++i)
|
for (int i = 0; i < mp.size(); ++i)
|
||||||
ret << mp[i].toVector();
|
ret << mp[i];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,12 +409,12 @@ void BlockItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event) {
|
|||||||
|
|
||||||
void BlockItem::arrangePins() {
|
void BlockItem::arrangePins() {
|
||||||
//double w = g_main.rect().width(), h = g_main.rect().height();
|
//double w = g_main.rect().width(), h = g_main.rect().height();
|
||||||
QSet<BlockItemPin * > pl;
|
QVector<BlockItemPin * > pl = pins();
|
||||||
pl = pl.fromList(pins().toList());
|
// pl = pl.fromList(pins().toList());
|
||||||
pins_.clear();
|
pins_.clear();
|
||||||
foreach (BlockItemPin * p, pl)
|
foreach (BlockItemPin * p, pl)
|
||||||
pins_[p->alignment()] << p;
|
pins_[p->alignment()] << p;
|
||||||
QList<BlockItemPin * > cp = pins_.value(Qt::AlignBottom);
|
QVector<BlockItemPin * > cp = pins_.value(Qt::AlignBottom);
|
||||||
for (int i = 0; i < cp.size(); ++i) cp[i]->setPos(_POS(pins_margin), bottom());
|
for (int i = 0; i < cp.size(); ++i) cp[i]->setPos(_POS(pins_margin), bottom());
|
||||||
cp = pins_.value(Qt::AlignTop);
|
cp = pins_.value(Qt::AlignTop);
|
||||||
for (int i = 0; i < cp.size(); ++i) cp[i]->setPos(_POS(pins_margin), top());
|
for (int i = 0; i < cp.size(); ++i) cp[i]->setPos(_POS(pins_margin), top());
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ protected:
|
|||||||
QGraphicsRectItem g_main, g_selection;
|
QGraphicsRectItem g_main, g_selection;
|
||||||
int pins_margin;
|
int pins_margin;
|
||||||
QColor col;
|
QColor col;
|
||||||
QMap<Qt::Alignment, QList<BlockItemPin * > > pins_;
|
QMap<Qt::Alignment, QVector<BlockItemPin * > > pins_;
|
||||||
QList<QGraphicsItem * > decors_;
|
QList<QGraphicsItem * > decors_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user