diff --git a/mainwindow.cpp b/mainwindow.cpp index 22b78c8..92f9f4b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6349,8 +6349,8 @@ void MainWindow::setShowColumn(QString tableKey, QString columnKey, bool value){ displayCallActivity(); } -bool MainWindow::showColumn(QString tableKey, QString columnKey){ - return m_showColumnsCache.value(tableKey + columnKey, QVariant(true)).toBool(); +bool MainWindow::showColumn(QString tableKey, QString columnKey, bool default_){ + return m_showColumnsCache.value(tableKey + columnKey, QVariant(default_)).toBool(); } void MainWindow::buildShowColumnsMenu(QMenu *menu, QString tableKey){ @@ -6361,6 +6361,12 @@ void MainWindow::buildShowColumnsMenu(QMenu *menu, QString tableKey){ {"RX Time Drift", "tdrift"}, }; + QMap defaultOverride = { + {"tdrift", false}, + {"grid", false}, + {"distance", false} + }; + if(tableKey == "call"){ columnKeys.prepend({"Worked Before Flag", "flag"}); columnKeys.prepend({"Callsign", "callsign"}); @@ -6379,7 +6385,13 @@ void MainWindow::buildShowColumnsMenu(QMenu *menu, QString tableKey){ auto a = menu->addAction(columnLabel); a->setCheckable(true); - a->setChecked(showColumn(tableKey, columnKey)); + + + bool showByDefault = true; + if(defaultOverride.contains(columnKey)){ + showByDefault = defaultOverride[columnKey]; + } + a->setChecked(showColumn(tableKey, columnKey, showByDefault)); connect(a, &QAction::triggered, this, [this, a, tableKey, columnKey](){ setShowColumn(tableKey, columnKey, a->isChecked()); @@ -9414,7 +9426,7 @@ void MainWindow::displayBandActivity() { ui->tableWidgetRXAll->setColumnHidden(0, !showColumn("band", "offset")); ui->tableWidgetRXAll->setColumnHidden(1, !showColumn("band", "timestamp")); ui->tableWidgetRXAll->setColumnHidden(2, !showColumn("band", "snr")); - ui->tableWidgetRXAll->setColumnHidden(3, !showColumn("band", "tdrift")); + ui->tableWidgetRXAll->setColumnHidden(3, !showColumn("band", "tdrift", false)); // Resize the table columns ui->tableWidgetRXAll->resizeColumnToContents(0); @@ -9604,9 +9616,9 @@ void MainWindow::displayCallActivity() { ui->tableWidgetCalls->setColumnHidden(2, !showColumn("call", "timestamp")); ui->tableWidgetCalls->setColumnHidden(3, !showColumn("call", "snr")); ui->tableWidgetCalls->setColumnHidden(4, !showColumn("call", "offset")); - ui->tableWidgetCalls->setColumnHidden(5, !showColumn("call", "tdrift")); - ui->tableWidgetCalls->setColumnHidden(6, !showColumn("call", "grid")); - ui->tableWidgetCalls->setColumnHidden(7, !showColumn("call", "distance")); + ui->tableWidgetCalls->setColumnHidden(5, !showColumn("call", "tdrift", false)); + ui->tableWidgetCalls->setColumnHidden(6, !showColumn("call", "grid", false)); + ui->tableWidgetCalls->setColumnHidden(7, !showColumn("call", "distance", false)); // Resize the table columns ui->tableWidgetCalls->resizeColumnToContents(0); diff --git a/mainwindow.h b/mainwindow.h index 40e2dcd..be9e53e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -271,7 +271,7 @@ private slots: void on_qthMacroButton_clicked(); void on_qtcMacroButton_clicked(); void setShowColumn(QString tableKey, QString columnKey, bool value); - bool showColumn(QString tableKey, QString columnKey); + bool showColumn(QString tableKey, QString columnKey, bool default_=true); void buildShowColumnsMenu(QMenu *menu, QString tableKey); void setSortBy(QString key, QString value); QString getSortBy(QString key, QString defaultValue);