mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
export: set maximum width / height according limitations in QPainter
This commit is contained in:
parent
924d1c1b05
commit
bbbf77597a
@ -869,16 +869,13 @@ void ExportDialog::slot_changeFilesExtension(bool force_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
|
// set maximum width / height according limitations in QPainter
|
||||||
if (format_extension == ".bmp") {
|
if ((format_extension == ".bmp") ||
|
||||||
|
(format_extension == ".jpg") ||
|
||||||
|
(format_extension == ".png")) {
|
||||||
foreach (auto line, diagram_lines_.values() ) {
|
foreach (auto line, diagram_lines_.values() ) {
|
||||||
line->width ->setRange(1, BMPmaxSize);
|
line->width ->setRange(1, RasterMaxSize);
|
||||||
line->height->setRange(1, BMPmaxSize);
|
line->height->setRange(1, RasterMaxSize);
|
||||||
}
|
|
||||||
} else if (format_extension == ".jpg") {
|
|
||||||
foreach (auto line, diagram_lines_.values() ) {
|
|
||||||
line->width ->setRange(1, JPGmaxSize);
|
|
||||||
line->height->setRange(1, JPGmaxSize);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach (auto line, diagram_lines_.values() ) {
|
foreach (auto line, diagram_lines_.values() ) {
|
||||||
|
@ -59,7 +59,7 @@ class ExportDialog : public QDialog {
|
|||||||
QPushButton *preview;
|
QPushButton *preview;
|
||||||
QPushButton *clipboard;
|
QPushButton *clipboard;
|
||||||
};
|
};
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_;
|
QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_;
|
||||||
@ -78,15 +78,15 @@ class ExportDialog : public QDialog {
|
|||||||
QSignalMapper *ratio_mapper_;
|
QSignalMapper *ratio_mapper_;
|
||||||
QSignalMapper *reset_mapper_;
|
QSignalMapper *reset_mapper_;
|
||||||
QSignalMapper *clipboard_mapper_;
|
QSignalMapper *clipboard_mapper_;
|
||||||
|
|
||||||
|
// QPainter limits size of pixel-images to 2^15 - 1
|
||||||
// constants for exporting images:
|
// constants for exporting images:
|
||||||
static const int BMPmaxSize = 32767;
|
static const int RasterMaxSize = 32767;
|
||||||
static const int JPGmaxSize = 65535;
|
|
||||||
static const int GeneralMaxSize = 100000;
|
static const int GeneralMaxSize = 100000;
|
||||||
|
|
||||||
// project whose diagrams are to be exported
|
// project whose diagrams are to be exported
|
||||||
QETProject *project_;
|
QETProject *project_;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
QWidget *initDiagramsListPart();
|
QWidget *initDiagramsListPart();
|
||||||
void saveReloadDiagramParameters(Diagram *, bool = true);
|
void saveReloadDiagramParameters(Diagram *, bool = true);
|
||||||
@ -96,7 +96,7 @@ class ExportDialog : public QDialog {
|
|||||||
void exportDiagram(ExportDiagramLine *);
|
void exportDiagram(ExportDiagramLine *);
|
||||||
qreal diagramRatio(Diagram *);
|
qreal diagramRatio(Diagram *);
|
||||||
QSize diagramSize(Diagram *);
|
QSize diagramSize(Diagram *);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_correctWidth(int);
|
void slot_correctWidth(int);
|
||||||
void slot_correctHeight(int);
|
void slot_correctHeight(int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user