Revert previous commit

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2676 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810 2013-12-29 13:39:48 +00:00
parent 5eecfedd02
commit c0262b4fc1
4 changed files with 15 additions and 9 deletions

View File

@ -39,7 +39,6 @@ const qreal Diagram::margin = 5.0;
// static variable to keep track of present background color of the diagram. // static variable to keep track of present background color of the diagram.
QColor Diagram::background_color = Qt::white; QColor Diagram::background_color = Qt::white;
/** /**
Constructeur Constructeur
@param parent Le QObject parent du schema @param parent Le QObject parent du schema
@ -124,16 +123,17 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
// dessine un fond blanc // dessine un fond blanc
p -> setPen(Qt::NoPen); p -> setPen(Qt::NoPen);
//set brush color to present background color. //set brush color to present background color.
p -> setBrush(Diagram::background_color); p -> setBrush(Diagram::background_color);
p -> drawRect(r); p -> drawRect(r);
if (draw_grid_) { if (draw_grid_) {
// dessine les points de la grille // 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); p -> setBrush(Qt::NoBrush);
qreal limite_x = r.x() + r.width(); qreal limite_x = r.x() + r.width();
qreal limite_y = r.y() + r.height(); qreal limite_y = r.y() + r.height();
@ -936,6 +936,15 @@ QList<CustomElement *> Diagram::customElements() const {
return(elements_list); return(elements_list);
} }
QList <Element *> Diagram::elements() const {
QList<Element *> element_list;
foreach (QGraphicsItem *qgi, items()) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
element_list <<elmt;
}
return (element_list);
}
/** /**
Initialise un deplacement d'elements, conducteurs et champs de texte sur le Initialise un deplacement d'elements, conducteurs et champs de texte sur le
schema. schema.

View File

@ -79,7 +79,6 @@ class Diagram : public QGraphicsScene {
static const qreal margin; static const qreal margin;
/// background color of diagram /// background color of diagram
static QColor background_color; static QColor background_color;
private: private:
QGraphicsLineItem *conductor_setter_; QGraphicsLineItem *conductor_setter_;
ElementsMover *elements_mover_; ElementsMover *elements_mover_;
@ -166,6 +165,7 @@ class Diagram : public QGraphicsScene {
bool isEmpty() const; bool isEmpty() const;
QList<CustomElement *> customElements() const; QList<CustomElement *> customElements() const;
QList<Element *> elements() const;
QSet<DiagramTextItem *> selectedTexts() const; QSet<DiagramTextItem *> selectedTexts() const;
QSet<ConductorTextItem *> selectedConductorTexts() const; QSet<ConductorTextItem *> selectedConductorTexts() const;
QSet<Conductor *> selectedConductors() const; QSet<Conductor *> selectedConductors() const;

View File

@ -83,7 +83,6 @@ class DiagramPrintDialog : public QWidget {
QLineEdit *filepath_field_; QLineEdit *filepath_field_;
QPushButton *browse_button_; QPushButton *browse_button_;
QDialogButtonBox *buttons_; QDialogButtonBox *buttons_;
QColor backup_diagram_background_color; QColor backup_diagram_background_color;
}; };
#endif #endif

View File

@ -652,11 +652,9 @@ void DiagramView::editDiagramProperties() {
/// TODO implement an undo command to allow the user to undo/redo this action /// TODO implement an undo command to allow the user to undo/redo this action
scene -> defaultConductorProperties = new_conductors; scene -> defaultConductorProperties = new_conductors;
} }
// adjustSceneRect shall be called whenever the user accepts the dialog // adjustSceneRect shall be called whenever the user accepts the dialog
// even if no changes have been made. // even if no changes have been made.
// Added so that diagram refreshes after back-ground color change. // Added so that diagram refreshes after back-ground color change.
//if (adjust_scene) //if (adjust_scene)
adjustSceneRect(); adjustSceneRect();
} }