From 4b0c053e48abc7a4e0a624d2b868e6f29e376610 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Sun, 9 Jun 2013 20:09:39 -0300 Subject: Ticket 127 - Repopulate context menu on preferences change Ticket 127 mention that context menu is fixed on imperial mode, which is partial true. Context menu only not have the changes on header model updated when preferences are chenges during execution. Hard to note because if program is closed and opened again, the context is initialized properly. Since actions aren't bound to the header model, we need iteract of current items and change the title. Signed-off-by: Helio Chissini de Castro --- qt-ui/divelistview.cpp | 6 ++++++ qt-ui/mainwindow.cpp | 1 + 2 files changed, 7 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 297fbf321..fd189e926 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -186,6 +186,12 @@ void DiveListView::reloadHeaderActions() setColumnHidden(i, !shown); } s.endGroup(); + } else { + // Skip first QAction item ( static text Visible ) + for(int i = 0; i < model()->columnCount(); i++) { + QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString()); + header()->actions()[i+1]->setText( title ); + } } } diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 286aba43e..9496f6160 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -44,6 +44,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), helpView(0) connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ListWidget, SLOT(update())); + connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ListWidget, SLOT(reloadHeaderActions())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui->ProfileWidget, SLOT(refresh())); ui->mainErrorMessage->hide(); ui->ProfileWidget->setFocusProxy(ui->ListWidget); -- cgit v1.2.3-70-g09d2