MCPcopy Create free account
hub / github.com/KDE/labplot / labelTextWrapperChanged

Method labelTextWrapperChanged

src/frontend/widgets/LabelWidget.cpp:1197–1221  ·  view source on GitHub ↗

SLOTs for changes triggered in TextLabel

Source from the content-addressed store, hash-verified

1195//****** SLOTs for changes triggered in TextLabel *********
1196//*********************************************************
1197void LabelWidget::labelTextWrapperChanged(const TextLabel::TextWrapper& text) {
1198 CONDITIONAL_LOCK_RETURN;
1199
1200 // save and restore the current cursor position after changing the text
1201 auto cursor = ui.teLabel->textCursor();
1202 int position = cursor.position();
1203 if (!ui.chbShowPlaceholderText->isChecked()) {
1204 if (text.mode != TextLabel::Mode::Text)
1205 ui.teLabel->setText(text.text);
1206 else
1207 ui.teLabel->setHtml(text.text);
1208 } else {
1209 if (text.mode != TextLabel::Mode::Text)
1210 ui.teLabel->setText(text.textPlaceholder);
1211 else
1212 ui.teLabel->setHtml(text.textPlaceholder);
1213 }
1214 cursor.movePosition(QTextCursor::Start);
1215 cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, position);
1216 ui.teLabel->setTextCursor(cursor);
1217
1218 const int index = static_cast<int>(text.mode);
1219 ui.cbMode->setCurrentIndex(index);
1220 this->labelModeChanged(text.mode);
1221}
1222
1223/*!
1224 * \brief Highlights the text field if wrong latex syntax was used (null image was produced)

Callers

nothing calls this directly

Calls 5

labelModeChangedMethod · 0.95
positionMethod · 0.80
setHtmlMethod · 0.80
setTextMethod · 0.45
setCurrentIndexMethod · 0.45

Tested by

no test coverage detected