Simplify code

The parameter for populateTable isn't needed anymore
This commit is contained in:
Martin Kleusberg
2016-08-16 22:51:21 +02:00
parent efd4fc4820
commit 27f8b96edc
3 changed files with 7 additions and 8 deletions

View File

@@ -389,14 +389,14 @@ void MainWindow::clearTableBrowser()
qobject_cast<FilterTableHeader*>(ui->dataTable->horizontalHeader())->generateFilters(0);
}
void MainWindow::populateTable(QString tablename)
void MainWindow::populateTable()
{
// Early exit if the Browse Data tab isn't visible as there is no need to update it in this case
if(ui->mainTab->currentIndex() != 1)
return;
// Remove the model-view link if the table name is empty in order to remove any data from the view
if(ui->comboBrowseTable->model()->rowCount(ui->comboBrowseTable->rootModelIndex()) == 0 && tablename.isEmpty())
if(ui->comboBrowseTable->model()->rowCount(ui->comboBrowseTable->rootModelIndex()) == 0)
{
clearTableBrowser();
return;
@@ -404,9 +404,8 @@ void MainWindow::populateTable(QString tablename)
QApplication::setOverrideCursor(Qt::WaitCursor);
// Default parameter -> use current table name
if(tablename.isNull())
tablename = ui->comboBrowseTable->currentText();
// Get current table name
QString tablename = ui->comboBrowseTable->currentText();
// Set model
bool reconnectSelectionSignals = false;

View File

@@ -160,7 +160,7 @@ private slots:
void changeTreeSelection();
void fileNew();
void populateStructure();
void populateTable(QString tablename = QString());
void populateTable();
void clearTableBrowser();
bool fileClose();
void addRecord();

View File

@@ -2071,7 +2071,7 @@
<sender>comboBrowseTable</sender>
<signal>activated(QString)</signal>
<receiver>MainWindow</receiver>
<slot>populateTable(QString)</slot>
<slot>populateTable()</slot>
<hints>
<hint type="sourcelabel">
<x>118</x>
@@ -2967,7 +2967,7 @@
<slots>
<slot>fileOpen()</slot>
<slot>fileClose()</slot>
<slot>populateTable(QString)</slot>
<slot>populateTable()</slot>
<slot>addRecord()</slot>
<slot>deleteRecord()</slot>
<slot>navigatePrevious()</slot>