PDA

View Full Version : QPlainTextEdit, Read Only



metdos
10th August 2009, 09:49
This is the related code part:


while(..){
...
ui.dataTextEdit->insertPlainText(currentTime);
...
}

dataTextEdit is an instance of QPlainTextEdit
and I put the line

ui.dataTextEdit->setReadOnly(TRUE);

and while program executes if I highlight some part of lines in plainTextEdit, these lines are vanishing.

if

I put the line


ui.dataTextEdit->setTextInteractionFlags(Qt::NoTextInteraction);

then there is no problem, but I can't copy paste this time.

What is problem with read-only, I want to be enable of copy-paste but not to change text.

Thanks.

spirit
10th August 2009, 09:58
did you try to use QTextBrowser or you really need only QPlainTextEdit?

metdos
10th August 2009, 11:34
no I don't have to use QPlainTextEdit, but also I don't need rich text. Why setReadOnly(TRUE) is not working?


did you try to use QTextBrowser or you really need only QPlainTextEdit?