code: def display_to_value(value, default_value, ignore_errors=True):
      
      from qtpy.compat import from_qvariant
      value = from_qvariant(value, to_text_string)
      try:
          np_dtype = get_numpy_dtype(default_value)
          if isinstance(default_value, bool):
              # We must test for boolean before NumPy data types
              # because `bool` class derives from `int` class
              try:
                  value = bool(float(value))
              except ValueError:
                  value = value.lower() == "true"
          elif np_dtype is not None:
              if 'complex' in str(type(default_value)):
                  value = np_dtype(complex(value))
              else:
                  value = np_dtype(value)
          elif is_binary_string(default_value):
              value = to_binary_string(value, 'utf8')
          elif is_text_string(default_value):
              value = to_text_string(value)
          elif isinstance(default_value, complex):
              value = complex(value)
          elif isinstance(default_value, float):
              value = float(value)
          elif isinstance(default_value, int):
              try:
                  value = int(value)
              except ValueError:
                  value = float(value)
          elif isinstance(default_value, datetime.datetime):
              value = datestr_to_datetime(value)
          elif isinstance(default_value, datetime.date):
              value = datestr_to_datetime(value).date()
          elif isinstance(default_value, datetime.timedelta):
              value = str_to_timedelta(value)
          elif ignore_errors:
              value = try_to_eval(value)
          else:
              value = eval(value)
      except (ValueError, SyntaxError):
          if ignore_errors:
              value = try_to_eval(value)
          else:
              return default_value
      return value
docs: Convert back to value