mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ private slots:
|
||||
virtual void httpresponse(QNetworkReply* reply);
|
||||
virtual void updatePlot(SqliteTableModel* model, bool update = true);
|
||||
void on_treePlotColumns_itemChanged(QTreeWidgetItem *item, int column);
|
||||
void on_butSavePlot_clicked();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -997,6 +997,66 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butSavePlot">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Save current plot...</p><p>File format choosen by extension (png, jpg, pdf, bmp)</p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Save current plot...</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/save_table</normaloff>:/icons/save_table</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user