Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to have unselectable portion of text in QTextEdit/QTextDocument?
Forum Updated to NodeBB v4.3 + New Features

How to have unselectable portion of text in QTextEdit/QTextDocument?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 362 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pullo
    wrote on last edited by
    #1

    Suppose I have text like this in QTextEdit:
    This is sample text
    The word "sample" should be treated as if it was 1 single character, i.e. when I try to select it either all the characters in the word should be selected or none. Same when I navigate the document with left/right keys, the cursor should believe that the whole word is one single atomic item, i.e. if the cursor is at the end of the word, pressing left should jump to the beginning of the word and vice versa. Backspace should delete the whole item.

    The best thing I could think of is to generate an image with that word on the fly and insert it in the right position, but this feels very hacky, I wonder if there is a better way of doing this?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved