summaryrefslogtreecommitdiff
path: root/plugingui/humanizerframecontent.h
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-04-17 11:23:09 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-04-17 11:25:53 +0200
commitf505c622eda8cdd02da00742e794c9b940902a8d (patch)
tree2d194ad7c8f97ed0828178e86310ce6880a48b6d /plugingui/humanizerframecontent.h
parenta36b20f60a33b04ec69b65cfce0dd0059ff9e382 (diff)
Write knob value outside of the knob in the humanizer frame.
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