mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
plot: add a button to save the current plot as different file formats
This commit is contained in:
@@ -1562,3 +1562,32 @@ void MainWindow::on_treePlotColumns_itemChanged(QTreeWidgetItem *changeitem, int
|
||||
}
|
||||
updatePlot(m_currentPlotModel, false);
|
||||
}
|
||||
|
||||
void MainWindow::on_butSavePlot_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Choose a filename to save under"));
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
if(fileName.endsWith(".png", Qt::CaseInsensitive))
|
||||
{
|
||||
ui->plotWidget->savePng(fileName);
|
||||
}
|
||||
else if(fileName.endsWith(".jpg", Qt::CaseInsensitive))
|
||||
{
|
||||
ui->plotWidget->saveJpg(fileName);
|
||||
}
|
||||
else if(fileName.endsWith(".pdf", Qt::CaseInsensitive))
|
||||
{
|
||||
ui->plotWidget->savePdf(fileName);
|
||||
}
|
||||
else if(fileName.endsWith(".bmp", Qt::CaseInsensitive))
|
||||
{
|
||||
ui->plotWidget->saveBmp(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName += ".png";
|
||||
ui->plotWidget->savePng(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user