[rkward-cvs] SF.net SVN: rkward:[3670] trunk/rkward/rkward/plugin

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sat Jun 4 10:48:32 UTC 2011


Revision: 3670
          http://rkward.svn.sourceforge.net/rkward/?rev=3670&view=rev
Author:   tfry
Date:     2011-06-04 10:48:32 +0000 (Sat, 04 Jun 2011)

Log Message:
-----------
Of course, if a component is hidden, that should imply non-requiredness, too.

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkcomponent.cpp
    trunk/rkward/rkward/plugin/rkcomponent.h

Modified: trunk/rkward/rkward/plugin/rkcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.cpp	2011-06-04 10:13:54 UTC (rev 3669)
+++ trunk/rkward/rkward/plugin/rkcomponent.cpp	2011-06-04 10:48:32 UTC (rev 3670)
@@ -2,7 +2,7 @@
                           rkcomponent  -  description
                              -------------------
     begin                : Tue Dec 13 2005
-    copyright            : (C) 2005, 2006, 2009, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2009, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -58,7 +58,7 @@
 			}
 		} else {
 			RK_ASSERT (it.value ()->isComponent ());
-			if (!static_cast<RKComponent *> (it.value ())->isEnabled ()) continue;
+			if (static_cast<RKComponent *> (it.value ())->isInactive ()) continue;
 			it.value ()->fetchPropertyValuesRecursive (list, true, prefix + it.key () + '.');
 		}
 	}
@@ -167,7 +167,7 @@
 	}
 	if (processing) return Processing;
 	bool req = required;
-	if (isComponent ()) req = req & static_cast<RKComponent*>(this)->isEnabled ();
+	if (isComponent () && static_cast<RKComponent*>(this)->isInactive ()) req = false;
 	if (!req) return Satisfied;
 	if (children_satisfied && isSatisfied ()) return Satisfied;
 	return Unsatisfied;
@@ -246,11 +246,18 @@
 	}
 }
 
+bool RKComponent::isInactive () {
+	if (!isEnabled ()) return true;
+	if (parentWidget () && isHidden ()) return true;	// Note: Components embedded as button may be "hidden" without being inaccessible
+	if (!visibility_property->boolValue ()) return true;	// Note for those, this is the appropriate check
+	return false;
+}
+
 bool RKComponent::isValid () {
 	RK_TRACE (PLUGIN);
 #warning TODO: I do not think we need this. Use recursiveStatus, instead
 
-	if (!isEnabled ()) return true;
+	if (isInactive ()) return true;
 	for (QHash<QString, RKComponentBase*>::const_iterator it = child_map.constBegin (); it != child_map.constEnd (); ++it) {
 		if (!(it.value ()->isSatisfied ())) return false;
 	}

Modified: trunk/rkward/rkward/plugin/rkcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.h	2011-06-04 10:13:54 UTC (rev 3669)
+++ trunk/rkward/rkward/plugin/rkcomponent.h	2011-06-04 10:48:32 UTC (rev 3670)
@@ -2,7 +2,7 @@
                           rkcomponent  -  description
                              -------------------
     begin                : Tue Dec 13 2005
-    copyright            : (C) 2005, 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -153,6 +153,8 @@
 	virtual RKComponent *addPage ();
 /** For wizardish guis: this gets called to register a component on the current page during construction. The component does not get reparented. It will have to be satisfied in order to move to the next page in the wizard. See isWizardish () see addPage (). Default implementation does nothing. */
 	virtual void addComponentToCurrentPage (RKComponent *component);
+/** @returns true if the component is inactive, i.e. disabled, or hidden in the GUI */
+	bool isInactive ();
 public slots:
 /** This handles changes in the default properties (enabledness, visibility, requiredness). You will use similar slots in derived classes to handle
 specialized properties */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list