35 close_polygon(
tr(
"Polygone fermé"), this)
42 headers <<
tr(
"x") <<
tr(
"y");
48 QVBoxLayout *layout =
new QVBoxLayout(
this);
49 layout -> addWidget(
style_);
50 layout -> addWidget(
new QLabel(
tr(
"Points du polygone :")));
69 if (points.count() < 2)
78 undo->setText(
tr(
"Modifier un polygone"));
93 undo->setText(
tr(
"Modifier un polygone"));
105 foreach(QPointF point,
part -> polygon()) {
106 point =
part -> mapToScene(point);
108 qsl << QString(
"%1").arg(point.x()) << QString(
"%1").arg(point.y());
109 QTreeWidgetItem *qtwi =
new QTreeWidgetItem(qsl);
110 qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
138 if (
PartPolygon *part_polygon = dynamic_cast<PartPolygon *>(new_part))
140 if (
part == part_polygon)
return true;
168 if (!
part)
return(QVector<QPointF>());
169 QVector<QPointF> points;
170 for(
int i = 0 ; i <
points_list.topLevelItemCount() ; ++ i) {
171 QTreeWidgetItem *qtwi =
points_list.topLevelItem(i);
172 bool x_convert_ok, y_convert_ok;
173 qreal x = qtwi -> text(0).toDouble(&x_convert_ok);
174 qreal y = qtwi -> text(1).toDouble(&y_convert_ok);
175 if (!x_convert_ok || !y_convert_ok)
continue;
176 points <<
part -> mapFromScene(QPointF(x, y));
187 qtwi -> text(column).toDouble(&convert_ok);
191 }
else points_list.openPersistentEditor(qtwi, column);
201 connect(&
points_list, SIGNAL(itemChanged(QTreeWidgetItem *,
int)),
this, SLOT(
validColumn(QTreeWidgetItem *,
int)));
204 disconnect(&
points_list, SIGNAL(itemChanged(QTreeWidgetItem *,
int)),
this, SLOT(
validColumn(QTreeWidgetItem *,
int)));
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
void updateForm() override
void validColumn(QTreeWidgetItem *qtwi, int column)
void updatePolygonPoints()
~PolygonEditor() override
Destructeur.
void activeConnections(bool)
void updatePolygonClosedState()
QPolygonF polygon
PartPolygon::polygon.
bool setPart(CustomElementPart *) override
QVariant property(const char *name) const override
The PartPolygon class This class represents a polygon primitive which may be used to compose the draw...
CustomElementPart * currentPart() const override
QVector< QPointF > getPointsFromTree()
PolygonEditor(QETElementEditor *, PartPolygon *=nullptr, QWidget *=nullptr)
virtual QUndoStack & undoStack() const
QMessageBox::StandardButton warning(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)