summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 09:14:19 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 09:14:19 -0300
commit9856aaaa863b03994b2befdb255050a6686d6c12 (patch)
treef8f32cf309ff2b4d5e3c955611dc152cdeb9367b /qt-ui/diveplanner.cpp
parentaceb002a33dcd5c2bb852e28d4f0de76c7cfced5 (diff)
downloadsubsurface-9856aaaa863b03994b2befdb255050a6686d6c12.tar.gz
Started the Model to handle the DivePoints
Started the model to handle the divepoints between the Qt Widget interface and the QGraphicsView one. good thing is that we share code. Bad is that a model is harder to work, but doable. :) With this finished ( in a couple of commits ) one can insert a point on the Qt widget or on the graphics view and it will be 'mirrored' to both interfaces. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index c6f9e23d6..61ca64b34 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -792,4 +792,45 @@ void Button::mousePressEvent(QGraphicsSceneMouseEvent* event)
DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f), ui(new Ui::DivePlanner())
{
ui->setupUi(this);
+ ui->tablePoints->setModel(DivePlannerPointsModel::instance());
}
+
+int DivePlannerPointsModel::columnCount(const QModelIndex& parent) const
+{
+ return COLUMNS;
+}
+
+QVariant DivePlannerPointsModel::data(const QModelIndex& index, int role) const
+{
+ return QVariant();
+}
+
+QVariant DivePlannerPointsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role == Qt::DisplayRole){
+ switch(section){
+ case DEPTH: return tr("Final Depth");
+ case DURATION: return tr("Duration");
+ case GAS: return tr("Used Gas");
+ case CCSETPOINT: return tr("CC Set Point");
+ }
+ }
+ return QVariant();
+}
+
+int DivePlannerPointsModel::rowCount(const QModelIndex& parent) const
+{
+ return 0;
+}
+
+DivePlannerPointsModel::DivePlannerPointsModel(QObject* parent): QAbstractTableModel(parent)
+{
+
+}
+
+DivePlannerPointsModel* DivePlannerPointsModel::instance()
+{
+ static DivePlannerPointsModel* self = new DivePlannerPointsModel();
+ return self;
+}
+