From 27f8b96edc713c239807a1fced9c62f915e0c1f0 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 16 Aug 2016 22:51:21 +0200 Subject: [PATCH] Simplify code The parameter for populateTable isn't needed anymore --- src/MainWindow.cpp | 9 ++++----- src/MainWindow.h | 2 +- src/MainWindow.ui | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 9780b530..d603385c 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -389,14 +389,14 @@ void MainWindow::clearTableBrowser() qobject_cast(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; diff --git a/src/MainWindow.h b/src/MainWindow.h index 4160fb03..e32d6a51 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 73f6984c..56183a8e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -2071,7 +2071,7 @@ comboBrowseTable activated(QString) MainWindow - populateTable(QString) + populateTable() 118 @@ -2967,7 +2967,7 @@ fileOpen() fileClose() - populateTable(QString) + populateTable() addRecord() deleteRecord() navigatePrevious()