qt4: overriding event-handler methods of widgets created by UI editor
I would like to know if it is possible to override methods like paintEvent or mousePressEvent, for example, for widgets that were开发者_运维知识库n't created programmatically but in UI editor.
There is no difference between widget created programmaticaly and created with UI editor. If you want to add your custom widget derived from base widget in editor, do the following:
- Add base widget in editor.
- Select it, rightclick and in menu look for "promote to..." item.
- Add your derived widget to list of promotions, and you will have your custom widget on form instead of base.
精彩评论