开发者

qt4: overriding event-handler methods of widgets created by UI editor

开发者 https://www.devze.com 2023-03-26 13:02 出处:网络
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 i

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:

  1. Add base widget in editor.
  2. Select it, rightclick and in menu look for "promote to..." item.
  3. Add your derived widget to list of promotions, and you will have your custom widget on form instead of base.
0

精彩评论

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

关注公众号