I'm using Qt Creator with Qt4. That's what I use to compile, build, and design the interface. This is in C++.
I have a simple problem. When I try to call setDocument on a QPlainTextEdit, it will compile, but during runtime, when I open a file it says:
QPlainTextEdit::setDocument: Document set does not support QPlainTextDocumentLayout
QPlainTextEdit::setDocument: Document set does not support QPlainTextDocumentLayout
To copy to clipboard, switch view to plain text mode
Here's the snippet of code that does this:
void CodeView
::loadFile(QString filename
) {
document.setPlainText(text);
ui->plainTextEdit->setDocument(&document);
}
file.close();
}
void CodeView::loadFile(QString filename)
{
QFile file(filename);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString text = file.readAll();
QTextDocument document;
document.setPlainText(text);
ui->plainTextEdit->setDocument(&document);
}
file.close();
}
To copy to clipboard, switch view to plain text mode
If I call the setPlainText method on my QTextDocument, should it not already be in QPlainTextDocumentLayout?
Thanks,
Jordy
Bookmarks