mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
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:
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user