mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-10 05:38:32 -06:00
Data Browser: export query results as JSON
In this case too, 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. Renamed the CSV action for consistency. Related to issue #2607
This commit is contained in:
@@ -50,6 +50,7 @@ TableBrowser::TableBrowser(DBBrowserDB* _db, QWidget* parent) :
|
||||
|
||||
popupSaveFilterAsMenu = new QMenu(this);
|
||||
popupSaveFilterAsMenu->addAction(ui->actionFilteredTableExportCsv);
|
||||
popupSaveFilterAsMenu->addAction(ui->actionFilteredTableExportJson);
|
||||
popupSaveFilterAsMenu->addAction(ui->actionFilterSaveAsView);
|
||||
ui->actionSaveFilterAsPopup->setMenu(popupSaveFilterAsMenu);
|
||||
qobject_cast<QToolButton*>(ui->browseToolbar->widgetForAction(ui->actionSaveFilterAsPopup))->setPopupMode(QToolButton::InstantPopup);
|
||||
@@ -1403,12 +1404,18 @@ void TableBrowser::editDisplayFormat()
|
||||
}
|
||||
}
|
||||
|
||||
void TableBrowser::exportFilteredTable()
|
||||
void TableBrowser::exportCsvFilteredTable()
|
||||
{
|
||||
ExportDataDialog dialog(*db, ExportDataDialog::ExportFormatCsv, this, m_model->customQuery(false));
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void TableBrowser::exportJsonFilteredTable()
|
||||
{
|
||||
ExportDataDialog dialog(*db, ExportDataDialog::ExportFormatJson, this, m_model->customQuery(false));
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void TableBrowser::saveFilterAsView()
|
||||
{
|
||||
// Save as view a custom query without rowid
|
||||
|
||||
@@ -130,7 +130,8 @@ private slots:
|
||||
void on_actionClearFilters_triggered();
|
||||
void on_actionClearSorting_triggered();
|
||||
void editDisplayFormat();
|
||||
void exportFilteredTable();
|
||||
void exportCsvFilteredTable();
|
||||
void exportJsonFilteredTable();
|
||||
void saveFilterAsView();
|
||||
void setTableEncoding(bool forAllTables = false);
|
||||
void setDefaultTableEncoding();
|
||||
|
||||
@@ -670,6 +670,20 @@
|
||||
<string>This button exports the data of the browsed table as currently displayed (after filters, display formats and order column) as a CSV file.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFilteredTableExportJson">
|
||||
<property name="text">
|
||||
<string>Export to &JSON</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Export the filtered data to JSON</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Export the filtered data to JSON</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This button exports the data of the browsed table as currently displayed (after filters, display formats and order column) as a JSON file.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFilterSaveAsView">
|
||||
<property name="text">
|
||||
<string>Save as &view</string>
|
||||
@@ -1324,7 +1338,23 @@
|
||||
<sender>actionFilteredTableExportCsv</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>TableBrowser</receiver>
|
||||
<slot>exportFilteredTable()</slot>
|
||||
<slot>exportCsvFilteredTable()</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>actionFilteredTableExportJson</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>TableBrowser</receiver>
|
||||
<slot>exportJsonFilteredTable()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
@@ -1431,7 +1461,8 @@
|
||||
<slot>addRecord()</slot>
|
||||
<slot>deleteRecord()</slot>
|
||||
<slot>insertValues()</slot>
|
||||
<slot>exportFilteredTable</slot>
|
||||
<slot>exportCsvFilteredTable</slot>
|
||||
<slot>exportJsonFilteredTable</slot>
|
||||
<slot>saveFilterAsView</slot>
|
||||
<slot>setDefaultTableEncoding()</slot>
|
||||
<slot>hideColumns()</slot>
|
||||
|
||||
Reference in New Issue
Block a user