MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / toConvertedText

Method toConvertedText

src/plugins/chat/widgets/inputeditwidget.cpp:357–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357QString InputEdit::toConvertedText() const
358{
359 QTextCursor cursor = textCursor();
360 cursor.movePosition(QTextCursor::Start);
361
362 QString text;
363 while (!cursor.atEnd()) {
364 auto format = cursor.charFormat();
365 auto currentText = cursor.selectedText();
366 text.append(cursor.selectedText());
367
368 if (format.type() == QTextFormat::InvalidFormat && (currentText == QString(QChar::ObjectReplacementCharacter))) {
369 auto innerText = format.property(QTextFormat::UserProperty).toString();
370 if (innerText.mid(1) == selectedCodeTag) {
371 text.append("\n```\n" + innerText + "\n" + selectedCode + "\n```\n");
372 } else if (!innerText.isEmpty()) {
373 text.append('`' + innerText + '`');
374 }
375 }
376
377 cursor.clearSelection();
378 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
379 }
380
381 text.append(cursor.selectedText());
382 return text.remove(QChar::ObjectReplacementCharacter);
383}
384
385void InputEdit::appendTag(const QString &text)
386{

Callers 1

slotMessageSendMethod · 0.80

Calls 10

atEndMethod · 0.80
QStringClass · 0.50
selectedTextMethod · 0.45
appendMethod · 0.45
typeMethod · 0.45
toStringMethod · 0.45
propertyMethod · 0.45
isEmptyMethod · 0.45
clearSelectionMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected