diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 4c4dd92..32d83ff 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -703,7 +703,14 @@ void Object::setProperty(const QString &name, QVariant value) int index = metaObject()->indexOfProperty(qPrintable(name)); if (index != -1) type = metaObject()->property(index).typeName(); - if ((type.startsWith("QList<") && type.endsWith(">")) || (type == "QStringList")) { + if (metaObject()->property(index).isEnumType()) { + // This is necessary because setProperty can only set enums + // using its integer value if the QVariant is of type int (or uint) + bool ok; + int v = value.toInt(&ok); + if (ok) + value = v; + } else if ((type.startsWith("QList<") && type.endsWith(">")) || (type == "QStringList")) { QVariantList elements; if (value.canConvert()) { elements = value.value(); @@ -761,13 +768,6 @@ void Object::setProperty(const QString &name, QVariant value) if (value.isNull()) value = true; else if (value == "false") value = false; else if (value == "true") value = true; - } else if (type.startsWith("br::") /* Pray to science it's safe to assume these are enums */) { - bool ok; - int enumIndex = value.toInt(&ok); - if (ok) { - QMetaEnum metaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator(type.toStdString().c_str())); - value = metaEnum.value(enumIndex); - } } if (!QObject::setProperty(qPrintable(name), value) && !type.isEmpty()) diff --git a/openbr/plugins/stream.cpp b/openbr/plugins/stream.cpp index 618ba18..440ab1c 100644 --- a/openbr/plugins/stream.cpp +++ b/openbr/plugins/stream.cpp @@ -1058,7 +1058,7 @@ public: if (src.empty()) return; - bool res = readStage->dataSource.open(src,br::Idiocy::DistributeFrames); + bool res = readStage->dataSource.open(src,readMode); if (!res) { qDebug("stream failed to open %s", qPrintable(dst[0].file.name)); return;