MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / setModelData

Method setModelData

launcher/ui/instanceview/InstanceDelegate.cpp:422–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
423{
424 QTextEdit * realeditor = qobject_cast<NoReturnTextEdit *>(editor);
425 QString text = realeditor->toPlainText();
426 text.replace(QChar('\n'), QChar(' '));
427 text = text.trimmed();
428 // Prevent instance names longer than 128 chars
429 text.truncate(128);
430 if(text.size() != 0)
431 {
432 model->setData(index, text);
433 }
434}
435
436QWidget * ListViewDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
437{

Callers

nothing calls this directly

Calls 4

toPlainTextMethod · 0.80
replaceMethod · 0.45
sizeMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected