#ifndef CUSTOMTEXTEDIT_H #define CUSTOMTEXTEDIT_H #include class CustomTextEdit : public QTextEdit { Q_OBJECT public: explicit CustomTextEdit(QObject *parent = 0); int getMaxLength(); public slots: void setMaxLength(int length); protected: /*virtual void keyPressEvent(QKeyEvent *e); void insertFromMimeData(const QMimeData* source);*/ private: int maxLength; private slots: void truncateText(); }; #endif // CUSTOMTEXTEDIT_H