diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-14 23:27:22 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-14 23:27:22 +0100 | 
| commit | 800f5872ba8d67284016e3b7b61b1c955fa9b1eb (patch) | |
| tree | d1e1af2f6dc7037e81739cf36dc272806c2e1c78 | |
| parent | 084f99b16fecc2c660ac3a00ebd13b87ef83c44d (diff) | |
allow tying option to tab widget's index
| -rw-r--r-- | opentrack/options.hpp | 9 | 
1 files changed, 9 insertions, 0 deletions
diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 1938ba08..7eeda198 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -26,6 +26,7 @@  #include <QSlider>  #include <QLineEdit>  #include <QLabel> +#include <QTabWidget>  #include <QCoreApplication>  #include <cinttypes> @@ -412,4 +413,12 @@ namespace options {          lb->setText(v);          base_value::connect(&v, SIGNAL(valueChanged(QString)), lb, SLOT(setText(QString)), v.SAFE_CONNTYPE);      } +     +    template<> +    inline void tie_setting(value<int>& v, QTabWidget* t) +    { +        t->setCurrentIndex(v); +        base_value::connect(t, SIGNAL(currentChanged(int)), &v, SLOT(setValue(int)), v.DIRECT_CONNTYPE); +        base_value::connect(&v, SIGNAL(valueChanged(int)), t, SLOT(setCurrentIndex(int)), v.SAFE_CONNTYPE); +    }  }  | 
