[PATCH] Show correct icon when only one gasmix in the list

Joakim Bygdell j.bygdell at gmail.com
Mon Oct 19 11:05:24 PDT 2015


When there is only one gasmix in the list we should show the icon that tells the
user that they can't remove the last gasmix from the list.

Signed-off-by: Joakim Bygdell <j.bygdell at gmail.com>
---
 qt-models/cylindermodel.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 8786f78..8c9bee8 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -112,11 +112,17 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
 		break;
 	case Qt::DecorationRole:
 		if (index.column() == REMOVE)
-			ret = trashIcon();
+			if (rowCount() > 1)
+				ret = trashIcon();
+			else
+				ret = trashForbiddenIcon();
 		break;
 	case Qt::SizeHintRole:
 		if (index.column() == REMOVE)
-			ret = trashIcon().size();
+			if (rowCount() > 1)
+				ret = trashIcon();
+			else
+				ret = trashForbiddenIcon();
 		break;
 
 	case Qt::ToolTipRole:
-- 
2.3.8 (Apple Git-58)



More information about the subsurface mailing list