From 800f5872ba8d67284016e3b7b61b1c955fa9b1eb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 14 Dec 2014 23:27:22 +0100 Subject: allow tying option to tab widget's index --- opentrack/options.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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 #include #include +#include #include #include @@ -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& 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); + } } -- cgit v1.2.3