Gestion du "Clean State" dans l'editeur

Correction d'un bug avec les polygones.
Amelioration du mode lecture seule.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@107 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-08-25 15:46:09 +00:00
parent 1dd23c8af8
commit 853827f25c
5 changed files with 47 additions and 12 deletions

View File

@@ -28,9 +28,7 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *p, QWidget *
layout -> addWidget(&points_list);
layout -> addWidget(&close_polygon);
// connexions signaux/slots
connect(&close_polygon, SIGNAL(stateChanged(int)), this, SLOT(updatePolygonClosedState()));
connect(&points_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(validColumn(QTreeWidgetItem *, int)));
updateForm();
}
void PolygonEditor::updatePolygon() {
@@ -64,6 +62,7 @@ void PolygonEditor::updatePolygonClosedState() {
}
void PolygonEditor::updateForm() {
activeConnections(false);
while(points_list.takeTopLevelItem(0));
foreach(QPointF point, part -> polygon()) {
point = part -> mapToScene(point);
@@ -74,6 +73,7 @@ void PolygonEditor::updateForm() {
points_list.addTopLevelItem(qtwi);
}
close_polygon.setChecked(part -> isClosed());
activeConnections(true);
}
QVector<QPointF> PolygonEditor::getPointsFromTree() {
@@ -97,3 +97,13 @@ void PolygonEditor::validColumn(QTreeWidgetItem *qtwi, int column) {
updatePolygonPoints();
} else points_list.openPersistentEditor(qtwi, column);
}
void PolygonEditor::activeConnections(bool active) {
if (active) {
connect(&close_polygon, SIGNAL(stateChanged(int)), this, SLOT(updatePolygonClosedState()));
connect(&points_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(validColumn(QTreeWidgetItem *, int)));
} else {
disconnect(&close_polygon, SIGNAL(stateChanged(int)), this, SLOT(updatePolygonClosedState()));
disconnect(&points_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(validColumn(QTreeWidgetItem *, int)));
}
}