SEVERAL bug fixes

This commit is contained in:
itsmattkc
2018-10-12 18:48:14 +11:00
parent caee50a943
commit cdbec85a81
30 changed files with 444 additions and 149 deletions
+22 -13
View File
@@ -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);
}