From 939d80d1b487f45c1950c19ab21d87340502a98c Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 3 Feb 2015 20:53:25 -0200
Subject: [PATCH 1/2] Don't allow the Cylinder option be edited in PLAN / ADD
 mode

this sets the combobox to disabled if the profile is in
any mode besides PROFILe ( we should change that to DISPLAY )

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/modeldelegates.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 46103ec..ee7dc6c 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -87,6 +87,7 @@ struct CurrSelected {
 
 QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
+	MainWindow *m = MainWindow::instance();
 	QComboBox *comboDelegate = new QComboBox(parent);
 	comboDelegate->setModel(model);
 	comboDelegate->setEditable(true);
@@ -95,6 +96,8 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
 	comboDelegate->completer()->setCompletionMode(QCompleter::PopupCompletion);
 	comboDelegate->view()->setEditTriggers(QAbstractItemView::AllEditTriggers);
 	comboDelegate->lineEdit()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
+	if ((m->graphics()->currentState != ProfileWidget2::PROFILE))
+		comboDelegate->lineEdit()->setEnabled(false);
 	comboDelegate->view()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
 	QAbstractItemView *comboPopup = comboDelegate->lineEdit()->completer()->popup();
 	comboPopup->setMouseTracking(true);
-- 
2.2.2

From f484a6fbc6904674c150b0b0b968e18d589964ef Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 3 Feb 2015 20:56:06 -0200
Subject: [PATCH 2/2] Do not set default bg to white on the models

The user may have a different theme, as i did, and it
looked very wrong.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/models.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index b289813..f0c15d4 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -115,8 +115,6 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
 			if ((cyl->start.mbar && !cyl->end.mbar) ||
 			    (cyl->end.mbar && cyl->start.mbar <= cyl->end.mbar))
 				ret = REDORANGE1_HIGH_TRANS;
-			else
-				ret = WHITE1;
 			break;
 		}
 		break;
-- 
2.2.2

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

Reply via email to