settings->addWidget(widget, "group/key");
void slot(int);void slot(bool);void slot(QString);
void addWidget(const QString &key, QWidget *widget, const QByteArray &propertyName){ widget->setProperty("settingsProperty", propertyName); m_mapToKey.insert(widget, key); const char *notifierSignal; // ... connect(widget, notifierSignal, SLOT(onPropertyChanged()));}void onPropertyChanged(){ QObject *widget = sender(); QByteArray propertyName = widget->property("settingsProperty"); QString key = m_mapToKey.value(widget); settings->setValue(key, widget->property(propertyName.constData()));}