Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML TextArea/TexteEdit map the index of string from formatted to basic form

QML TextArea/TexteEdit map the index of string from formatted to basic form

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 143 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.
  • C Offline
    C Offline
    cebuger
    wrote on last edited by
    #1

    in QML TextEdit or TextArea, we can format or style a text either HTML or Markdown, the non formatted text can be accesed by TextArea.text but the formatted text can be accessed by getFormattedText().

    I want to know how to get which index in the non formatted text is equivalent for the formatted text, this is important when say, If I select a text in the formatted view, i want to change its markdown in the non formatted view. There seems to not have a method for this.

    example, in formatted view a string with "1\n2\n3\n4" which means every line there is a text, is equivalent to "1\n\n2\n\n3\n\n" or a bold text like in formatted "text" is equivalent to "text" in non formatted.

    So if i have a string "the quick brown fox" where the word "quick" is bold, it is represented in the non formated text (TextArea.text) as "the quick brown fox", now the string index of fox is
    index 16 in the formatted text but it is index 20 in the non formatted text.

    Is there an efficient way to access this?

    Any idea or suggestion?

    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