Please nominate your Qt Champions for 2021!

QTextEdit and EditEvent

  • Hi i need help with QTextEdit, i want make smart QTextEdit who know if it was edited (insert, delete some chars), so i want reimplement class QTextEdit and add :

    • bool verbal "isEdited" - its done
    • event who will by know if somting was edit in my QTextEdit

    #ifndef MYTEXTEDIT_H
    #define MYTEXTEDIT_H

    #include <QtGui>
    #include <QtCore>

    class MyTextEdit : public QTextEdit
    explicit MyTextEdit(QWidget *parent);

    bool isEdited;

    public slots:



    #endif // MYTEXTEDIT_H
    #include "mytextedit.h"

    MyTextEdit::MyTextEdit(QWidget *parent)
    setParent( parent );
    isEdited = false;

    I try write somting with use KeyEvent but if sombody select and delete or past with the help of mouse then my QTextEdit will by dont konow about this edit.
    Coud you help me with that ??

  • Moderators

    Are you using the textChanged() signal?

  • Srry i didnt see this signal in manual.
    Thx for help

Log in to reply