This commit is contained in:
Dirk Hohndel 2013-05-21 19:34:03 -07:00
commit 238c80a708
3 changed files with 13 additions and 4 deletions

View file

@ -48,15 +48,20 @@ void DiveListView::reload()
QSettings s;
s.beginGroup("DiveListColumnState");
for(int i = 0; i < model()->columnCount(); i++){
QString title = QString("show %1").arg( model()->headerData( i, Qt::Horizontal).toString());
QString title = QString("show %1").arg(model()->headerData( i, Qt::Horizontal).toString());
QAction *a = new QAction(title, header());
a->setCheckable(true);
a->setChecked( s.value(title, true).toBool());
a->setProperty("index", i);
connect(a, SIGNAL(triggered(bool)), this, SLOT(hideColumnByIndex()));
header()->addAction(a);
if (a->isChecked())
showColumn(true);
else
hideColumn(false);
}
s.endGroup();
s.sync();
}
}
@ -70,6 +75,7 @@ void DiveListView::hideColumnByIndex()
s.beginGroup("DiveListColumnState");
s.setValue(action->text(), action->isChecked());
s.endGroup();
s.sync();
if (action->isChecked())
showColumn(action->property("index").toInt());

View file

@ -323,7 +323,7 @@ void MainWindow::readSettings()
{
int i;
QVariant v;
QSettings settings("hohndel.org","subsurface");
QSettings settings;
settings.beginGroup("MainWindow");
QSize sz = settings.value("size").value<QSize>();
@ -417,7 +417,7 @@ void MainWindow::readSettings()
void MainWindow::writeSettings()
{
int i;
QSettings settings("hohndel.org","subsurface");
QSettings settings;
settings.beginGroup("MainWindow");
settings.setValue("size",size());