如何将 Phonon VideoPlayer 添加到 QtDesigner 表单?
我可以在 MainWindow 构造函数中将播放器对象添加到我的 UI 布局中,但如何使用小部件容器作为占位符,以便在 QtDesigner 中设置 VideoPlayer 的属性和布局?
I can add a player object to my UI layout in the MainWindow constructor, but how do I use the widget container as a placeholder so I set properties and layout for the VideoPlayer in QtDesigner?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终的做法是将 VideoPlayer 子类化为我自己的类,然后在占位符小部件中提升该类。
此时,尝试连接到占位符小部件中的插槽会导致 QTCreator 崩溃,因此我通过标准代码进行连接(wgtPlayer 是占位符小部件):
How I did it in the end was subclass the VideoPlayer as my own class then promote that class in the placeholder widget.
At this time trying to connect to slots in the placeholder widget crashes QTCreator so instead I connected via standard code (wgtPlayer is placeholder widget):
您是否刚刚尝试在创建 Videoplayer 时将占位符小部件添加为 Videoplayer 构造函数中的父级?
例如
Did you just try adding the placeholder widget as the parent in the constructor for the Videoplayer when you create it?
e.g.