Results 1 to 3 of 3

Thread: QPlainTextEdit, Read Only

  1. #1
    Join Date
    Jul 2009
    Posts
    39
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QPlainTextEdit, Read Only

    This is the related code part:

    Qt Code:
    1. while(..){
    2. ...
    3. ui.dataTextEdit->insertPlainText(currentTime);
    4. ...
    5. }
    To copy to clipboard, switch view to plain text mode 

    dataTextEdit is an instance of QPlainTextEdit
    and I put the line
    Qt Code:
    1. ui.dataTextEdit->setReadOnly(TRUE);
    To copy to clipboard, switch view to plain text mode 

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

    if

    I put the line

    Qt Code:
    1. ui.dataTextEdit->setTextInteractionFlags(Qt::NoTextInteraction);
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPlainTextEdit, Read Only

    did you try to use QTextBrowser or you really need only QPlainTextEdit?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jul 2009
    Posts
    39
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPlainTextEdit, Read Only

    no I don't have to use QPlainTextEdit, but also I don't need rich text. Why setReadOnly(TRUE) is not working?

    Quote Originally Posted by spirit View Post
    did you try to use QTextBrowser or you really need only QPlainTextEdit?

Similar Threads

  1. QFile can't read a file
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 20:24
  2. How to read only a certain amount of bytes
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 07:38
  3. External Lib read from QBuffer on Calback problem
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2008, 19:43
  4. How to read CD with read?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 29th June 2007, 08:20
  5. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.