Files
qelectrotech-source-mirror/sources/exportpropertieswidget.h
T
ispyisail da6eb83035 Add an SVG export option to store pictures smaller
An SVG keeps every picture at full resolution, whatever size it is
drawn at: a folio with 22 phone photos shown at a tenth of their size
gave a 270 MB SVG and took 65 s to write, most of it compressing the
photos again.

The export dialog gets "SVG: smaller pictures" (off by default, kept
with the other export settings), and --export-svg gets
--svg-small-pictures. With it, a picture is stored at four times the
size it is drawn at when that is smaller than the picture; smaller
pictures stay whole. Four times is about 375 dpi on a printed folio.

The exporter sets Diagram::smallPictures() for its own drawing only,
so screen, print, PDF and PNG are unchanged. It is not part of
applyProperties(), which every format uses.

On that project: --export-svg 84.9 s -> 34.5 s (opening is 20 s of
both), 270 MB -> 57 MB, peak memory 2.45 -> 1.86 GB. Rendered at twice
the folio size, the two SVGs differ by more than 32/255 on 0.23 % of
pixels, along photo detail.

tst_svgsmallpictures: an 800x600 picture drawn at 0.1 is stored at
320x240 with the option, through --export-svg and through the
dialog's QPicture route, and at 800x600 without it; a 40x30 picture
stays whole. It fails when the factor is changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:12:38 +13:00

76 lines
2.1 KiB
C++

/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EXPORT_PROPERTIES_WIDGET_H
#define EXPORT_PROPERTIES_WIDGET_H
#include <QtWidgets>
#include "exportproperties.h"
/**
This widget enables users to edit the various options available when
exporting a project.
*/
class ExportPropertiesWidget : public QWidget {
Q_OBJECT
// constructors, destructor
public:
ExportPropertiesWidget(QWidget * = nullptr);
ExportPropertiesWidget(const ExportProperties &, QWidget * = nullptr);
~ExportPropertiesWidget() override;
private:
ExportPropertiesWidget(const ExportPropertiesWidget &);
// methods
public:
void setExportProperties(const ExportProperties &);
ExportProperties exportProperties() const;
void setPrintingMode(bool);
public slots:
void slot_chooseADirectory();
signals:
void formatChanged();
void exportedAreaChanged();
void optionChanged();
private:
void build();
// attributes
private:
QLabel *dirpath_label;
QLineEdit *dirpath;
QPushButton *button_browse;
QLabel *format_label;
QComboBox *format;
QCheckBox *draw_grid;
QCheckBox *draw_border;
QCheckBox *draw_titleblock;
QCheckBox *draw_terminals;
QCheckBox *draw_terminal_names;
QCheckBox *draw_bg_transparent;
QCheckBox *draw_colored_conductors;
QCheckBox *dxf_blocks;
QCheckBox *dxf_attributes;
QCheckBox *svg_small_pictures;
QRadioButton *export_border;
QRadioButton *export_elements;
QButtonGroup *exported_content_choices;
};
#endif