23 #include <EmfEngine.h> 32 QStringList filename_list = filename.split(
".");
33 QString extension = filename_list.last();
40 if (extension ==
"bmp")
41 success = plot->
saveBmp(filename, 0, 0, 1.0);
42 else if (extension ==
"pdf")
43 success = plot->
savePdf(filename,
false, 0, 0,
"Vespucci 1.0",
"Plot");
44 else if (extension ==
"png"){
48 int quality = QInputDialog::getInt(plot->parentWidget(),
"Enter Quality",
52 plot->
savePng(filename, 0, 0, 1.0, quality);
57 else if (extension ==
"jpg"){
59 int quality = QInputDialog::getInt(plot->parentWidget(),
"Enter Quality",
63 plot->
saveJpg(filename, 0, 0, 1.0, quality);
65 else if (extension ==
"svg"){
76 QSvgGenerator generator;
77 generator.setFileName(filename);
81 painter.
begin(&generator);
82 painter.drawPicture(0, 0, picture);
88 else if (extension ==
"emf"){
99 EmfPaintDevice emf(plot->size(), filename);
102 painter.drawPicture(0, 0, picture);
111 if (extension !=
"tif")
112 filename.append(
".tif");
114 int quality = QInputDialog::getInt(plot->parentWidget(),
116 "Enter 0 for no compression," 117 "1 for LZW lossless compression",
121 success = plot->
saveRastered(filename, 0, 0, 1.0,
"TIF", quality);
158 QProgressDialog *progress =
new QProgressDialog(parent);
159 progress->setWindowModality(Qt::WindowModal);
160 progress->setLabelText(text);
161 progress->setWindowTitle(title);
162 progress->setCancelButton(0);
163 progress->setRange(0,0);
170 if (keys1.size() != keys2.size())
return false;
172 bool key_equal =
false;
173 for (
int i = 0; i < keys1.size(); ++i){
174 key_equal = (keys1[i] == keys2[i]);
182 return QVector<double>::fromStdVector(conv_to<std::vector<double> >::from(data));
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
QProgressDialog * DisplayProgressDialog(QWidget *parent, QString title, QString text)
bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0)
bool begin(QPaintDevice *device)
void setBackground(const QPixmap &pm)
Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)
void setTickLabelFont(const QFont &font)
QVector< double > FromArmaVec(const arma::vec &data)
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
void setFont(const QFont &font)
QPainter subclass used internally.
bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString())
bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
void SetQCPFonts(QCustomPlot *plot, const QFont &font)
Vespucci::SetQCPFonts.
bool KeysAreEqual(QStringList &keys1, QStringList &keys2)
The QCustomPlot surface is immediately refreshed, by calling QWidget::repaint() after the replot...
void setLabelFont(const QFont &font)
void setMode(PainterMode mode, bool enabled=true)
void toPainter(QCPPainter *painter, int width=0, int height=0)
bool SavePlot(QCustomPlot *plot, QString filename)
Vespucci::SavePlot.