Commit 5cc5b733 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Replace BasicObjectModel with ObjectRefListModel (strongly-typed in C++)

Remove useless NodeList, SensorsList, ActuatorsList objects

Remove uneeded list properties in NetworkDefinition

Simplify hugely the API

Fix example network to match API evolution
parent 01cecc3c
......@@ -142,22 +142,3 @@ void HybridActuator::onComponentCompleted (void) {
void HybridActuator::refreshValSpeed (void) {
update_valSpeed (m_value ? m_ratedSpeed : 0);
}
ActuatorsList::ActuatorsList (QObject * parent)
: QObject (parent)
, m_subObjects (this)
{
m_actuators = new BasicObjectsModel (this);
Manager::instance ().registerObject (this);
}
ActuatorsList::~ActuatorsList (void) {
Manager::instance ().unregisterObject (this);
}
void ActuatorsList::classBegin (void) { }
void ActuatorsList::componentComplete (void) {
m_actuators->appendIf<AbstractActuator> (m_subObjects.items ());
Manager::instance ().intializeObject (this);
}
......@@ -100,19 +100,4 @@ public:
void refreshValSpeed (void);
};
class ActuatorsList : public QObject, public QQmlParserStatus {
Q_OBJECT
Q_INTERFACES (QQmlParserStatus)
QML_DEFAULT_PROPERTY (subObjects)
QML_LIST_PROPERTY (QObject, subObjects)
QML_CONSTANT_PTR_PROPERTY (BasicObjectsModel, actuators)
public:
explicit ActuatorsList (QObject * parent = Q_NULLPTR);
virtual ~ActuatorsList (void);
void classBegin (void) Q_DECL_FINAL;
void componentComplete (void) Q_DECL_FINAL;
};
#endif // ABSTRACTACTUATOR_H
......@@ -1254,7 +1254,7 @@ static ObjectHelp node {
};
static ObjectHelp networkDefinition {
"NetworkDefinition", "object", { }, { }, "instantiable",
"NetworkDefinition", "object", { }, { "BasicObject", "object" }, "instantiable",
{
new PropertyHelp {
"uid", "string", "writable", false,
......@@ -1280,34 +1280,10 @@ static ObjectHelp networkDefinition {
"benchmarkCanFramesTiming", "bool", "writable", false,
"Enabled this to have debug message with elapsed time after each all routines for a CAN frame ID have been executed (to know the time spent parsing frame and optionally answering it)."
},
new PropertyHelp {
"nodesList", "NodesList", "writable", false,
"The list of nodes for this network (wrapped inside a node-list object for convenience)."
},
new PropertyHelp {
"sensorsList", "SensorsList", "writable", false,
"The list of sensors for this network (wrapped inside a sensor-list object for convenience)."
},
new PropertyHelp {
"actuatorsList", "ActuatorsList", "writable", false,
"The list of actuators for this network (wrapped inside a actuator-list object for convenience)."
},
new PropertyHelp {
"world", "PhysicalWorld", "writable", false,
"The physical world and its blocks and values this network."
},
new PropertyHelp {
"canBusList", "CanBus", "writable", true,
"The list of CAN bus objects for this network."
},
new PropertyHelp {
"serialBusList", "SerialBus", "writable", true,
"The list of serial bus objects for this network."
},
new PropertyHelp {
"dashboardsList", "Dashboard", "writable", true,
"The list of visual dashboard objects for this network."
},
},
{ },
{ },
......@@ -2142,11 +2118,11 @@ static ObjectHelp byteArrayWrapper {
// TODO : Dictionary (convenience)
static ObjectHelp basicObjectModel {
"BasicObjectModel", "model", { }, { }, "helper",
static ObjectHelp objectRefListModel {
"ObjectRefListModel", "model", { }, { }, "helper",
{
new PropertyHelp {
"count", "uint32", "writable", false,
"count", "uint32", "readonly", false,
"The number of objects in the list."
},
},
......@@ -2177,7 +2153,7 @@ static ObjectHelp basicObjectModel {
"Remove given object from model."
},
new MethodHelp {
"at", "BasicObject",
"get", "BasicObject",
{
new ArgumentHelp {
"idx", "uint32", "", false,
......@@ -2213,48 +2189,6 @@ static ObjectHelp basicObjectModel {
"This class is a basic list model of Qt objects, allowing to manager dynamic list of objects from C++ and expose them to QML."
};
static ObjectHelp nodesList {
"NodesList", "object", { }, { "Node" }, "instantiable",
{
new PropertyHelp {
"nodes", "Node", "writable", true,
"The list of node objects. This is the default property."
},
},
{ },
{ },
{ },
"This is a convenience object to group all node objects in network definition."
};
static ObjectHelp sensorsList {
"SensorsList", "object", { }, { "AbstractSensor" }, "instantiable",
{
new PropertyHelp {
"sensors", "AbstractSensor", "writable", true,
"The list of sensor objects. This is the default property."
},
},
{ },
{ },
{ },
"This is a convenience object to group all sensor objects in network definition."
};
static ObjectHelp actuatorsList {
"ActuatorsList", "object", { }, { "AbstractActuator" }, "instantiable",
{
new PropertyHelp {
"actuators", "AbstractActuator", "writable", true,
"The list of actuator objects. This is the default property."
},
},
{ },
{ },
{ },
"This is a convenience object to group all actuator objects in network definition."
};
static ObjectHelp dashboard {
"Dashboard", "item", { }, { "CircleButton", "LedLight", "CircularGauge", "TicksJauge", "LinearGauge", "Oscilloscope", "OnOffSwitcher", "NumberValueDisplay", "NumberValueInput", "RotativeKnob", "MultiChoiceList" }, "instantiable",
{
......@@ -2942,7 +2876,7 @@ ObjectHelp * Help::getHelpForTypeByName (const QString & name) {
void Help::initMap (void) {
registerHelp (basicObject);
registerHelp (basicObjectModel);
registerHelp (objectRefListModel);
registerHelp (abstractSensor);
registerHelp (analogSensor);
registerHelp (digitalSensor);
......@@ -2992,9 +2926,6 @@ void Help::initMap (void) {
registerHelp (node);
registerHelp (board);
registerHelp (networkDefinition);
registerHelp (nodesList);
registerHelp (sensorsList);
registerHelp (actuatorsList);
registerHelp (canBus);
registerHelp (serialBus);
registerHelp (abstractTransformer);
......@@ -3037,12 +2968,9 @@ void Help::initIndex (void) {
new HelpSection {
QObject::tr ("Base"),
{
new HelpPage { 1, "NetworkDefinition" },
new HelpPage { 1, "BasicObject" },
new HelpPage { 1, "BasicObjectModel" },
new HelpPage { 1, "NodesList" },
new HelpPage { 1, "SensorsList" },
new HelpPage { 1, "ActuatorsList" },
new HelpPage { 1, "NetworkDefinition" },
new HelpPage { 1, "BasicObject" },
new HelpPage { 1, "ObjectRefListModel" },
}
},
new HelpSection {
......
......@@ -50,82 +50,76 @@ void BasicObject::updateState (const QJsonObject & values) {
}
}
BasicObjectsModel::BasicObjectsModel (QObject * parent)
: QAbstractListModel (parent)
{
m_roles.insert (Object, "object");
}
AbstractObjectListModel::AbstractObjectListModel (QObject * parent) : QAbstractListModel (parent) { }
int BasicObjectsModel::rowCount (const QModelIndex & parent) const {
Q_UNUSED (parent)
return m_items.count ();
}
AbstractObjectListModel::~AbstractObjectListModel (void) { }
QVariant BasicObjectsModel::data (const QModelIndex & index, int role) const {
QVariant ret;
const int idx = index.row ();
if (idx >= 0 && idx < m_items.count ()) {
if (role == Object) {
ret = QVariant::fromValue (m_items.at (idx));
}
}
return ret;
int AbstractObjectListModel::getCount (void) const {
return implCount ();
}
QHash<int, QByteArray> BasicObjectsModel::roleNames (void) const {
return m_roles;
void AbstractObjectListModel::insert (QObject * object, const int idx) {
doInsertAt (object, idx);
}
const QVector<BasicObject *> &BasicObjectsModel::items (void) const {
return m_items;
void AbstractObjectListModel::append (QObject * object) {
doInsertAt (object, implCount ());
}
int BasicObjectsModel::getCount (void) const {
return m_items.count ();
void AbstractObjectListModel::prepend (QObject * object) {
doInsertAt (object, 0);
}
void BasicObjectsModel::refreshPaths (void) {
for (BasicObject * obj : m_items) {
obj->refreshPath ();
void AbstractObjectListModel::remove (QObject * object) {
const int idx = implIndexOf (object);
if (implValid (idx)) {
beginRemoveRows (QModelIndex (), idx, idx);
doUnregisterItem (object);
implRemove (object);
endRemoveRows ();
emit countChanged ();
emit itemRemoved (object);
}
}
void BasicObjectsModel::clear (void) {
void AbstractObjectListModel::clear (void) {
beginResetModel ();
m_items.clear ();
const int loops = implCount ();
for (int idx = 0; idx < loops; ++idx) {
doUnregisterItem (implGet (idx));
}
implClear ();
endResetModel ();
emit countChanged ();
}
void BasicObjectsModel::append (BasicObject * object) {
if (object != Q_NULLPTR) {
const int idx = m_items.count ();
QObject * AbstractObjectListModel::get (const int idx) const {
return implGet (idx);
}
void AbstractObjectListModel::doInsertAt (QObject * object, const int idx) {
if (implAccept (object) && !implContains (object) && (implValid (idx) || idx == implCount ())) {
beginInsertRows (QModelIndex (), idx, idx);
m_items.append (object);
object->setParent (parent ());
//object->update_number (idx +1);
emit itemAdded (object);
doRegisterItem (object);
implInsert (object, idx);
endInsertRows ();
emit countChanged ();
emit itemAdded (object);
}
}
void BasicObjectsModel::remove (BasicObject * object) {
if (object != Q_NULLPTR) {
const int idx = m_items.indexOf (object);
if (idx >= 0 && idx < m_items.count ()) {
beginRemoveRows (QModelIndex (), idx, idx);
m_items.removeAt (idx);
emit itemRemoved (object);
endRemoveRows ();
emit countChanged ();
}
void AbstractObjectListModel::doRegisterItem (QObject * object) {
if (object) {
connect (object, &QObject::destroyed, this, &AbstractObjectListModel::onItemDestroyed);
}
}
BasicObject * BasicObjectsModel::at (const int idx) const {
BasicObject* ret = Q_NULLPTR;
if (idx >= 0 && idx < m_items.count ()) {
ret = m_items.at (idx);
void AbstractObjectListModel::doUnregisterItem (QObject * object) {
if (object) {
disconnect (object, &QObject::destroyed, this, &AbstractObjectListModel::onItemDestroyed);
}
return ret;
}
void AbstractObjectListModel::onItemDestroyed (QObject * object) {
remove (object);
}
......@@ -173,54 +173,131 @@ public:
}
};
class BasicObjectsModel : public QAbstractListModel {
class AbstractObjectListModel : public QAbstractListModel {
Q_OBJECT
Q_PROPERTY (int count READ getCount NOTIFY countChanged)
public:
explicit BasicObjectsModel (QObject * parent);
explicit AbstractObjectListModel (QObject * parent = Q_NULLPTR);
virtual ~AbstractObjectListModel (void);
enum Roles {
Object,
};
int rowCount (const QModelIndex & parent) const Q_DECL_FINAL;
QVariant data (const QModelIndex & index, int role) const Q_DECL_FINAL;
QHash<int, QByteArray> roleNames (void) const Q_DECL_FINAL;
int getCount (void) const;
const QVector<BasicObject *> & items (void) const;
Q_INVOKABLE void insert (QObject * object, const int idx);
Q_INVOKABLE void append (QObject * object);
Q_INVOKABLE void prepend (QObject * object);
Q_INVOKABLE void remove (QObject * object);
Q_INVOKABLE void clear (void);
Q_INVOKABLE QObject * get (const int idx) const;
int getCount (void) const;
protected:
virtual void implInsert (QObject * object, const int idx) = 0;
virtual void implRemove (QObject * object) = 0;
virtual void implClear (void) = 0;
virtual int implCount (void) const = 0;
virtual int implIndexOf (QObject * object) const = 0;
virtual bool implContains (QObject * object) const = 0;
virtual bool implAccept (QObject * object) const = 0;
virtual bool implValid (const int idx) const = 0;
virtual QObject * implGet (const int idx) const = 0;
inline void doInsertAt (QObject * object, const int idx);
protected slots:
void doRegisterItem (QObject * object);
void doUnregisterItem (QObject * object);
void onItemDestroyed (QObject * object);
void refreshPaths (void);
signals:
void countChanged (void);
void itemAdded (QObject * item);
void itemRemoved (QObject * item);
};
template<class T> void appendIf (const QVector<QObject *> & objects) {
for (QObject * obj : objects) {
if (T * item = qobject_cast<T *> (obj)) {
append (item);
}
else { }
}
template<class T> class ObjectListModel : public AbstractObjectListModel { // NOTE : DOESN'T OWN ANYTHING
public:
explicit ObjectListModel (const int reserved = 0, const QStringList & roles = QStringList (), QObject * parent = Q_NULLPTR)
: AbstractObjectListModel (parent)
{
m_items.reserve (reserved);
int role = Qt::DisplayRole;
m_roles.insert (role, "object");
// TODO : handle extra roles
Q_UNUSED (roles)
}
virtual ~ObjectListModel (void) { }
typedef QVector<BasicObject *>::const_iterator iterator;
iterator begin (void) const { return m_items.constBegin (); }
iterator end (void) const { return m_items.constEnd (); }
Q_INVOKABLE void clear (void);
Q_INVOKABLE void append (BasicObject * object);
Q_INVOKABLE void remove (BasicObject * object);
T * at (const int idx) const {
return (implValid (idx) ? m_items.at (idx) : Q_NULLPTR);
}
Q_INVOKABLE BasicObject * at (const int idx) const;
using iterator = typename QVector<T *>::const_iterator;
inline iterator begin (void) const { return m_items.constBegin (); }
inline iterator end (void) const { return m_items.constEnd (); }
signals:
void countChanged (void);
void itemAdded (BasicObject * item);
void itemRemoved (BasicObject * item);
protected:
int rowCount (const QModelIndex & parent) const Q_DECL_FINAL {
return (!parent.isValid () ? implCount () : 0);
}
QVariant data (const QModelIndex & idx, int role) const Q_DECL_FINAL {
QVariant ret;
if (!idx.parent ().isValid ()) {
if (T * item = at (idx.row ())) {
if (role == Qt::DisplayRole) {
ret = QVariant::fromValue (item);
}
else {
// TODO : handle extra roles
}
}
}
return ret;
}
QHash<int, QByteArray> roleNames (void) const Q_DECL_FINAL {
return m_roles;
}
void implInsert (QObject * object, const int idx) Q_DECL_FINAL {
m_items.insert (idx, qobject_cast<T *> (object));
}
void implRemove (QObject * object) Q_DECL_FINAL {
m_items.remove (implIndexOf (qobject_cast<T *> (object)));
}
void implClear (void) Q_DECL_FINAL {
m_items.clear ();
}
int implCount (void) const Q_DECL_FINAL {
return m_items.count ();
}
int implIndexOf (QObject * object) const Q_DECL_FINAL {
return m_items.indexOf (qobject_cast<T *> (object));
}
bool implContains (QObject * object) const Q_DECL_FINAL {
return m_items.contains (qobject_cast<T *> (object));
}
bool implAccept (QObject * object) const Q_DECL_FINAL {
return (qobject_cast<T *> (object) != Q_NULLPTR);
}
bool implValid (const int idx) const Q_DECL_FINAL {
return (idx >= 0 && idx < m_items.count ());
}
QObject * implGet (const int idx) const Q_DECL_FINAL {
return at (idx);
}
private:
QVector<T *> m_items;
QHash<int, QByteArray> m_roles;
QVector<BasicObject *> m_items;
};
#define QML_REFLIST_PROPERTY(TYPE,NAME,SIZE) \
private: \
Q_PROPERTY (AbstractObjectListModel * NAME READ getAsPtr_##NAME CONSTANT) \
protected: \
ObjectListModel<TYPE> m_##NAME {SIZE}; \
public: \
ObjectListModel<TYPE> & getAsRef_##NAME (void) { return m_##NAME; } \
const ObjectListModel<TYPE> & getAsConstRef_##NAME (void) const { return m_##NAME; } \
AbstractObjectListModel * getAsPtr_##NAME (void) { return &m_##NAME; } \
private:
#endif // BasicObject_H
......@@ -24,7 +24,16 @@ AbstractLink::AbstractLink (QObject * parent)
connect (this, &AbstractLink::targetChanged, this, &AbstractLink::onTargetChanged);
}
AbstractLink::~AbstractLink (void) { }
AbstractLink::~AbstractLink (void) {
disconnect (this, &AbstractLink::sourceChanged, this, &AbstractLink::onSourceChanged);
disconnect (this, &AbstractLink::targetChanged, this, &AbstractLink::onTargetChanged);
if (m_source) {
disconnect (m_source, &BasicObject::destroyed, this, &AbstractLink::onSourceDestroyed);
}
if (m_target) {
disconnect (m_target, &BasicObject::destroyed, this, &AbstractLink::onTargetDestroyed);
}
}
void AbstractLink::onComponentCompleted (void) {
BasicObject::onComponentCompleted ();
......
This diff is collapsed.
This diff is collapsed.
#include "NetworkDefinition.h"
#include "Node.h"
#include "Sensor.h"
#include "Actuator.h"
#include "Physics.h"
#include "Dashboard.h"
#include "CanBus.h"
NetworkDefinition::NetworkDefinition (QObject * parent)
: QObject (parent)
, m_subObjects (this)
, m_clock (50)
, m_dumpObjectsOnInit (false)
, m_benchmarkSimulatorTick (false)
......@@ -18,11 +14,5 @@ NetworkDefinition::NetworkDefinition (QObject * parent)
, m_hideActuatorsPanel (false)
, m_hideMessagesPanel (false)
, m_startTab (Tabs::NODES_IO)
, m_nodesList (Q_NULLPTR)
, m_sensorsList (Q_NULLPTR)
, m_actuatorsList (Q_NULLPTR)
, m_world (Q_NULLPTR)
, m_dashboardsList (this)
, m_canBusList (this)
, m_serialBusList (this)
{ }
......@@ -12,13 +12,7 @@
#include "IdentifiableObject.h"
class NodesList;
class SensorsList;
class ActuatorsList;
class PhysicalWorld;
class Dashboard;
class CanBus;
class SerialBus;
QML_ENUM_CLASS (Tabs,
DATASHEET,
......@@ -29,6 +23,8 @@ QML_ENUM_CLASS (Tabs,
class NetworkDefinition : public QObject {
Q_OBJECT
QML_DEFAULT_PROPERTY (subObjects)
QML_LIST_PROPERTY (QObject, subObjects)
QML_WRITABLE_CSTREF_PROPERTY (QString, uid)
QML_WRITABLE_CSTREF_PROPERTY (QString, title)
QML_WRITABLE_VAR_PROPERTY (int, clock)
......@@ -39,13 +35,7 @@ class NetworkDefinition : public QObject {
QML_WRITABLE_VAR_PROPERTY (bool, hideActuatorsPanel)
QML_WRITABLE_VAR_PROPERTY (bool, hideMessagesPanel)
QML_WRITABLE_VAR_PROPERTY (Tabs::Type, startTab)
QML_WRITABLE_PTR_PROPERTY (NodesList, nodesList)
QML_WRITABLE_PTR_PROPERTY (SensorsList, sensorsList)
QML_WRITABLE_PTR_PROPERTY (ActuatorsList, actuatorsList)
QML_WRITABLE_PTR_PROPERTY (PhysicalWorld, world)
QML_LIST_PROPERTY (Dashboard, dashboardsList)
QML_LIST_PROPERTY (CanBus, canBusList)
QML_LIST_PROPERTY (SerialBus, serialBusList)
public:
explicit NetworkDefinition (QObject * parent = Q_NULLPTR);
......
......@@ -12,7 +12,6 @@ Board::Board (QObject * parent)
: BasicObject (ObjectFamily::BOARD, parent)
, m_subObjects (this)
{
m_ios = new BasicObjectsModel (this);
Manager::instance ().registerObject (this);
}
......@@ -22,7 +21,12 @@ Board::~Board (void) {
void Board::onComponentCompleted (void) {
BasicObject::onComponentCompleted ();
m_ios->appendIf<AbstractIO> (m_subObjects.items ());
for (QObject * object : m_subObjects) {
if (AbstractIO * io = qobject_cast<AbstractIO *> (object)) {
m_ios.append (io);
}
else { }
}
Manager::instance ().intializeObject (this);
}
......@@ -31,9 +35,7 @@ Node::Node (QObject * parent)
, m_subObjects (this)
, m_mode (Modes::ACTIVE)
{
m_memory = new Memory (this);
m_boards = new BasicObjectsModel (this);
m_routines = new BasicObjectsModel (this);
m_memory = new Memory (this);
Manager::instance ().registerObject (this);
}
......@@ -43,8 +45,15 @@ Node::~Node (void) {
void Node::onComponentCompleted (void) {
BasicObject::onComponentCompleted ();
m_boards->appendIf<Board> (m_subObjects.items ());
m_routines->appendIf<AbstractRoutine> (m_subObjects.items ());
for (QObject * object : m_subObjects) {
if (Board * board = qobject_cast<Board *> (object)) {
m_boards.append (board);
}
else if (AbstractRoutine * routine = qobject_cast<AbstractRoutine *> (object)) {
m_routines.append (routine);
}
else { }
}
Manager::instance ().intializeObject (this);
}
......@@ -65,22 +74,3 @@ void Node::stop (void) {
void Node::reset (void) {
m_memory->reset ();
}
NodesList::NodesList (QObject * parent)
: QObject (parent)
, m_subObjects (this)
{
m_nodes = new BasicObjectsModel (this);
Manager::instance ().registerObject (this);
}
NodesList::~NodesList (void) {
Manager::instance ().unregisterObject (this);
}
void NodesList::classBegin (void) { }
void NodesList::componentComplete (void) {
m_nodes->appendIf<Node> (m_subObjects.items ());
Manager::instance ().intializeObject (this);
}
......@@ -4,6 +4,8 @@
#include <QObject>
#include "IdentifiableObject.h"
#include "Routine.h"
#include "IO.h"
QML_ENUM_CLASS (Modes,
INACTIVE,
......@@ -12,15 +14,12 @@ QML_ENUM_CLASS (Modes,
NB_MODES)
class Memory;
class CanOpen;
class AbstractIO;
class AbstractRoutine;
class Board : public BasicObject {
Q_OBJECT
QML_DEFAULT_PROPERTY (subObjects)
QML_LIST_PROPERTY (QObject, subObjects)
QML_CONSTANT_PTR_PROPERTY (BasicObjectsModel, ios)
QML_REFLIST_PROPERTY (AbstractIO, ios, 20)
public:
explicit Board (QObject * parent = Q_NULLPTR);
......@@ -34,8 +33,8 @@ class Node : public BasicObject {
Q_INTERFACES (QQmlParserStatus)
QML_DEFAULT_PROPERTY (subObjects)
QML_LIST_PROPERTY (QObject, subObjects)
QML_CONSTANT_PTR_PROPERTY (BasicObjectsModel, boards)
QML_CONSTANT_PTR_PROPERTY (BasicObjectsModel, routines)
QML_REFLIST_PROPERTY (Board, boards, 10)
QML_REFLIST_PROPERTY (AbstractRoutine, routines, 10)
QML_CONSTANT_PTR_PROPERTY (Memory, memory)
QML_WRITABLE_VAR_PROPERTY (Modes::Type, mode)
QML_WRITABLE_CSTREF_PROPERTY (QString, description)
......@@ -57,19 +56,4 @@ signals:
void stopped (void);
};
class NodesList : public QObject, public QQmlParserStatus {
Q_OBJECT
Q_INTERFACES (QQmlParserStatus)
QML_DEFAULT_PROPERTY (subObjects)
QML_LIST_PROPERTY (QObject, subObjects)
QML_CONSTANT_PTR_PROPERTY (BasicObjectsModel, nodes)
public:
explicit NodesList (QObject * parent = Q_NULLPTR);
virtual ~NodesList (void);
void classBegin (void) Q_DECL_FINAL;
void componentComplete (void) Q_DECL_FINAL;
};
#endif // NODE_H
......@@ -515,7 +515,7 @@ void PhysicalWorld::processPhysics (void) {
colors.clear ();
// blocks / cylinders
for (PhysicalBlock * block : arrayRange (Manager::instance ().getPhysicalBlocks ())) {
for (PhysicalBlock * block : arrayRange (Manager::instance ().getAsConstRef_physicalBlocks ())) {
// init transformation matrix
QMatrix4x4 matrixTransforms;
......@@ -638,7 +638,7 @@ void PhysicalWorld::processPhysics (void) {
}
// markers
for (PhysicalMarker * marker : arrayRange (Manager::instance ().getPhysicalMarkers ())) {
for (PhysicalMarker * marker : arrayRange (Manager::instance ().getAsConstRef_physicalMarkers ())) {
// init transformation matrix
QMatrix4x4 matrixTransforms;
......
......@@ -84,11 +84,11 @@ public:
, vertexBackBottomRight (+1, -1, -1)
, vertexBackBottomLeft (-1, -1, -1)
{
const float CIRCLE_DIV = (M_PI * 2.0f / float (CIRCLE_POINTS));
const qreal CIRCLE_DIV = (M_PI * 2.0 / qreal (CIRCLE_POINTS));