diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 12fa11d22..114081eba 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -39,6 +39,7 @@ const qreal Diagram::margin = 5.0; // static variable to keep track of present background color of the diagram. QColor Diagram::background_color = Qt::white; + /** Constructeur @param parent Le QObject parent du schema @@ -123,17 +124,16 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) { // dessine un fond blanc p -> setPen(Qt::NoPen); + //set brush color to present background color. p -> setBrush(Diagram::background_color); + p -> drawRect(r); if (draw_grid_) { + // dessine les points de la grille - // if background color is black, then grid spots shall be white, else they shall be black in color. - if (Diagram::background_color == Qt::black) - p -> setPen(Qt::white); - else - p -> setPen(Qt::black); + p -> setPen(Qt::black); p -> setBrush(Qt::NoBrush); qreal limite_x = r.x() + r.width(); qreal limite_y = r.y() + r.height(); @@ -936,15 +936,6 @@ QList Diagram::customElements() const { return(elements_list); } -QList Diagram::elements() const { - QList element_list; - foreach (QGraphicsItem *qgi, items()) { - if (Element *elmt = qgraphicsitem_cast(qgi)) - element_list < customElements() const; - QList elements() const; QSet selectedTexts() const; QSet selectedConductorTexts() const; QSet selectedConductors() const; diff --git a/sources/diagramprintdialog.h b/sources/diagramprintdialog.h index 257cf23d4..3ede44f2f 100644 --- a/sources/diagramprintdialog.h +++ b/sources/diagramprintdialog.h @@ -83,6 +83,7 @@ class DiagramPrintDialog : public QWidget { QLineEdit *filepath_field_; QPushButton *browse_button_; QDialogButtonBox *buttons_; + QColor backup_diagram_background_color; }; #endif diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 9c66585b1..512a6c264 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -652,9 +652,11 @@ void DiagramView::editDiagramProperties() { /// TODO implement an undo command to allow the user to undo/redo this action scene -> defaultConductorProperties = new_conductors; } + // adjustSceneRect shall be called whenever the user accepts the dialog // even if no changes have been made. // Added so that diagram refreshes after back-ground color change. + //if (adjust_scene) adjustSceneRect(); }