Results 1 to 2 of 2

Thread: QTextEdit's textChanged() signal

  1. #1
    Join Date
    Aug 2008
    Posts
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QTextEdit's textChanged() signal

    I want to know whether the user had changed the content of QTextEdit. However, this signal is also emited when formatting is applied, while the content had nothing changed in fact. both of the fellowing ways are failed, I don't know how to solve this problem! Any help is appreciated!
    Qt Code:
    1. m_pText = new QTextEdit(this);
    2. connect(m_pText->document(),SIGNAL(contentsChanged()),this,SLOT(slot_setModified()));
    3. //or this way
    4. connect(m_pText,SIGNAL(textChanged()),this,SLOT(slot_setModified()));
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextEdit's textChanged() signal

    "Formatting" as you understand it changes the contents of the document as well. There is HTML (or Qt rich text, to be exact) under the hood so changing formatting changes the document. If you want content highlighting that doesn't cause document contents to change, use QPlainTextEdit and QSyntaxHighlighter (you can use QTextEdit too, the main idea is to force the content to be plain-text only and do highlighting using QSyntaxHighlighter).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. textChanged vs textEdited
    By Raccoon29 in forum Newbie
    Replies: 4
    Last Post: 27th March 2008, 17:01
  2. Subclassing QLineEdit and suppress signal textChanged
    By Lykurg in forum Qt Programming
    Replies: 2
    Last Post: 15th February 2008, 17:40
  3. Replies: 6
    Last Post: 17th January 2008, 23:46
  4. No such signal QLineEdit::textChanged(QString&)
    By zorro68 in forum Qt Programming
    Replies: 4
    Last Post: 14th November 2007, 19:35
  5. textChanged signal issue
    By chaosgeorge in forum Qt Programming
    Replies: 3
    Last Post: 9th November 2006, 00:32

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.