Merge pull request #346 from plc-user/master

export: set maximum width / height according limitations in QPainter
This commit is contained in:
Laurent Trinques 2025-02-07 15:16:40 +01:00 committed by GitHub
commit ba9fea3fd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 16 deletions

View File

@ -869,16 +869,13 @@ void ExportDialog::slot_changeFilesExtension(bool force_extension) {
QString format_acronym = epw -> exportProperties().format;
QString format_extension = "." + format_acronym.toLower();
// set maximum width / height according specifications of export-type
if (format_extension == ".bmp") {
// set maximum width / height according limitations in QPainter
if ((format_extension == ".bmp") ||
(format_extension == ".jpg") ||
(format_extension == ".png")) {
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);
line->width ->setRange(1, RasterMaxSize);
line->height->setRange(1, RasterMaxSize);
}
} else {
foreach (auto line, diagram_lines_.values() ) {

View File

@ -79,9 +79,9 @@ class ExportDialog : public QDialog {
QSignalMapper *reset_mapper_;
QSignalMapper *clipboard_mapper_;
// QPainter limits size of pixel-images to 2^15 - 1
// constants for exporting images:
static const int BMPmaxSize = 32767;
static const int JPGmaxSize = 65535;
static const int RasterMaxSize = 32767;
static const int GeneralMaxSize = 100000;
// project whose diagrams are to be exported