mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Replaced a QMultiMap-based sort with a cleaner qSort().
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1807 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1039,14 +1039,7 @@ QList<QGraphicsItem *> ElementScene::zItems(bool include_terminals) const {
|
||||
}
|
||||
|
||||
// ordonne les parties par leur zValue
|
||||
QMultiMap<qreal, QGraphicsItem *> mm;
|
||||
foreach(QGraphicsItem *qgi, all_items_list) mm.insert(qgi -> zValue(), qgi);
|
||||
all_items_list.clear();
|
||||
QMapIterator<qreal, QGraphicsItem *> i(mm);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
all_items_list << i.value();
|
||||
}
|
||||
qSort(all_items_list.begin(), all_items_list.end(), ElementScene::zValueLessThan);
|
||||
|
||||
// rajoute eventuellement les bornes
|
||||
if (include_terminals) all_items_list += terminals;
|
||||
@@ -1300,3 +1293,10 @@ void ElementScene::snapToGrid(QPointF &point) {
|
||||
bool ElementScene::mustSnapToGrid(QGraphicsSceneMouseEvent *e) {
|
||||
return(!(e -> modifiers() & Qt::ControlModifier));
|
||||
}
|
||||
|
||||
/**
|
||||
@return true if \a item1's zValue() is less than \a item2's.
|
||||
*/
|
||||
bool ElementScene::zValueLessThan(QGraphicsItem *item1, QGraphicsItem *item2) {
|
||||
return(item1-> zValue() < item2 -> zValue());
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ class ElementScene : public QGraphicsScene {
|
||||
void initPasteArea();
|
||||
void snapToGrid(QPointF &);
|
||||
bool mustSnapToGrid(QGraphicsSceneMouseEvent *);
|
||||
static bool zValueLessThan(QGraphicsItem *, QGraphicsItem *);
|
||||
|
||||
public slots:
|
||||
void slot_move();
|
||||
|
||||
Reference in New Issue
Block a user