SEVERAL bug fixes
This commit is contained in:
+22
-13
@@ -5,22 +5,17 @@
|
||||
TextEditEx::TextEditEx(QWidget *parent) : QTextEdit(parent) {
|
||||
setUndoRedoEnabled(false);
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(updateInternals()));
|
||||
connect(this, SIGNAL(updateSelf()), this, SLOT(updateText()));
|
||||
}
|
||||
|
||||
void TextEditEx::setPlainTextEx(const QString &text) {
|
||||
blockSignals(true);
|
||||
const QString& TextEditEx::getPlainTextEx() {
|
||||
return text;
|
||||
}
|
||||
|
||||
int pos = textCursor().position();
|
||||
|
||||
setPlainText(text);
|
||||
|
||||
QTextCursor newCursor(document());
|
||||
newCursor.setPosition(pos);
|
||||
setTextCursor(newCursor);
|
||||
|
||||
updateInternals();
|
||||
|
||||
blockSignals(false);
|
||||
void TextEditEx::setPlainTextEx(const QString &t) {
|
||||
previousText = text;
|
||||
text = t;
|
||||
emit updateSelf();
|
||||
}
|
||||
|
||||
const QString &TextEditEx::getPreviousValue() {
|
||||
@@ -31,3 +26,17 @@ void TextEditEx::updateInternals() {
|
||||
previousText = text;
|
||||
text = toPlainText();
|
||||
}
|
||||
|
||||
void TextEditEx::updateText() {
|
||||
blockSignals(true);
|
||||
|
||||
int pos = textCursor().position();
|
||||
|
||||
setPlainText(text);
|
||||
|
||||
QTextCursor newCursor(document());
|
||||
newCursor.setPosition(pos);
|
||||
setTextCursor(newCursor);
|
||||
|
||||
blockSignals(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user