QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgslayoutimageexportoptionsdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutimageexportoptionsdialog.h
3 -------------------------------------
4 begin : December 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLAYOUTIMAGEEXPORTOPTIONSDIALOG_H
19#define QGSLAYOUTIMAGEEXPORTOPTIONSDIALOG_H
20
21// We don't want to expose this in the public API
22#define SIP_NO_FILE
23
24#include "ui_qgslayoutimageexportoptions.h"
25
26#include "qgis_gui.h"
27
28#include <QDialog>
29
36class GUI_EXPORT QgsLayoutImageExportOptionsDialog : public QDialog, private Ui::QgsLayoutImageExportOptionsDialog
37{
38 Q_OBJECT
39
40 public:
47 QgsLayoutImageExportOptionsDialog( QWidget *parent = nullptr, const QString &fileExtension = QString(), Qt::WindowFlags flags = Qt::WindowFlags() );
48
54 void setResolution( double resolution );
55
61 double resolution() const;
62
68 void setImageSize( QSizeF size );
69
74 int imageWidth() const;
75
80 int imageHeight() const;
81
87 void setCropToContents( bool crop );
88
93 bool cropToContents() const;
94
99 void setGenerateWorldFile( bool generate );
100
105 bool generateWorldFile() const;
106
111 void setAntialiasing( bool antialias );
112
117 bool antialiasing() const;
118
126 void getCropMargins( int &topMargin, int &rightMargin, int &bottomMargin, int &leftMargin ) const;
127
135 void setCropMargins( int topMargin, int rightMargin, int bottomMargin, int leftMargin );
136
138 void setOpenAfterExporting( bool enabled );
140 bool openAfterExporting() const;
141
142
144 void setQuality( int quality );
146 int quality() const;
147
148 private slots:
149
150 void mWidthSpinBox_valueChanged( int value );
151 void mHeightSpinBox_valueChanged( int value );
152 void mResolutionSpinBox_valueChanged( int value );
153 void clipToContentsToggled( bool state );
154 void showHelp();
155
156 private:
157 bool shouldShowQuality() const;
158 QSizeF mImageSize;
159 QString mFileExtension;
160};
161
162#endif // QGSLAYOUTIMAGEEXPORTOPTIONSDIALOG_H
bool antialiasing() const
Returns whether antialiasing should be used in the export.
void setQuality(int quality)
Sets the image quality (for JPEG).
void setCropToContents(bool crop)
Sets whether the crop to contents option should be checked in the dialog.
void setImageSize(QSizeF size)
Sets the target image size.
void setAntialiasing(bool antialias)
Sets whether antialiasing should be used in the export.
int quality() const
Returns the image quality.
double resolution() const
Returns the selected resolution from the dialog.
QgsLayoutImageExportOptionsDialog(QWidget *parent=nullptr, const QString &fileExtension=QString(), Qt::WindowFlags flags=Qt::WindowFlags())
Constructor for QgsLayoutImageExportOptionsDialog.
int imageWidth() const
Returns the user-set image width in pixels.
bool cropToContents() const
Returns whether the crop to contents option is checked in the dialog.
void setOpenAfterExporting(bool enabled)
Sets whether to open the pdf after exporting it.
bool generateWorldFile() const
Returns whether the generate world file option is checked in the dialog.
void setCropMargins(int topMargin, int rightMargin, int bottomMargin, int leftMargin)
Sets the current crop to contents margin values, in pixels.
void setResolution(double resolution)
Sets the initial resolution displayed in the dialog.
void getCropMargins(int &topMargin, int &rightMargin, int &bottomMargin, int &leftMargin) const
Fetches the current crop to contents margin values, in pixels.
int imageHeight() const
Returns the user-set image height in pixels.
void setGenerateWorldFile(bool generate)
Sets whether the generate world file option should be checked.
bool openAfterExporting() const
Returns whether the pdf should be opened after exporting it.