Getting the variant list out to js right

This commit is contained in:
Sam Gateau 2018-04-26 23:53:11 -07:00
parent 3d412747d7
commit b4682b31df

View file

@ -13,6 +13,16 @@
#include "Engine.h" #include "Engine.h"
template <typename T>
QVariantList toVariantList(const QList<T> &list)
{
QVariantList newList;
foreach(const T &item, list)
newList << item;
return newList;
}
namespace workload { namespace workload {
class SetupViewsConfig : public Job::Config{ class SetupViewsConfig : public Job::Config{
Q_OBJECT Q_OBJECT
@ -174,14 +184,14 @@ namespace workload {
static const int SIZE{ workload::Region::NUM_VIEW_REGIONS }; static const int SIZE{ workload::Region::NUM_VIEW_REGIONS };
float timings[SIZE]; float timings[SIZE];
glm::vec2 ranges[SIZE]; glm::vec2 ranges[SIZE];
QVector<qreal> _timings { 6, 2.0 }; QList<qreal> _timings { 6, 2.0 };
} dataExport; } dataExport;
void emitDirty() { emit dirty(); } void emitDirty() { emit dirty(); }
public slots: public slots:
Q_INVOKABLE QVector<qreal> getTimings() const { return dataExport._timings; } Q_INVOKABLE QVariantList getTimings() const { return toVariantList(dataExport._timings); }
signals: signals:
void dirty(); void dirty();
}; };