def toGraphicsObjectIfPossible(item):
 if (item is None):
  return None
 obj = item.toGraphicsObject()
 return (item if (obj is None) else obj)

def toGraphicsObjectIfPossible ( item ) : if ( item is None ) : return None obj = item . toGraphicsObject ( ) return ( item if ( obj is None ) else obj )
return the item as a qgraphicsobject if possible .