本文整理汇总了C++中QCustomPlot::savePdf方法的典型用法代码示例。如果您正苦于以下问题:C++ QCustomPlot::savePdf方法的具体用法?C++ QCustomPlot::savePdf怎么用?C++ QCustomPlot::savePdf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCustomPlot
的用法示例。
在下文中一共展示了QCustomPlot::savePdf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctrlSShortcut
bool FeaturePlot::ctrlSShortcut(){
if( !initialized ) return false;
QCustomPlot *plot = ui->plot;
QString filename = QFileDialog::getSaveFileName();
if( filename == "" ){
return false;
}
if( filename.endsWith(".png") ){
return plot->savePng( filename, plot->width(), plot->height() );
}
if( filename.endsWith(".jpg") ){
return plot->saveJpg( filename, plot->width(), plot->height() );
}
if( filename.endsWith(".jpeg") ){
return plot->saveJpg( filename, plot->width(), plot->height() );
}
if( filename.endsWith(".pdf") ){
return plot->savePdf( filename, plot->width(), plot->height() );
}
//If we get this far then save as a png
return plot->savePng( filename, plot->width(), plot->height() );
}
示例2: actionSavePdf_triggered
void viewGVpropertieslayout::actionSavePdf_triggered() {
// first get a pointer to the current plot!
QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget();
QString fileName = QFileDialog::getSaveFileName(this, tr("Save graph as pdf"), "", tr("Pdf (*.pdf)"));
if (!fileName.isEmpty())
currPlot->savePdf(fileName);
}
示例3: on_exportPlotButton_clicked
void YarrGui::on_exportPlotButton_clicked(){
if(ui->scanPlots_tabWidget->count() == 0){return;}
if(ui->plotTree->currentItem() == nullptr) {
std::cerr << "Please select plot. Returning... " << std::endl;
return;
}
if(ui->plotTree->currentItem()->childCount() > 0){
std::cerr << "Please select plot. Returning... " << std::endl;
return;
}
QWidget * toCast = ui->scanPlots_tabWidget->currentWidget();
QCustomPlot * myPlot = dynamic_cast<QCustomPlot*>(toCast);
if(myPlot == nullptr){
std::cerr << "Severe cast error. Returning... " << std::endl;
return;
}
/* QString myFileName = ui->plotTree->currentItem()->text(0);
struct tm * timeinfo;
time_t rawtime;
time(&rawtime);
timeinfo = localtime(&rawtime);
myFileName = myFileName
+ QString::number(1900+(timeinfo->tm_year)) + '_'
+ (timeinfo->tm_mon > 8 ? QString::number(1+(timeinfo->tm_mon)) : ('0' + QString::number(1+(timeinfo->tm_mon)))) + '_'
+ QString::number((timeinfo->tm_mday)) + '_'
+ QString::number((timeinfo->tm_hour)) + '_'
+ QString::number((timeinfo->tm_min)) + '_'
+ QString::number((timeinfo->tm_sec)) + ".pdf";
*/
QString myFileName = QFileDialog::getSaveFileName(this,
"Save plot as PDF",
"./",
"Portable Document Format(*.pdf)");
myPlot->savePdf(myFileName);
std::cout << "Saved current plot to \"" << myFileName.toStdString() << '"' << std::endl;
return;
}