reimplemented double and bool widgets separately

This commit is contained in:
itsmattkc
2019-03-13 00:12:15 +11:00
parent 5b03af5e5a
commit e3e45279b9
36 changed files with 327 additions and 312 deletions
+18
View File
@@ -1,5 +1,7 @@
#include "boolfield.h"
#include <QCheckBox>
BoolField::BoolField(EffectRow *parent, const QString &id) :
EffectField(parent, id, EFFECT_FIELD_BOOL)
{}
@@ -9,6 +11,17 @@ bool BoolField::GetBoolAt(double timecode)
return GetValueAt(timecode).toBool();
}
QWidget *BoolField::CreateWidget()
{
QCheckBox* cb = new QCheckBox();
connect(cb, SIGNAL(toggled(bool)), this, SLOT(UpdateFromWidget(bool)));
connect(this, SIGNAL(EnabledChanged(bool)), cb, SLOT(setEnabled(bool)));
connect(cb, SIGNAL(toggled(bool)), this, SIGNAL(Toggled(bool)));
return cb;
}
QVariant BoolField::ConvertStringToValue(const QString &s)
{
return (s == "1");
@@ -18,3 +31,8 @@ QString BoolField::ConvertValueToString(const QVariant &v)
{
return QString::number(v.toBool());
}
void BoolField::UpdateFromWidget(bool b)
{
SetValueAt(Now(), b);
}