summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/options.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-12-30 11:29:28 +0100
committerStanislaw Halik <sthalik@misaki.pl>2013-12-30 11:29:28 +0100
commitd93d2a4f373f79e86e855c43815edf26cc455e3d (patch)
tree239da301d4150b8782af8d9416637a53749a091c /facetracknoir/options.hpp
parent272e784d6c79e5f43e2514c349f46734fbbd0078 (diff)
support QLineEdit
Diffstat (limited to 'facetracknoir/options.hpp')
-rw-r--r--facetracknoir/options.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/facetracknoir/options.hpp b/facetracknoir/options.hpp
index 67c0958d..c9a982bc 100644
--- a/facetracknoir/options.hpp
+++ b/facetracknoir/options.hpp
@@ -20,10 +20,11 @@
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <QSlider>
+#include <QLineEdit>
namespace options {
template<typename T>
- inline T qcruft_to_t(const QVariant& t);
+ inline T qcruft_to_t (const QVariant& t);
template<>
inline int qcruft_to_t<int>(const QVariant& t)
@@ -32,6 +33,12 @@ namespace options {
}
template<>
+ inline QString qcruft_to_t<QString>(const QVariant& t)
+ {
+ return t.toString();
+ }
+
+ template<>
inline bool qcruft_to_t<bool>(const QVariant& t)
{
return t.toBool();
@@ -244,6 +251,14 @@ namespace options {
sl->setValue(v);
}
+ template<>
+ inline void tie_setting(value<QString>& v, QLineEdit* le)
+ {
+ base_value::connect(le, SIGNAL(textChanged(QString)), &v, SLOT(setValue(QString)));
+ base_value::connect(&v, SIGNAL(valueChanged(QString)),le, SLOT(setText(QString)));
+ le->setText(v);
+ }
+
inline pbundle bundle(const QString& group) {
return std::make_shared<impl_bundle>(group);
}