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 <helio@kde.org>
This commit is contained in:
Helio Chissini de Castro 2013-06-09 20:09:39 -03:00
parent bdee5ea9a6
commit 4b0c053e48
2 changed files with 7 additions and 0 deletions

View file

@ -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 );
}
}
}

View file

@ -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);