class application{ // ...public: QVariant setting (const QString& key) const { return _settings.get (key); } void setting (const QString& key, const QVariant& value) { emit setting_about_to_change (key, setting (key)); _settings.set (key, value); emit setting_changed (key, value); }signals: void setting_about_to_change (const QString& key, const QVariant& value); void setting_changed (const QString& key, const QVariant& value);};// examples on how to use:class foo_bar : public QObject{ Q_OBJECTpublic: foo_bar (QObject* parent) : QObject (parent) { connect ( app() , SIGNAL (setting_changed (const QString& key, const QVariant& value)) , SLOT (setting_changed (const QString& key, const QVariant& value)) ); }public slots: void setting_changed (const QString& key, const QVariant& value) { if (key == "paths/game") { LogDebug << "game path changed to: " << value.toString().toStdString() << std::endl; } }};class settings_dialog : public QWidget{ // ... settings_dialog( ...) { connect (antialiasing_box, SIGNAL (valueChanged (int)), SLOT (set_antialiasing (int))); connect (app(), SIGNAL (setting_changed (const QString&, const QVariant&)), SLOT (setting_changed (const QString&, const QVariant&))); } void set_antialiasing (int value) { app().setting ("antialiasing", value); } void setting_changed (const QString& key, const QVariant& value) { if (key == "antialiasing") { antialiasing_box.setValue (value.toInt()); } }};
We have 4 3 years now a chan but no one ever went in
You just can use the model class. So you dont must start from 0
Cool. Its going on If someone could spend some time in selection problems. You cant select a model in QT last time i have looked.