SLOTs for changes triggered in TextLabel
| 1195 | //****** SLOTs for changes triggered in TextLabel ********* |
| 1196 | //********************************************************* |
| 1197 | void 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) |
nothing calls this directly
no test coverage detected