]> Some of my projects - localmylist.git/commitdiff
Save currently selected tab.
authorAPTX <marek321@gmail.com>
Tue, 30 Apr 2013 22:21:57 +0000 (00:21 +0200)
committerAPTX <marek321@gmail.com>
Tue, 30 Apr 2013 22:21:57 +0000 (00:21 +0200)
localmylist-management/tabwidget.cpp

index 00d440f795eae7c6307791192581d827a360ff34..5d015f94f041165a313e381fac5157fcd32c8d70 100644 (file)
@@ -54,12 +54,16 @@ MainWindow *TabWidget::mainWindow() const
 void TabWidget::loadSettings(QSettings *s)
 {
        QStringList ids;
+       int currentIndex;
        s->beginGroup("management-gui");
        ids = s->value("tabs", "mylist").toString().split(QChar(','));
+       currentIndex = s->value("currentTab", 0).toInt();
        s->endGroup();
 
        for (const QString &id : ids)
                addTab(id);
+
+       setCurrentIndex(currentIndex);
 }
 
 void TabWidget::saveSettings(QSettings *s)
@@ -70,6 +74,7 @@ void TabWidget::saveSettings(QSettings *s)
 
        s->beginGroup("management-gui");
        s->setValue("tabs", ids.join(QChar(',')));
+       s->setValue("currentTab", currentIndex());
        s->endGroup();
 }