View Single Post
Posts: 353 | Thanked: 263 times | Joined on Dec 2009 @ Finland
#80
You can use QSettings class for that. Just add following functions to your MainWindow class:
Code:
void MainWindow::saveSettings() const {
    QSettings sett("blackplastic-theme/config");
    sett.setValue("font", text_of_combobox /* you now how to get that already */);
    // Other values like that also
}
void MainWindow::loadSettings() {
    QSettings sett("blackplastic-theme/config");
    bool bOK;
    QString font = sett.value("font", QVariant("")).toString();
    // Other values likewise and set comboboxes to show values
}
Then call loadSettings at the end of MainWindow's constructor and saveSettings in MainWindows's destructor (~MainWindow).

EDIT: QSettings saves config files under ~/.config so in this case config file would be ~/.config/blackplastic-theme/config
__________________
My Maemo5 projects:
mSpede - Speed testing game | Them Bloody Ducks - 2D duck hunting game | Maetronome - A simple metronome app | CuteMPC - MPD client
 

The Following User Says Thank You to TNiga For This Useful Post: