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
This commit is contained in:
xavierqet
2007-09-30 12:35:25 +00:00
parent 4e11e516f1
commit e6fc33f2bd
5 changed files with 25 additions and 9 deletions

View File

@@ -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);

View File

@@ -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<Terminal *>(qgi)) {
t -> setVisible(dt);
}
}
}

View File

@@ -38,7 +38,7 @@ class Diagram : public QGraphicsScene {
QHash<Conducer *, Terminal *> 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

View File

@@ -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);

View File

@@ -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;