如何将 Phonon VideoPlayer 添加到 QtDesigner 表单?

发布于 2024-09-14 12:11:28 字数 101 浏览 3 评论 0原文

我可以在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心安伴我暖 2024-09-21 12:11:28

我最终的做法是将 VideoPlayer 子类化为我自己的类,然后在占位符小部件中提升该类。

此时,尝试连接到占位符小部件中的插槽会导致 QTCreator 崩溃,因此我通过标准代码进行连接(wgtPlayer 是占位符小部件):

connect(ui->btnPlay, SIGNAL(clicked()), ui->wgtPlayer, SLOT(play()));
connect(ui->btnStop, SIGNAL(clicked()), ui->wgtlayer, SLOT(stop()));

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):

connect(ui->btnPlay, SIGNAL(clicked()), ui->wgtPlayer, SLOT(play()));
connect(ui->btnStop, SIGNAL(clicked()), ui->wgtlayer, SLOT(stop()));
终陌 2024-09-21 12:11:28

您是否刚刚尝试在创建 Videoplayer 时将占位符小部件添加为 Videoplayer 构造函数中的父级?

例如

VideoPlayer v* = new VideoPlayer(Phonon::VideoCategory, ui->someWidget); 

Did you just try adding the placeholder widget as the parent in the constructor for the Videoplayer when you create it?

e.g.

VideoPlayer v* = new VideoPlayer(Phonon::VideoCategory, ui->someWidget); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文