diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-30 12:56:11 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-30 12:56:11 +0100 |
commit | 76c48c14b4f5f5b22532016b5963e600fbebb610 (patch) | |
tree | c5716a596294c8f0ef1adf44f28be435d54bddfb /facetracknoir | |
parent | d93d2a4f373f79e86e855c43815edf26cc455e3d (diff) |
add option of tying combobox to its text value
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/options.hpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/facetracknoir/options.hpp b/facetracknoir/options.hpp index c9a982bc..900f06c0 100644 --- a/facetracknoir/options.hpp +++ b/facetracknoir/options.hpp @@ -183,7 +183,7 @@ namespace options { QString self_name; pbundle b; public: - value(const pbundle& b, const QString& name, T def) : + value(pbundle& b, const QString& name, T def) : self_name(name), b(b) { @@ -220,6 +220,14 @@ namespace options { } template<> + inline void tie_setting(value<QString>& v, QComboBox* cb) + { + base_value::connect(cb, SIGNAL(currentTextChanged(QString)), &v, SLOT(setValue(int))); + base_value::connect(&v, SIGNAL(valueChanged(QString)), cb, SLOT(setCurrentText(QString))); + cb->setCurrentText(v); + } + + template<> inline void tie_setting(value<bool>& v, QCheckBox* cb) { base_value::connect(cb, SIGNAL(toggled(bool)), &v, SLOT(setValue(bool))); |