mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-17 01:09:36 -06:00
Export query results as JSON
The corresponding menu entry for exporting the query results to JSON was missing although it was straight forward to add it with the same scheme as for CSV. Related to issue #2607
This commit is contained in:
@@ -266,6 +266,7 @@ void MainWindow::init()
|
||||
|
||||
popupSaveSqlResultsMenu = new QMenu(this);
|
||||
popupSaveSqlResultsMenu->addAction(ui->actionSqlResultsExportCsv);
|
||||
popupSaveSqlResultsMenu->addAction(ui->actionSqlResultsExportJson);
|
||||
popupSaveSqlResultsMenu->addAction(ui->actionSqlResultsSaveAsView);
|
||||
ui->actionSqlResultsSave->setMenu(popupSaveSqlResultsMenu);
|
||||
qobject_cast<QToolButton*>(ui->toolbarSql->widgetForAction(ui->actionSqlResultsSave))->setPopupMode(QToolButton::InstantPopup);
|
||||
@@ -2212,6 +2213,11 @@ void MainWindow::saveSqlResultsAsCsv()
|
||||
qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget())->saveAsCsv();
|
||||
}
|
||||
|
||||
void MainWindow::saveSqlResultsAsJson()
|
||||
{
|
||||
qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget())->saveAsJson();
|
||||
}
|
||||
|
||||
void MainWindow::saveSqlResultsAsView()
|
||||
{
|
||||
saveAsView(qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget())->getModel()->query());
|
||||
|
||||
@@ -198,6 +198,7 @@ private slots:
|
||||
void saveSqlFile();
|
||||
void saveSqlFileAs();
|
||||
void saveSqlResultsAsCsv();
|
||||
void saveSqlResultsAsJson();
|
||||
void saveSqlResultsAsView();
|
||||
void loadExtension();
|
||||
void checkNewVersion(const QString& versionstring, const QString& url);
|
||||
|
||||
@@ -1916,6 +1916,11 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
|
||||
<string>Export to &CSV</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSqlResultsExportJson">
|
||||
<property name="text">
|
||||
<string>Export to &JSON</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSqlResultsSaveAsView">
|
||||
<property name="text">
|
||||
<string>Save as &view</string>
|
||||
@@ -3134,6 +3139,22 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSqlResultsExportJson</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>saveSqlResultsAsJson()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>518</x>
|
||||
<y>314</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSqlResultsSaveAsView</sender>
|
||||
<signal>triggered()</signal>
|
||||
|
||||
@@ -131,6 +131,12 @@ void SqlExecutionArea::saveAsCsv()
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void SqlExecutionArea::saveAsJson()
|
||||
{
|
||||
ExportDataDialog dialog(db, ExportDataDialog::ExportFormatJson, this, model->query());
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void SqlExecutionArea::reloadSettings()
|
||||
{
|
||||
// Reload editor and table settings
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
public slots:
|
||||
void finishExecution(const QString& result, const bool ok);
|
||||
void saveAsCsv();
|
||||
void saveAsJson();
|
||||
void reloadSettings();
|
||||
void fetchedData();
|
||||
void setFindFrameVisibility(bool show);
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
<connections/>
|
||||
<slots>
|
||||
<slot>saveAsCsv()</slot>
|
||||
<slot>saveAsJson()</slot>
|
||||
<slot>saveAsView()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user