summaryrefslogtreecommitdiff
path: root/plugingui/humanizerframecontent.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/humanizerframecontent.h')
-rw-r--r--plugingui/humanizerframecontent.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h
index 530742b..0196ea5 100644
--- a/plugingui/humanizerframecontent.h
+++ b/plugingui/humanizerframecontent.h
@@ -30,6 +30,9 @@
#include "label.h"
#include "widget.h"
+#include <iomanip>
+#include <sstream>
+
namespace GUI
{
@@ -41,6 +44,7 @@ public:
{
layout.setResizeChildren(false);
layout.setHAlignment(HAlignment::center);
+ layout.setSpacing(2);
caption.setText(name);
caption.resize(100, 20);
@@ -48,14 +52,28 @@ public:
layout.addItem(&caption);
}
- void setControl(Widget* control)
+ void setControl(Knob* control)
{
layout.addItem(control);
+
+ CONNECT(control, valueChangedNotifier, this, &LabeledControl::setValue);
+ setValue(control->value());
+ value.resize(100, 20);
+ value.setAlignment(TextAlignment::center);
+ layout.addItem(&value);
}
private:
VBoxLayout layout{this};
Label caption{this};
+ Label value{this};
+
+ void setValue(float new_value)
+ {
+ std::stringstream stream;
+ stream << std::fixed << std::setprecision(2) << new_value;
+ value.setText(stream.str());
+ }
};
class HumanizerframeContent : public Widget