From e6fc33f2bd1b038a3edb734461adfb8938d680ff Mon Sep 17 00:00:00 2001 From: xavierqet Date: Sun, 30 Sep 2007 12:35:25 +0000 Subject: [PATCH] Ajout d'une option pour exporter le schema sans dessiner les bornes git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@148 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- customelement.cpp | 8 -------- diagram.cpp | 8 ++++++++ diagram.h | 9 ++++++++- exportdialog.cpp | 8 ++++++++ exportdialog.h | 1 + 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/customelement.cpp b/customelement.cpp index d29050e46..baacd34a8 100644 --- a/customelement.cpp +++ b/customelement.cpp @@ -204,14 +204,6 @@ bool CustomElement::parseElement(QDomElement &e, QPainter &qp) { @return true si l'analyse reussit, false sinon */ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { - //qDebug() << "parseLine sur " << (void *)(&dessin); -// qDebug() << names.name() << (void *)(&dessin); -// qp.end(); -// PartLine t; -// t.fromXml(e); -// t.renderToCustomElement(*this); -// qp.begin(&dessin); - //return(true); // verifie la presence et la validite des attributs obligatoires double x1, y1, x2, y2; if (!QET::attributeIsAReal(e, QString("x1"), &x1)) return(false); diff --git a/diagram.cpp b/diagram.cpp index 3e9c38e13..a1b55384d 100644 --- a/diagram.cpp +++ b/diagram.cpp @@ -477,3 +477,11 @@ void Diagram::fetchMovedElements() { } moved_elements_fetched = true; } + +void Diagram::setDrawTerminals(bool dt) { + foreach(QGraphicsItem *qgi, items()) { + if (Terminal *t = qgraphicsitem_cast(qgi)) { + t -> setVisible(dt); + } + } +} diff --git a/diagram.h b/diagram.h index b0cbc41c9..2a7a23989 100644 --- a/diagram.h +++ b/diagram.h @@ -38,7 +38,7 @@ class Diagram : public QGraphicsScene { QHash conducers_to_update; QGIManager qgi_manager; QUndoStack undo_stack; - + bool draw_terminals; // methodes public: @@ -63,6 +63,9 @@ class Diagram : public QGraphicsScene { void setBorderOptions(BorderOptions); BorderOptions borderOptions(); + bool drawTerminals() const; + void setDrawTerminals(bool); + QRectF border() const; QImage toImage(int = -1, int = -1, Qt::AspectRatioMode = Qt::KeepAspectRatio); QSize imageSize() const; @@ -198,4 +201,8 @@ inline QGIManager &Diagram::qgiManager() { return(qgi_manager); } +inline bool Diagram::drawTerminals() const { + return(draw_terminals); +} + #endif diff --git a/exportdialog.cpp b/exportdialog.cpp index 31db1eb4f..f93af86e8 100644 --- a/exportdialog.cpp +++ b/exportdialog.cpp @@ -48,6 +48,7 @@ ExportDialog::ExportDialog(Diagram *dia, QWidget *parent) : QDialog(parent) { connect(draw_border, SIGNAL(stateChanged(int) ), this, SLOT(slot_refreshPreview())); connect(draw_inset, SIGNAL(stateChanged(int) ), this, SLOT(slot_refreshPreview())); connect(draw_columns, SIGNAL(stateChanged(int) ), this, SLOT(slot_refreshPreview())); + connect(draw_terminals, SIGNAL(stateChanged(int) ), this, SLOT(slot_refreshPreview())); connect(keep_colors, SIGNAL(stateChanged(int) ), this, SLOT(slot_refreshPreview())); connect(width, SIGNAL(valueChanged(int) ), this, SLOT(slot_refreshPreview())); connect(height, SIGNAL(valueChanged(int) ), this, SLOT(slot_refreshPreview())); @@ -141,6 +142,10 @@ QGroupBox *ExportDialog::setupOptionsGroupBox() { keep_colors = new QCheckBox(tr("Conserver les couleurs"), groupbox_options); optionshlayout -> addWidget(keep_colors, 3, 0); + // dessiner les bornes + draw_terminals = new QCheckBox(tr("Dessiner les bornes"), groupbox_options); + optionshlayout -> addWidget(draw_terminals, 3, 1); + return(groupbox_options); } @@ -261,10 +266,12 @@ QImage ExportDialog::generateImage() { bool state_drawColumns = diagram -> border_and_inset.columnsAreDisplayed(); bool state_drawInset = diagram -> border_and_inset.insetIsDisplayed(); bool state_drawGrid = diagram -> displayGrid(); + bool state_drawTerm = diagram -> drawTerminals(); bool state_useBorder = diagram -> useBorder(); // genere l'image diagram -> setUseBorder(export_border -> isChecked()); + diagram -> setDrawTerminals(draw_terminals -> isChecked()); diagram -> setDisplayGrid(draw_grid -> isChecked()); diagram -> border_and_inset.displayBorder(draw_border -> isChecked()); diagram -> border_and_inset.displayColumns(draw_columns -> isChecked()); @@ -287,6 +294,7 @@ QImage ExportDialog::generateImage() { diagram -> border_and_inset.displayColumns(state_drawColumns); diagram -> border_and_inset.displayInset(state_drawInset); diagram -> setDisplayGrid(state_drawGrid); + diagram -> setDrawTerminals(state_drawTerm); diagram -> setUseBorder(state_useBorder); return(image); diff --git a/exportdialog.h b/exportdialog.h index f5015d8f5..17d8a3e8c 100644 --- a/exportdialog.h +++ b/exportdialog.h @@ -30,6 +30,7 @@ class ExportDialog : public QDialog { QCheckBox *draw_border; QCheckBox *draw_inset; QCheckBox *draw_columns; + QCheckBox *draw_terminals; QCheckBox *keep_colors; QRadioButton *export_elements; QRadioButton *export_border;