mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-08 06:42:34 +01:00
Merge pull request #345 from plc-user/master
export: set maximum width / height according specifications of export-type
This commit is contained in:
@@ -868,7 +868,25 @@ void ExportDialog::slot_changeFilesExtension(bool force_extension) {
|
|||||||
// recupere le format a utiliser (acronyme et extension)
|
// recupere le format a utiliser (acronyme et extension)
|
||||||
QString format_acronym = epw -> exportProperties().format;
|
QString format_acronym = epw -> exportProperties().format;
|
||||||
QString format_extension = "." + format_acronym.toLower();
|
QString format_extension = "." + format_acronym.toLower();
|
||||||
|
|
||||||
|
// set maximum width / height according specifications of export-type
|
||||||
|
if (format_extension == ".bmp") {
|
||||||
|
foreach (auto line, diagram_lines_.values() ) {
|
||||||
|
line->width ->setRange(1, BMPmaxSize);
|
||||||
|
line->height->setRange(1, BMPmaxSize);
|
||||||
|
}
|
||||||
|
} else if (format_extension == ".jpg") {
|
||||||
|
foreach (auto line, diagram_lines_.values() ) {
|
||||||
|
line->width ->setRange(1, JPGmaxSize);
|
||||||
|
line->height->setRange(1, JPGmaxSize);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach (auto line, diagram_lines_.values() ) {
|
||||||
|
line->width ->setRange(1, GeneralMaxSize);
|
||||||
|
line->height->setRange(1, GeneralMaxSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// parcourt les schemas a exporter
|
// parcourt les schemas a exporter
|
||||||
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
|
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
|
||||||
QString diagram_filename = diagram_line -> file_name -> text();
|
QString diagram_filename = diagram_line -> file_name -> text();
|
||||||
@@ -1008,16 +1026,16 @@ ExportDialog::ExportDiagramLine::ExportDiagramLine(Diagram *dia, QSize diagram_s
|
|||||||
file_name -> setMinimumWidth(280);
|
file_name -> setMinimumWidth(280);
|
||||||
|
|
||||||
width = new QSpinBox();
|
width = new QSpinBox();
|
||||||
width -> setRange(1, 100000);
|
width -> setRange(1, GeneralMaxSize);
|
||||||
width -> setSuffix(tr("px"));
|
width -> setSuffix(tr("px"));
|
||||||
width -> setValue(diagram_size.width());
|
width -> setValue(diagram_size.width());
|
||||||
|
|
||||||
height = new QSpinBox();
|
height = new QSpinBox();
|
||||||
height -> setRange(1, 100000);
|
height -> setRange(1, GeneralMaxSize);
|
||||||
height -> setSuffix(tr("px"));
|
height -> setSuffix(tr("px"));
|
||||||
height -> setValue(diagram_size.height());
|
height -> setValue(diagram_size.height());
|
||||||
|
|
||||||
x_label = new QLabel("*");
|
x_label = new QLabel("×");
|
||||||
|
|
||||||
keep_ratio = new QPushButton();
|
keep_ratio = new QPushButton();
|
||||||
keep_ratio -> setCheckable(true);
|
keep_ratio -> setCheckable(true);
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ class ExportDialog : public QDialog {
|
|||||||
QSignalMapper *reset_mapper_;
|
QSignalMapper *reset_mapper_;
|
||||||
QSignalMapper *clipboard_mapper_;
|
QSignalMapper *clipboard_mapper_;
|
||||||
|
|
||||||
|
// constants for exporting images:
|
||||||
|
static const int BMPmaxSize = 32767;
|
||||||
|
static const int JPGmaxSize = 65535;
|
||||||
|
static const int GeneralMaxSize = 100000;
|
||||||
|
|
||||||
// project whose diagrams are to be exported
|
// project whose diagrams are to be exported
|
||||||
QETProject *project_;
|
QETProject *project_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user