slightly customized widget for PyQt4 with qtdesigner

▼魔方 西西 提交于 2019-12-11 08:09:01

问题


I am creating an application with PyQt4 and I want to use qtDesigner to design the layout. The application contains a QGraphicView, for which I want to implement panning and zomming per mouse. The only way I know how to do that is deriving from QGraphicView overwriting the "mouse*" functions to do the panning and zooming.

Now I want to use this new custom widget with qtdesigner.

googling I find that I could write a "custom widget plugin" for qtdesigner. While it does not seem to be to difficult, I still find it overkill for such a little adjustment I want to make.

What other ways are there to customize a widget in PyQt4 when the layout is done with qdesigner?

Thanks!


回答1:


You can promote your QGraphicsView to your own subclass In the designer, right click on the QGraphicsView and select "Promote To" and fill the dialog with relevant information about your own subclass:



来源:https://stackoverflow.com/questions/6350593/slightly-customized-widget-for-pyqt4-with-qtdesigner

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