diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-21 23:07:19 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-21 23:07:19 -0300 |
commit | 3fdea49e706a147e4f714e5642993169f7a7e8dc (patch) | |
tree | 39580009e462d4aeeb8f06a62d5e2b6a1ae45591 /qt-ui/divelistview.cpp | |
parent | 37ada91000dc14e0d154e1a3f4fd7f1f842ce956 (diff) | |
download | subsurface-3fdea49e706a147e4f714e5642993169f7a7e8dc.tar.gz |
Fixed the hide / show columns using the settings.
This also changed a bit the behavior on how the QSettings are managed,
till now, we used the QSettings constructor passing the name of the
software and the 'company', but this is now default - so there's no
need to pass anything by the QSettings contructor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 248a29634..9ee99394b 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -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()); |