Button for clearing the sorting columns

A new button in the "Browse Data" toolbar for clearing the sorting columns
and returning to the default table order.

New icon created as a composition of icons from the Silk icon set.

See issue  #1761
This commit is contained in:
mgrojo
2019-08-12 09:38:12 +02:00
committed by Martin Kleusberg
parent e40271f042
commit 732cda89fd
5 changed files with 32 additions and 0 deletions

View File

@@ -2087,6 +2087,7 @@ void MainWindow::activateFields(bool enable)
ui->actionForeignKeyCheck->setEnabled(enable);
ui->actionOptimize->setEnabled(enable);
ui->actionClearFilters->setEnabled(enable);
ui->actionClearSorting->setEnabled(enable);
ui->actionSaveFilterAsPopup->setEnabled(enable);
ui->dockEdit->setEnabled(enable);
ui->dockPlot->setEnabled(enable);
@@ -3441,6 +3442,15 @@ void MainWindow::on_actionClearFilters_triggered()
ui->dataTable->filterHeader()->clearFilters();
}
void MainWindow::on_actionClearSorting_triggered()
{
// Get the current list of sort columns
auto& columns = browseTableSettings[currentlyBrowsedTableName()].query.orderBy();
columns.clear();
// Set cleared vector of sort-by columns
m_browseTableModel->sort(columns);
}
void MainWindow::copyCurrentCreateStatement()
{
// Cancel if no field is currently selected

View File

@@ -280,6 +280,7 @@ private slots:
void editCondFormats(int column);
void editEncryption();
void on_actionClearFilters_triggered();
void on_actionClearSorting_triggered();
void copyCurrentCreateStatement();
void showDataColumnPopupMenu(const QPoint& pos);
void showRecordPopupMenu(const QPoint& pos);

View File

@@ -177,6 +177,8 @@ You can drag SQL statements from an object row and drop them into other applicat
</property>
<addaction name="actionRefresh"/>
<addaction name="actionClearFilters"/>
<addaction name="actionClearSorting"/>
<addaction name="separator"/>
<addaction name="actionSaveFilterAsPopup"/>
<addaction name="actionPrintTable"/>
<addaction name="separator"/>
@@ -2600,6 +2602,24 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
<string>Browse Table</string>
</property>
</action>
<action name="actionClearSorting">
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/clear_sorting</normaloff>:/icons/clear_sorting</iconset>
</property>
<property name="text">
<string>Clear Sorting</string>
</property>
<property name="toolTip">
<string>Reset the order of rows to the default</string>
</property>
<property name="statusTip">
<string>This button clears the sorting columns specified for the currently browsed table and returns to the default order.</string>
</property>
<property name="whatsThis">
<string>This button clears the sorting columns specified for the currently browsed table and returns to the default order.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

BIN
src/icons/clear_sorting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

View File

@@ -83,5 +83,6 @@
<file alias="cond_formats">color_swatch.png</file>
<file alias="clear_cond_formats">clear_cond_formats.png</file>
<file alias="edit_cond_formats">edit_cond_formats.png</file>
<file alias="clear_sorting">clear_sorting.png</file>
</qresource>
</RCC>