mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
to allow grantlee to access individual fields of the cylinder_t struct
rather than a string representation of the whole cylinder info using a
grantlee structure like this one:
<table class="table_class">
<tr>
<td>Cylinder</td>
<td>Start press.</td>
<td>End press.</td>
<td>Gas mix</td>
</tr>
{% for cylinderObject in dive.cylinderObjects %}
<tr>
<td>{{ cylinderObject.description }}</td>
<td>{{ cylinderObject.startPressure }}</td>
<td>{{ cylinderObject.endPressure }}</td>
<td>{{ cylinderObject.gasMix }}</td>
</tr>
{% endfor %}
</table>
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
31 lines
No EOL
857 B
C++
31 lines
No EOL
857 B
C++
#ifndef CYLINDER_QOBJECT_H
|
|
#define CYLINDER_QOBJECT_H
|
|
|
|
#include "../dive.h"
|
|
#include <QObject>
|
|
#include <QString>
|
|
|
|
class CylinderObjectHelper : public QObject {
|
|
Q_OBJECT
|
|
Q_PROPERTY(QString description READ description CONSTANT)
|
|
Q_PROPERTY(QString size READ size CONSTANT)
|
|
Q_PROPERTY(QString workingPressure READ workingPressure CONSTANT)
|
|
Q_PROPERTY(QString startPressure READ startPressure CONSTANT)
|
|
Q_PROPERTY(QString endPressure READ endPressure CONSTANT)
|
|
Q_PROPERTY(QString gasMix READ gasMix CONSTANT)
|
|
public:
|
|
CylinderObjectHelper(cylinder_t *cylinder = NULL);
|
|
~CylinderObjectHelper();
|
|
QString description() const;
|
|
QString size() const;
|
|
QString workingPressure() const;
|
|
QString startPressure() const;
|
|
QString endPressure() const;
|
|
QString gasMix() const;
|
|
|
|
private:
|
|
cylinder_t *m_cyl;
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(CylinderObjectHelper *)
|
|
#endif |