I wrote new class inherited from QTextEdit and have keypressevent inside my class called "MyTextEdit.cpp"

Now I want to use this in other class called "MyEditor.cpp", so i created an object of MyTextEdit class and set the setReadOnly() property to false. But it not allow me to write in textedit. I also set it to setEnabled() to true. But still facing same issue.

I think i am missing something or made some silly mistake.

Can anyone let me know what i am doing wrong here.