Results 1 to 4 of 4

Thread: a question about visualizing cursor in read-only QTextEdit

  1. #1
    Join Date
    Sep 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default a question about visualizing cursor in read-only QTextEdit

    I want to set a QTextEdit as read only, but I still want to show the cursor, how do I do that?

    Actually, I'm hoping that the QTextEdit receives key event so that only arbitrary set of characters are received and displayed in QTextEdit.That's why I set it as read only and still want the cursor visible. If QTextEdit cannot do that, any other widget can do it?

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a question about visualizing cursor in read-only QTextEdit

    If you just want to filter key events, either use a sub-classes QTestEdit or an event filter on a QTextEdit. That way you can keep it editable.

    Another way to validate user input is to use a QValidator.

  3. #3
    Join Date
    Sep 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a question about visualizing cursor in read-only QTextEdit

    Thanks.

    But it still seems that a visual cursor in a read only editor is the way to fit my requirement. I know Java can do it.

  4. #4
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a question about visualizing cursor in read-only QTextEdit

    Quote Originally Posted by kennyxing View Post
    Thanks.

    But it still seems that a visual cursor in a read only editor is the way to fit my requirement. I know Java can do it.
    And Qt can do it too. You've just been told how to solve this problem.
    Save yourself some pain. Learn C++ before learning Qt.

Similar Threads

  1. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  2. newbie question about qtextedit fields
    By otortos in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2006, 18:21
  3. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

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.