From c0262b4fc15ab175cd7084fdbf8cff18af67a01f Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Sun, 29 Dec 2013 13:39:48 +0000 Subject: [PATCH] Revert previous commit git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2676 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagram.cpp | 19 ++++++++++++++----- sources/diagram.h | 2 +- sources/diagramprintdialog.h | 1 - sources/diagramview.cpp | 2 -- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 114081eba..12fa11d22 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -39,7 +39,6 @@ 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 @@ -124,16 +123,17 @@ 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 - p -> setPen(Qt::black); + // 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 -> setBrush(Qt::NoBrush); qreal limite_x = r.x() + r.width(); qreal limite_y = r.y() + r.height(); @@ -936,6 +936,15 @@ 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 3ede44f2f..257cf23d4 100644 --- a/sources/diagramprintdialog.h +++ b/sources/diagramprintdialog.h @@ -83,7 +83,6 @@ 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 512a6c264..9c66585b1 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -652,11 +652,9 @@ 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(); }