24 setCaption(tr(
"Export graphics"));
34 lblFilename =
new QLabel(tr(
"Save to file (Graphics format by extension)"));
37 lblRatio =
new QLabel(tr(
"Scale factor: "));
38 lblFormat =
new QLabel(tr(
"Image format:"));
41 connect(
ExportButt,SIGNAL(clicked()),
this,SLOT(accept()));
43 connect(
CancelButt,SIGNAL(clicked()),
this,SLOT(reject()));
44 SaveButt =
new QPushButton(tr(
"File"));
51 QIntValidator *val =
new QIntValidator(0,64000,
this);
57 editScale =
new QLineEdit(QString::number(1.0));
58 QDoubleValidator *val1 =
new QDoubleValidator(0,20.0,2,
this);
63 lst<<tr(
"Colour")<<tr(
"Monochrome");
66 cbRatio =
new QCheckBox(tr(
"Original width to height ratio"));
82 cbSelected =
new QCheckBox(tr(
"Export selected only"));
91 top =
new QVBoxLayout;
118 this->setLayout(
top);
120 this->layout()->setSizeConstraint(QLayout::SetFixedSize);
121 this->setWindowTitle(tr(
"Export schematic to raster or vector image"));
154 QFileDialog dialog(
this, tr(
"Export to image"),
editFilename->text(),
155 "SVG vector graphics (*.svg) ;;"
156 "PNG images (*.png) ;;"
157 "JPEG images (*.jpg *.jpeg) ;;"
159 "PDF + LaTeX (*.pdf_tex) ;;"
160 "EPS Encapsulated Postscript (*.eps)");
161 dialog.setAcceptMode(QFileDialog::AcceptSave);
164 QString nam = dialog.selectedFile();
166 if(dialog.selectedNameFilter().contains(
"*.png")) extension=QString(
".png");
167 if(dialog.selectedNameFilter().contains(
"*.jpg")) extension=QString(
".jpg");
168 if(dialog.selectedNameFilter().contains(
"*.svg")) extension=QString(
".svg");
169 if(dialog.selectedNameFilter().contains(
"*.pdf")) extension=QString(
".pdf");
170 if(dialog.selectedNameFilter().contains(
"*.pdf_tex")) extension=QString(
".pdf_tex");
171 if(dialog.selectedNameFilter().contains(
"*.eps")) extension=QString(
".eps");
172 if(nam.toLower().section(
"/",-1,-1).contains(
"."))
209 editScale->setText(QString::number(1.0));
227 QFileInfo graphics_file(filename);
228 QString ext = graphics_file.suffix();
230 if ((ext==
"svg")||(ext==
"pdf")||(ext==
"eps")||(ext==
"pdf_tex")) {
246 QStringList filetypes;
248 filetypes<<
"png"<<
"svg"<<
"jpeg"<<
"jpg"<<
"pdf"<<
"pdf_tex"<<
"eps"
249 <<
"PNG"<<
"JPG"<<
"SVG"<<
"JPEG"<<
"PDF"
252 if (filetypes.contains(inf.suffix())) {
262 QStringList filetypes;
264 filetypes<<
"pdf"<<
"pdf_tex"<<
"eps"<<
"PDF"<<
"PDF_TEX"<<
"EPS";
266 if (filetypes.contains(inf.suffix())) {
276 if (inf.suffix().toLower()==
"pdf")
return true;
283 if (inf.suffix().toLower()==
"pdf_tex")
return true;
290 if (inf.suffix().toLower()==
"eps")
return true;
310 this->setWindowTitle(tr(
"Export diagram to raster or vector image"));
QLineEdit * editResolutionX
ExportDialog::ImgFormat getImgFormat()
void restoreOriginalWtoH()
QLineEdit * editResolutionY
ExportDialog(int w, int h, int wsel, int hsel, QString filename_, bool nosel_=true, QWidget *parent=0)
void setSvg(QString filename)