Sets the data for the given index from the editor's value.
        
        :param      editor | <QWidget>
                    model  | <QAbstractItemModel>
                    index  | <QModelIndex>
354457
def setModelData( self, editor, model, index ):
        
        tree        = self.parent()
        querywidget = tree.parent()
        factory     = querywidget.factory()
        item        = tree.itemFromIndex(index)
        
        value = factory.editorData(editor)
        item.setValue(value)
274440
def setEditor(self, name):
        """"""
        editor = get_stimulus_editor(name)
        self.editor = editor
        self._stim.setStimType(name)
33927
def setData(self, index, value, role=Qt.EditRole):
        
        item = self.itemAt(index)
        if not item:
            return False
        d = item.declaration
        if role == Qt.CheckStateRole:
            checked = value == Qt.Checked
            if checked != d.checked:
                d.checked = checked
                d.toggled(checked)
            return True
        elif role == Qt.EditRole:
            if value != d.text:
                d.text = value
            return True
        return super(QAbstractAtomItemModel, self).setData(index, value, role)
319587
def set_root(self, index):
        
        if not index.isValid():
            self.setModel(None) # so we will not see toplevel stuff
            self.setCurrentIndex(QtCore.QModelIndex())
            self.new_root.emit(QtCore.QModelIndex())
            return
        if self.model() != index.model():
            self.setModel(index.model())
        self.setRootIndex(index)
        if self.model().hasChildren(index):
            self.setCurrentIndex(self.model().index(0, 0, index))
            self.new_root.emit(self.model().index(0, 0, index))
        else:
            self.new_root.emit(QtCore.QModelIndex())
211055
def show_editor(self):
        """"""
        index = self.proxy_model.mapToSource(self.currentIndex())
        row, column = index.row(), index.column()
        shortcuts = self.source_model.shortcuts
        context = shortcuts[row].context
        name = shortcuts[row].name

        sequence_index = self.source_model.index(row, SEQUENCE)
        sequence = sequence_index.data()

        dialog = ShortcutEditor(self, context, name, sequence, shortcuts)

        if dialog.exec_():
            new_sequence = dialog.new_sequence
            self.source_model.setData(sequence_index, new_sequence)
984173
public void setEditor(JsGeometryEditor editor) {
		delegate = new ShowSplitAreas(editor.getMap().getMapWidget(), editor.getSplitService().getDelegate());
	}
352082
def _set_index(self, key, index):
        
        axis = key[0]
        origin = "{}0".format(axis)
        delta = "d{}".format(axis)
        if index is None:
            return delattr(self, key)
        if not isinstance(index, Index):
            try:
                unit = index.unit
            except AttributeError:
                unit = getattr(self, "_default_{}unit".format(axis))
            index = Index(index, unit=unit, copy=False)
        setattr(self, origin, index[0])
        if index.regular:
            setattr(self, delta, index[1] - index[0])
        else:
            delattr(self, delta)
        setattr(self, "_{}".format(key), index)
494087
def setData(self, index: QModelIndex, value, role=None):
        """"""
        if not (index.isValid() and role == Qt.CheckStateRole):
            return False
        c_id = self.get_item(index).Id
        self._set_id(c_id, value == Qt.Checked, index)
        return True
190851
public void setText(int index, String value)
   {
      set(selectField(AssignmentFieldLists.CUSTOM_TEXT, index), value);
   }
276193
@SuppressWarnings({"rawtypes", "unchecked"})
  public void initializeEditors(final Object editor) {
    if (editor instanceof HasValueChangeHandlers && valueChangeHandler != null) {
      ((HasValueChangeHandlers) editor).addValueChangeHandler(valueChangeHandler);
      // if widget has a value change handler, validate on change
      if (validateOnVueChangeHandler != null) {
        ((HasValueChangeHandlers) editor).addValueChangeHandler(validateOnVueChangeHandler);
      }
    }
    // if widget has a key up handler, validate on key up
    if (editor instanceof HasKeyUpHandlers && validateOnKeyUpHandler != null) {
      ((HasKeyUpHandlers) editor).addKeyUpHandler(validateOnKeyUpHandler);
    }
    // try to submit form on return
    if (editor instanceof HasKeyPressHandlers && commitOnReturnHandler != null) {
      ((HasKeyPressHandlers) editor).addKeyPressHandler(commitOnReturnHandler);
    }
  }
456133
def setData(self, index, value, role):
        """"""
        row = index.row()
        name, state = self.row(row)

        if role == Qt.CheckStateRole:
            self.set_row(row, [name, not state])
            self._parent.setCurrentIndex(index)
            self._parent.setFocus()
            self.dataChanged.emit(index, index)
            return True
        elif role == Qt.EditRole:
            self.set_row(row, [from_qvariant(value, to_text_string), state])
            self.dataChanged.emit(index, index)
            return True
        return True
696749
def change_active_widget(self, index):
        
        string_index = [':']*3
        string_index[self.last_dim] = '<font color=red>%i</font>'
        self.slicing_label.setText((r"Slicing: [" + ", ".join(string_index) +
                                "]") % index)
        if index < 0:
            data_index = self.data.shape[self.last_dim] + index
        else:
            data_index = index
        slice_index = [slice(None)]*3
        slice_index[self.last_dim] = data_index

        stack_index = self.dim_indexes[self.last_dim].get(data_index)
        if stack_index is None:
            stack_index = self.stack.count()
            try:
                self.stack.addWidget(ArrayEditorWidget(
                    self, self.data[tuple(slice_index)]))
            except IndexError:  # Handle arrays of size 0 in one axis
                self.stack.addWidget(ArrayEditorWidget(self, self.data))
            self.dim_indexes[self.last_dim][data_index] = stack_index
            self.stack.update()
        self.stack.setCurrentIndex(stack_index)
1172112
public void setText(int index, String value)
   {
      set(selectField(TaskFieldLists.CUSTOM_TEXT, index), value);
   }
445816
def setModelData(self, editor, model, index):
        
        if not hasattr(model, "set_value"):
            # Read-only mode
            return
        
        if isinstance(editor, QLineEdit):
            value = editor.text()
            try:
                value = display_to_value(to_qvariant(value),
                                         self.get_value(index),
                                         ignore_errors=False)
            except Exception as msg:
                raise
                QMessageBox.critical(editor, _("Edit item"),
                                     _("<b>Unable to assign data to item.</b>"
                                       "<br><br>Error message:<br>%s"
                                       ) % str(msg))
                return
        elif isinstance(editor, QDateEdit):
            qdate = editor.date()
            value = datetime.date( qdate.year(), qdate.month(), qdate.day() )
        elif isinstance(editor, QDateTimeEdit):
            qdatetime = editor.dateTime()
            qdate = qdatetime.date()
            qtime = qdatetime.time()
            value = datetime.datetime( qdate.year(), qdate.month(),
                                       qdate.day(), qtime.hour(),
                                       qtime.minute(), qtime.second() )
        else:
            # Should not happen...
            raise RuntimeError("Unsupported editor widget")
        self.set_value(index, value)
667110
def qset(self, name, index, value):
        
        index = get_integer('index', index)        
        return self.execute_command('qset', name, index, value)
981320
def setData(self, index, value, role=Qt.EditRole):
        """"""
        if not index.isValid() or self.readonly:
            return False
        i = index.row()
        j = index.column()
        value = from_qvariant(value, str)
        dtype = self._data.dtype.name
        if dtype == "bool":
            try:
                val = bool(float(value))
            except ValueError:
                val = value.lower() == "true"
        elif dtype.startswith("string") or dtype.startswith("bytes"):
            val = to_binary_string(value, 'utf8')
        elif dtype.startswith("unicode") or dtype.startswith("str"):
            val = to_text_string(value)
        else:
            if value.lower().startswith('e') or value.lower().endswith('e'):
                return False
            try:
                val = complex(value)
                if not val.imag:
                    val = val.real
            except ValueError as e:
                QMessageBox.critical(self.dialog, "Error",
                                     "Value error: %s" % str(e))
                return False
        try:
            self.test_array[0] = val  # will raise an Exception eventually
        except OverflowError as e:
            print("OverflowError: " + str(e))  # spyder: test-skip
            QMessageBox.critical(self.dialog, "Error",
                                 "Overflow error: %s" % str(e))
            return False

        # Add change to self.changes
        self.changes[(i, j)] = val
        self.dataChanged.emit(index, index)
        if not is_string(val):
            if val > self.vmax:
                self.vmax = val
            if val < self.vmin:
                self.vmin = val
        return True
136880
function() {
      var t = this,
          json = t.model.toJSON({trim:false});
      t.sourceView.model = json;
      t.sourceView.setData();
      t.editor.val(JSON.stringify(json, null, 2));
    }