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. Text checker (based on criteria)
Forum Updated to NodeBB v4.3 + New Features

Text checker (based on criteria)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 781 Views 1 Watching
  • 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.
  • O Offline
    O Offline
    ogrishmania
    wrote on last edited by
    #1

    I just want some opinions on what is the best way to implements this. As I'm a newbie to Qt I don't know all that Qt can offer. I searched the web to no avail.
    Example of usage: I paste text into the program, click check (checking on some criteria) and then it tells me where and what is the problem, ideally it colors the words that are bad.
    QTextEdit? How do I find specific words, color them and replace them?
    I need some ideas please.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      Yes, QTextEdit is the right component to start with. For the formatting, look at the documentation what QTextCursor and QTextDocument can do (especially QTextCursor::setCharFormat).
      With the text cursor, you could also do the iterating e.g. over words. Alternatively you could get the plain text as a QString (QTextEdit::toPlainText) and analyze that.

      In general, the Qt Documentation is great for actually learning about functionality.

      //EDIT: A thing that often confuses beginners: the QTextCursor in text documents is not to be understood as the graphical bar that blinks on the user's screen. It is the programmatic interface to the text structure and formatting that – in function and usage concept – resembles the text cursor paradigm.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ogrishmania
        wrote on last edited by
        #3

        Thank you for your swift response. I will check the documentation. I just wanted to know if it's the right component to start with.

        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