Before someone shouts at me, here is the patch that resolves the
'remove' slot warning, because of my stupid mistake of ignoring the
comment in tableview class.

Thank you,
Lakshman
From 928a763f2283d8680830e35977f0fd2ea60c6d2b Mon Sep 17 00:00:00 2001
From: Lakshman Anumolu <[email protected]>
Date: Tue, 1 Apr 2014 22:36:57 -0500
Subject: [PATCH] Include REMOVE slot

Model derived from tableview is expected to have remove slot,
which is missing in DivePlannerDisplay currently. This patch fixes
the annoying warning message while starting Subsurface because of
not including remove slot.

Currently there is lot of work to do, that either requires modifying
the model to skip 'remove' slot or find a way to make them inactive.

Signed-off-by: Lakshman Anumolu <[email protected]>
---
 qt-ui/diveplanner.cpp | 11 +++++++++++
 qt-ui/diveplanner.h   |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index a7d5ee7..4387a5a 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -75,6 +75,8 @@ QVariant DivePlannerDisplay::data(const QModelIndex &index, int role) const
 		}
 	} else if (role == Qt::DecorationRole) {
 		switch (index.column()) {
+		case REMOVE:
+			return QIcon(":trash");
 		}
 	} else if (role == Qt::FontRole) {
 		return defaultModelFont();
@@ -159,6 +161,15 @@ void DivePlannerDisplay::insertPoint(const struct computedPoint &p)
 	computedPoints.append(p);
 }
 
+void DivePlannerDisplay::remove(const QModelIndex &index)
+{
+	if (index.column() != REMOVE)
+		return;
+
+	beginRemoveRows(QModelIndex(), index.row(), index.row());
+	endRemoveRows();
+}
+
 static DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
 
 DivePlannerGraphics::DivePlannerGraphics(QWidget *parent) : QGraphicsView(parent),
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 84ac4a8..4d3f0cb 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -31,6 +31,7 @@ private:
 public:
 	static DivePlannerDisplay *instance();
 	enum Sections {
+		REMOVE,
 		COMPUTED_DEPTH,
 		COMPUTED_DURATION,
 		COLUMNS
@@ -47,6 +48,10 @@ public:
 	void removeStops();
 	void addStops();
 	void insertPoint(const struct computedPoint &p);
+
+public
+slots:
+	void remove(const QModelIndex &index);
 };
 
 class DivePlannerPointsModel : public QAbstractTableModel {
-- 
1.8.3.2

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to