How do I use promote to in Qt Designer in pyqt4?

孤街醉人 提交于 2019-11-27 04:53:48

This allows you to use custom widgets defined elsewhere, which designer otherwise wouldn't know about.

For example, if you've defined a widget MyLabel derived from QLabel, then you can define it here and then just insert a QLabel as placeholder in your ui and promote it to MyLabel.

The uic compiler will then include the necessary imports/includes, for example if you specified mypackage/mycomponent.h as header file and MyLabel as class name, then pyuic will add

from mypackage.mycomponent import MyLabel

(note how the .h is ignored, and slashes are converted to . by pyuic to keep compatibility with python)

Global include is ignored by pyuic, it only affects uic (generate #include "mypackage/mycomponent.h" or #include <mypackage/mycomponent.h> for c++)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!