mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 10:30:53 +01:00
add option "transparent background" in SVG-export
This commit is contained in:
@@ -400,6 +400,13 @@ void ExportDialog::generateSvg(
|
|||||||
{
|
{
|
||||||
saveReloadDiagramParameters(diagram, true);
|
saveReloadDiagramParameters(diagram, true);
|
||||||
|
|
||||||
|
// FIXME: This is a Quick-and-Dirty-Hack to achieve transparency in SVG-Background:
|
||||||
|
if (epw->exportProperties().draw_bg_transparent) {
|
||||||
|
diagram->background_color = Qt::transparent;
|
||||||
|
} else {
|
||||||
|
//diagram->background_color = Qt::blue;
|
||||||
|
}
|
||||||
|
|
||||||
// genere une QPicture a partir du schema
|
// genere une QPicture a partir du schema
|
||||||
QPicture picture;
|
QPicture picture;
|
||||||
diagram -> toPaintDevice(
|
diagram -> toPaintDevice(
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class ExportProperties {
|
|||||||
bool draw_border; ///< Whether to render the border (along with rows/columns headers)
|
bool draw_border; ///< Whether to render the border (along with rows/columns headers)
|
||||||
bool draw_titleblock; ///< Whether to render the title block
|
bool draw_titleblock; ///< Whether to render the title block
|
||||||
bool draw_terminals; ///< Whether to render terminals
|
bool draw_terminals; ///< Whether to render terminals
|
||||||
|
bool draw_bg_transparent; ///< Whether to use transparency for SVG-Export
|
||||||
bool draw_colored_conductors; ///< Whether to render conductors colors
|
bool draw_colored_conductors; ///< Whether to render conductors colors
|
||||||
QET::DiagramArea exported_area; ///< Area of diagrams to be rendered
|
QET::DiagramArea exported_area; ///< Area of diagrams to be rendered
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ ExportProperties ExportPropertiesWidget::exportProperties() const
|
|||||||
export_properties.draw_border = draw_border -> isChecked();
|
export_properties.draw_border = draw_border -> isChecked();
|
||||||
export_properties.draw_titleblock = draw_titleblock -> isChecked();
|
export_properties.draw_titleblock = draw_titleblock -> isChecked();
|
||||||
export_properties.draw_terminals = draw_terminals -> isChecked();
|
export_properties.draw_terminals = draw_terminals -> isChecked();
|
||||||
|
export_properties.draw_bg_transparent = draw_bg_transparent -> isChecked();
|
||||||
export_properties.draw_colored_conductors = draw_colored_conductors -> isChecked();
|
export_properties.draw_colored_conductors = draw_colored_conductors -> isChecked();
|
||||||
export_properties.exported_area = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
|
export_properties.exported_area = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
|
||||||
|
|
||||||
@@ -84,6 +85,7 @@ void ExportPropertiesWidget::setExportProperties(const ExportProperties &export_
|
|||||||
draw_border -> setChecked(export_properties.draw_border);
|
draw_border -> setChecked(export_properties.draw_border);
|
||||||
draw_titleblock -> setChecked(export_properties.draw_titleblock);
|
draw_titleblock -> setChecked(export_properties.draw_titleblock);
|
||||||
draw_terminals -> setChecked(export_properties.draw_terminals);
|
draw_terminals -> setChecked(export_properties.draw_terminals);
|
||||||
|
draw_bg_transparent -> setChecked(export_properties.draw_bg_transparent);
|
||||||
draw_colored_conductors -> setChecked(export_properties.draw_colored_conductors);
|
draw_colored_conductors -> setChecked(export_properties.draw_colored_conductors);
|
||||||
|
|
||||||
if (export_properties.exported_area == QET::BorderArea) {
|
if (export_properties.exported_area == QET::BorderArea) {
|
||||||
@@ -207,6 +209,10 @@ void ExportPropertiesWidget::build()
|
|||||||
draw_colored_conductors = new QCheckBox(tr("Conserver les couleurs des conducteurs"), groupbox_options);
|
draw_colored_conductors = new QCheckBox(tr("Conserver les couleurs des conducteurs"), groupbox_options);
|
||||||
optionshlayout -> addWidget(draw_colored_conductors, 3, 0);
|
optionshlayout -> addWidget(draw_colored_conductors, 3, 0);
|
||||||
|
|
||||||
|
// use transparent background for SVG-Export
|
||||||
|
draw_bg_transparent = new QCheckBox(tr("SVG: fond transparent"), groupbox_options);
|
||||||
|
optionshlayout -> addWidget(draw_bg_transparent, 3, 1);
|
||||||
|
|
||||||
vboxLayout -> addWidget(groupbox_options);
|
vboxLayout -> addWidget(groupbox_options);
|
||||||
|
|
||||||
setLayout(vboxLayout);
|
setLayout(vboxLayout);
|
||||||
@@ -220,6 +226,7 @@ void ExportPropertiesWidget::build()
|
|||||||
setTabOrder(draw_grid, draw_titleblock);
|
setTabOrder(draw_grid, draw_titleblock);
|
||||||
setTabOrder(draw_titleblock, draw_terminals);
|
setTabOrder(draw_titleblock, draw_terminals);
|
||||||
setTabOrder(draw_terminals, draw_colored_conductors);
|
setTabOrder(draw_terminals, draw_colored_conductors);
|
||||||
|
setTabOrder(draw_colored_conductors, draw_bg_transparent);
|
||||||
|
|
||||||
// connexion du bouton permettant le choix du repertoire
|
// connexion du bouton permettant le choix du repertoire
|
||||||
connect(button_browse, SIGNAL(released()), this, SLOT(slot_chooseADirectory()));
|
connect(button_browse, SIGNAL(released()), this, SLOT(slot_chooseADirectory()));
|
||||||
@@ -231,5 +238,6 @@ void ExportPropertiesWidget::build()
|
|||||||
connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
||||||
connect(draw_titleblock, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
connect(draw_titleblock, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
||||||
connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
||||||
|
connect(draw_bg_transparent, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
||||||
connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ExportPropertiesWidget : public QWidget {
|
|||||||
QCheckBox *draw_border;
|
QCheckBox *draw_border;
|
||||||
QCheckBox *draw_titleblock;
|
QCheckBox *draw_titleblock;
|
||||||
QCheckBox *draw_terminals;
|
QCheckBox *draw_terminals;
|
||||||
|
QCheckBox *draw_bg_transparent;
|
||||||
QCheckBox *draw_colored_conductors;
|
QCheckBox *draw_colored_conductors;
|
||||||
QRadioButton *export_border;
|
QRadioButton *export_border;
|
||||||
QRadioButton *export_elements;
|
QRadioButton *export_elements;
|
||||||
|
|||||||
Reference in New Issue
Block a user