Amelioration de la vitesse du rectangle de selection

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@70 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-02-25 17:53:16 +00:00
parent feaa1f39dd
commit 6d5927cbe7
4 changed files with 20 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ Diagram::Diagram(QObject *parent) : QGraphicsScene(parent) {
poseur_de_conducer -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0))); poseur_de_conducer -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
draw_grid = true; draw_grid = true;
use_border = true; use_border = true;
connect(this, SIGNAL(changed(const QList<QRectF> &)), this, SLOT(slot_checkSelectionChange())); connect(this, SIGNAL(changed(const QList<QRectF> &)), this, SLOT(slot_checkSelectionEmptinessChange()));
} }
/** /**
@@ -340,6 +340,20 @@ void Diagram::slot_checkSelectionChange() {
cache_selecteditems = selecteditems; cache_selecteditems = selecteditems;
} }
/**
Verifie si la selection est passe d'un etat ou elle est vide a un etat ou
elle ne l'est pas, et inversement. Si c'est le cas, le signal
EmptinessChanged() est emis.
*/
void Diagram::slot_checkSelectionEmptinessChange() {
static bool selection_was_empty = true;
bool selection_is_empty = selectedItems().isEmpty();
if (selection_was_empty != selection_is_empty) {
emit(selectionEmptinessChanged());
selection_was_empty = selection_is_empty;
}
}
/** /**
@return Le rectangle (coordonnees par rapport a la scene) delimitant le bord du schema @return Le rectangle (coordonnees par rapport a la scene) delimitant le bord du schema
*/ */

View File

@@ -60,8 +60,10 @@
private slots: private slots:
void slot_checkSelectionChange(); void slot_checkSelectionChange();
void slot_checkSelectionEmptinessChange();
signals: signals:
void selectionChanged(); void selectionChanged();
void selectionEmptinessChanged();
}; };
#endif #endif

View File

@@ -22,7 +22,7 @@ void DiagramView::initialise() {
setResizeAnchor(QGraphicsView::AnchorUnderMouse); setResizeAnchor(QGraphicsView::AnchorUnderMouse);
setAlignment(Qt::AlignLeft | Qt::AlignTop); setAlignment(Qt::AlignLeft | Qt::AlignTop);
setSceneRect(QRectF(0.0, 0.0, scene -> border_and_inset.borderWidth() + 10.0, scene -> border_and_inset.borderHeight() + 10.0)); setSceneRect(QRectF(0.0, 0.0, scene -> border_and_inset.borderWidth() + 10.0, scene -> border_and_inset.borderHeight() + 10.0));
connect(scene, SIGNAL(selectionChanged()), this, SLOT(slot_selectionChanged())); connect(scene, SIGNAL(selectionEmptinessChanged()), this, SLOT(slot_selectionChanged()));
} }
/** /**

View File

@@ -439,8 +439,8 @@ QList<QDomElement> Element::findInDomElement(QDomElement e, QString parent, QStr
// parcours des enfants de l'element XML "parent" // parcours des enfants de l'element XML "parent"
for (QDomNode node_children = parents.firstChild() ; !node_children.isNull() ; node_children = node_children.nextSibling()) { for (QDomNode node_children = parents.firstChild() ; !node_children.isNull() ; node_children = node_children.nextSibling()) {
// on s'interesse a l'element XML "children" // on s'interesse a l'element XML "children"
QDomElement children = node_children.toElement(); QDomElement n_children = node_children.toElement();
if (!children.isNull()) return_list.append(children); if (!n_children.isNull() && n_children.tagName() == children) return_list.append(n_children);
} }
} }
return(return_list); return(return_list);