Skip to content

Commit

Permalink
Save and restore last opened tab index
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedran Mikov committed Nov 15, 2020
1 parent e58b8de commit 15e6a13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ endChar=
[appLog]
index=2
maxIndex=3

[ui]
startPage=0
5 changes: 5 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ MainWindow::~MainWindow()
settings->setValue("fileLogging/fileName", ui->logfileName->text());
settings->setValue("fileLogging/channelSeparator", ui->logfileChSep->text());

// Save currently open page
settings->setValue("ui/startPage", ui->tabWidget->currentIndex());

settings->sync();

Expand Down Expand Up @@ -237,6 +239,9 @@ void MainWindow::LoadSettings()
settings->value("fileLogging/fileName","").toString());
ui->logfileChSep->setText(
settings->value("fileLogging/channelSeparator",",").toString());

// Restore last opened tab
ui->tabWidget->setCurrentIndex(settings->value("ui/startPage","0").toUInt());
}

/**
Expand Down

0 comments on commit 15e6a13

Please sign in to comment.