[rkward-cvs] SF.net SVN: rkward-code:[4889] trunk/rkward

tfry at users.sf.net tfry at users.sf.net
Wed Oct 8 19:23:15 UTC 2014


Revision: 4889
          http://sourceforge.net/p/rkward/code/4889
Author:   tfry
Date:     2014-10-08 19:23:14 +0000 (Wed, 08 Oct 2014)
Log Message:
-----------
Explicit markup of NAs in data editor.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2014-10-08 15:21:13 UTC (rev 4888)
+++ trunk/rkward/ChangeLog	2014-10-08 19:23:14 UTC (rev 4889)
@@ -1,3 +1,4 @@
+- In data editor, indicate NAs, explicitly
 - Import Stata plugin gains option to convert character encoding.
 - New embeddable (minimal) plugin "multi_input" to combine different input elements
 - Fixed: Problems starting from paths with spaces in the file name on Windows

Modified: trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp
===================================================================
--- trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp	2014-10-08 15:21:13 UTC (rev 4888)
+++ trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp	2014-10-08 19:23:14 UTC (rev 4889)
@@ -2,7 +2,7 @@
                           rkvareditmodel  -  description
                              -------------------
     begin                : Mon Nov 05 2007
-    copyright            : (C) 2007, 2010, 2011, 2012 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2010, 2011, 2012, 2014 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -298,16 +298,19 @@
 	RKVariable *var = objects[col];
 	RK_ASSERT (var);
 
-	if (role == Qt::DisplayRole) return var->getText (row, true);
 	if (role == Qt::EditRole) return var->getText (row, false);
 
 	RKVariable::Status status = var->cellStatus (row);
+	if (role == Qt::DisplayRole) {
+		if (status == RKVariable::ValueUnused) return QString ("<NA>");
+		return var->getText (row, true);
+	}
 	if (role == Qt::BackgroundRole) {
 		if (status == RKVariable::ValueInvalid) return (Qt::red);
 	} else if (role == Qt::ToolTipRole) {
 		if (status == RKVariable::ValueInvalid) return (i18n ("This value is not allowed, here"));
 	}
-	if ((role == Qt::ForegroundRole) && (status == RKVariable::ValueUnknown)) return (Qt::lightGray);
+	if ((role == Qt::ForegroundRole) && ((status == RKVariable::ValueUnknown) || (status == RKVariable::ValueUnused))) return (Qt::lightGray);
 	if (role == Qt::TextAlignmentRole) {
 		if (var->getAlignment () == RKVariable::AlignCellLeft) return ((int) Qt::AlignLeft | Qt::AlignVCenter);
 		else return ((int) Qt::AlignRight | Qt::AlignVCenter);





More information about the rkward-tracker mailing list