code: def connect_text(instance, prop, widget):
      
  
      def update_prop():
          val = widget.text()
          setattr(instance, prop, val)
  
      def update_widget(val):
          if hasattr(widget, 'editingFinished'):
              widget.blockSignals(True)
              widget.setText(val)
              widget.blockSignals(False)
              widget.editingFinished.emit()
          else:
              widget.setText(val)
  
      add_callback(instance, prop, update_widget)
  
      try:
          widget.editingFinished.connect(update_prop)
      except AttributeError:
          pass
  
      update_widget(getattr(instance, prop))
docs: Connect a string callback property with a Qt widget containing text.
  
      Parameters
      ----------
      instance : object
          The class instance that the callback property is attached to
      prop : str
          The name of the callback property
      widget : QtWidget
          The Qt widget to connect. This should implement the ``setText`` and
          ``text`` methods as well optionally the ``editingFinished`` signal.