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.bygd...@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)

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to