Added the code that will load and populate the Tank Info

Added the code that will load and populate the Tank Info
ComboBox that`s used by the user to select the Cylinder
description.

Code curerntly implements more than the GTK version since
the GTK version of it was a plain-list, this one is a
table based model that can be used in ListViews ( like
we use now in the ComboBox ) but also in TableViews
( if there`s a need in the future to see everything
that`s catalogued in the Tank Info struct. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-04-15 15:04:35 -03:00 committed by Dirk Hohndel
parent db180bf46e
commit 115ee47bfc
7 changed files with 143 additions and 7 deletions

View file

@ -10,6 +10,26 @@
#include <QAbstractTableModel>
#include "../dive.h"
/* Encapsulates the tank_info global variable
* to show on Qt`s Model View System.*/
class TankInfoModel : public QAbstractTableModel {
Q_OBJECT
public:
enum { DESCRIPTION, ML, BAR};
TankInfoModel();
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
/*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
void add(const QString& description);
void clear();
void update();
private:
int rows;
};
class CylindersModel : public QAbstractTableModel {
Q_OBJECT
public: