开发者

qt: intercepting tab character in QTextEdit

I am writing a small editor. I would like to change default behaviour of QTextEdit, that inserts tabs when Tab is hit. Instead I would like to put 4 spaces. What is the recommended way of doing this? I though about subclassing keyPressedEvent, but maybe there is some better开发者_StackOverflow way?


My opinion is that subclassing and overriding the keyPressEvent function is the way to go. If for whatever reason you are really adverse to subclassing you could probably use an event filter (see QObject::installEventFilter() and QObject::eventFilter()).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜