QPlainTextEdit
-
Hi,
set undo not working in QPlainTextEdit belowpte1 = new QPlainTextEdit("hello\r\nDan\nhow r\nyou\nhi\nAnd\nhello\nagain \ndkd\naee\nwa\ndaf" "\nAnd his this is a long long long text which has to cross the widget width andersonkddkdkdk show line wrap mode function to test", this); pte1->setGeometry(10, 10, 400, 100); pte1->setBackgroundVisible(true); pte1->setCenterOnScroll(true); pte1->setCursorWidth(3); pte1->setDocumentTitle("Dan Document"); pte1->setLineWrapMode(QPlainTextEdit::NoWrap); pte1->setMaximumBlockCount(10); pte1->setOverwriteMode(false); pte1->setPlaceholderText("Shows Status here"); pte1->setUndoRedoEnabled(true);Any help is very useful.
Thanks.
Dan -
It works with this code below!!
<
pte1 = new QPlainTextEdit("hello\r\nsdan\nhow r\nyou\nhi\nthis was him dan\r\n And\nhello\nagain \ndkd\naee\nwa\ndaf"
"\nAnd his this is a long long long text which has to cross the widget width andersonkddkdkdk show line wrap mode function to test", this);
pte1->setGeometry(10, 10, 400, 100);
pte1->setBackgroundVisible(true);
pte1->setCenterOnScroll(true);
pte1->setCursorWidth(3);
pte1->setDocumentTitle("Dan Document");
// pte1->setLineWrapMode(QPlainTextEdit::NoWrap);
// pte1->setMaximumBlockCount(10);
pte1->setOverwriteMode(false);
pte1->setPlaceholderText("Shows Status here");
pte1->setWordWrapMode(QTextOption::WordWrap);
connect(pte1, SIGNAL(cursorPositionChanged()), this, SLOT(cpc1()));pt1.setX(10); pt1.setY(4); QTextDocument *td1; td1 = pte1->document();// pte1->setUndoRedoEnabled(true);
// pte1->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::TextSelectableByKeyboard);
// pte1->setTabStopDistance(200);
// pte1->setTabChangesFocus(true);
// pte1->setPlainText("Hei Dan");
// pte1->setDocumentTitle("Hi dan doc");
// pte1->setReadOnly(true);qDebug() << "block count: " << pte1->blockCount(); qDebug() << "Doc Title: " << pte1->documentTitle(); qDebug() << "Plain Text: " << pte1->toPlainText(); qDebug() << "Anchor at 20: " << pte1->anchorAt(QPoint(0, 0)); qDebug() << "Can Paste? " << pte1->canPaste(); qDebug() << "CurCharFmt: " << pte1->currentCharFormat(); qDebug() << "Cur Rect: " << pte1->cursorRect().x() << " " << pte1->cursorRect().y(); qDebug() << "doc: " << td1->toPlainText(); qDebug() << "isUndoRedoEn? " << pte1->isUndoRedoEnabled(); -
It works with this code below!!
<
pte1 = new QPlainTextEdit("hello\r\nsdan\nhow r\nyou\nhi\nthis was him dan\r\n And\nhello\nagain \ndkd\naee\nwa\ndaf"
"\nAnd his this is a long long long text which has to cross the widget width andersonkddkdkdk show line wrap mode function to test", this);
pte1->setGeometry(10, 10, 400, 100);
pte1->setBackgroundVisible(true);
pte1->setCenterOnScroll(true);
pte1->setCursorWidth(3);
pte1->setDocumentTitle("Dan Document");
// pte1->setLineWrapMode(QPlainTextEdit::NoWrap);
// pte1->setMaximumBlockCount(10);
pte1->setOverwriteMode(false);
pte1->setPlaceholderText("Shows Status here");
pte1->setWordWrapMode(QTextOption::WordWrap);
connect(pte1, SIGNAL(cursorPositionChanged()), this, SLOT(cpc1()));pt1.setX(10); pt1.setY(4); QTextDocument *td1; td1 = pte1->document();// pte1->setUndoRedoEnabled(true);
// pte1->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::TextSelectableByKeyboard);
// pte1->setTabStopDistance(200);
// pte1->setTabChangesFocus(true);
// pte1->setPlainText("Hei Dan");
// pte1->setDocumentTitle("Hi dan doc");
// pte1->setReadOnly(true);qDebug() << "block count: " << pte1->blockCount(); qDebug() << "Doc Title: " << pte1->documentTitle(); qDebug() << "Plain Text: " << pte1->toPlainText(); qDebug() << "Anchor at 20: " << pte1->anchorAt(QPoint(0, 0)); qDebug() << "Can Paste? " << pte1->canPaste(); qDebug() << "CurCharFmt: " << pte1->currentCharFormat(); qDebug() << "Cur Rect: " << pte1->cursorRect().x() << " " << pte1->cursorRect().y(); qDebug() << "doc: " << td1->toPlainText(); qDebug() << "isUndoRedoEn? " << pte1->isUndoRedoEnabled(); -
D dan1973 has marked this topic as solved on