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:
Qt Code:
  1. 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:
Qt Code:
  1. void CodeView::loadFile(QString filename)
  2. {
  3. QFile file(filename);
  4. if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
  5. QString text = file.readAll();
  6. QTextDocument document;
  7. document.setPlainText(text);
  8. ui->plainTextEdit->setDocument(&document);
  9. }
  10. file.close();
  11. }
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