19 #include "ui_shapegraphicsitempropertieswidget.h" 104 if (shapes_list.size() == 0) {
107 else if (shapes_list.size() == 1)
137 if (qsi->diagram()) {
177 QPen new_pen = old_pen;
179 new_pen.setStyle(Qt::PenStyle(
ui->m_style_cb->currentIndex() + 1));
180 new_pen.setWidthF(
ui->m_size_dsb->value());
182 if (
ui->m_style_cb->currentIndex() ==5) {
183 new_pen.setDashPattern( QVector<qreal>() << 10 << 10 );
184 new_pen.setStyle( Qt::CustomDashLine );
187 new_pen.setColor(
ui->m_color_kpb->color());
189 if (new_pen != old_pen)
192 undo->setText(
tr(
"Modifier le trait d'une forme"));
196 QBrush new_brush = old_brush;
197 new_brush.setStyle(Qt::BrushStyle(
ui->m_brush_style_cb->currentIndex()));
198 new_brush.setColor(
ui->m_brush_color_kpb->color());
200 if (new_brush != old_brush)
207 undo->setText(
tr(
"Modifier le remplissage d'une forme"));
218 undo->setText(
tr(
"Fermer le polygone"));
226 QUndoCommand *parent_undo =
nullptr;
230 QHash <QetShapeItem *, QPen> pen_H;
232 if (
ui->m_style_cb->currentIndex() != -1 &&
233 Qt::PenStyle(
ui->m_style_cb->currentIndex() + 1) != shape_->
pen().style())
237 QPen pen = qsi->pen();
239 if (
ui->m_style_cb->currentIndex() ==5) {
240 pen.setDashPattern( QVector<qreal>() << 10 << 10 );
241 pen.setStyle( Qt::CustomDashLine );
243 pen.setStyle(Qt::PenStyle(
ui->m_style_cb->currentIndex() + 1));
245 pen_H.insert(qsi, pen);
249 if (
ui->m_size_dsb->value() > 0 &&
250 ui->m_size_dsb->value() != shape_->
pen().widthF())
254 QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen();
255 pen.setWidthF(
ui->m_size_dsb->value());
256 pen_H.insert(qsi, pen);
260 QColor c =
ui->m_color_kpb->color();
261 if (c != QPalette().color(QPalette::Button) && shape_->
pen().color() != c)
265 QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen();
267 pen_H.insert(qsi, pen);
271 for (QPointer<QetShapeItem> qsi : pen_H.keys())
274 parent_undo =
new QUndoCommand(
tr(
"Modifier une forme simple"));
280 QHash <QetShapeItem *, QBrush> brush_H;
281 if (
ui->m_brush_style_cb->currentIndex() != -1 &&
282 shape_->
brush().style() != Qt::BrushStyle(
ui->m_brush_style_cb->currentIndex()))
286 QBrush brush = qsi->brush();
287 brush.setStyle(Qt::BrushStyle(
ui->m_brush_style_cb->currentIndex()));
288 brush_H.insert(qsi, brush);
292 c =
ui->m_brush_color_kpb->color();
293 if (c != QPalette().color(QPalette::Button) && shape_->
brush().color() != c)
297 QBrush brush = brush_H.contains(qsi) ? brush_H.value(qsi) : qsi->brush();
299 brush_H.insert(qsi, brush);
303 for (QPointer<QetShapeItem> qsi : brush_H.keys())
306 parent_undo =
new QUndoCommand(
tr(
"Modifier une forme simple"));
318 QUndoCommand *undo =
new QUndoCommand(
tr(
"Modifier les propriétés d'une forme simple"));
320 QPen new_pen = old_pen;
322 new_pen.setStyle(Qt::PenStyle(
ui->m_style_cb->currentIndex() + 1));
323 new_pen.setWidthF(
ui->m_size_dsb->value());
325 if (
ui->m_style_cb->currentIndex() ==5) {
326 new_pen.setDashPattern( QVector<qreal>() << 10 << 10 );
327 new_pen.setStyle( Qt::CustomDashLine );
330 new_pen.setColor(
ui->m_color_kpb->color());
332 if (new_pen != old_pen) {
337 QBrush new_brush = old_brush;
338 new_brush.setStyle(Qt::BrushStyle(
ui->m_brush_style_cb->currentIndex()));
339 new_brush.setColor(
ui->m_brush_color_kpb->color());
341 if (new_brush != old_brush) {
349 if (undo->childCount()) {
378 ui->m_style_cb->setCurrentIndex(static_cast<int>(
m_shape->
pen().style()) - 1);
387 ui->m_brush_style_cb->setCurrentIndex(static_cast<int>(
m_shape->
brush().style()));
395 ui->m_close_polygon->setHidden(
true);
400 if (qsi->pen().style() != ps) {
405 ui->m_style_cb->setCurrentIndex(same ? static_cast<int>(ps) - 1 : -1);
410 if (qsi->pen().widthF() != pw) {
415 ui->m_size_dsb->setValue(same ? pw : 0);
420 if (qsi->pen().color() != pc) {
425 ui->m_color_kpb->setColor(same ? pc : QColor());
428 ui->m_filling_gb->setVisible(
true);
433 if (qsi->brush().style() != bs) {
438 ui->m_brush_style_cb->setCurrentIndex(same ? static_cast<int>(bs) : -1);
443 if (qsi->brush().color() != bc) {
448 ui->m_brush_color_kpb->setColor(same ? bc : QColor());
450 ui->m_lock_pos_cb->setChecked(
false);
451 ui->m_close_polygon->setChecked(
false);
511 qsi->setMovable(!
ui->m_lock_pos_cb->isChecked());
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Diagram * diagram() const
QetGraphicsItem::diagram return the diagram of this item.
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
virtual bool isMovable() const
ShapeType shapeType() const
virtual void setMovable(bool movable)