简体   繁体   English

将菜单栏添加到QT cvNameWIndow

[英]Adding Menu bar to QT cvNameWIndow

I am trying to create video-player application with open CV using QT creator. 我正在尝试使用QT创建者创建具有开放CV的视频播放器应用程序。 using openCV it is possible to play video files by adding each video frame as an image on an instance of cvNamedWindow. 使用openCV可以通过将每个视频帧添加为cvNamedWindow实例上的图像来播放视频文件。

Now I would like to add a menu bar to this cvNamedWindow so that I can add File, help etc menus. 现在我想为这个cvNamedWindow添加一个菜单栏,以便我可以添加文件,帮助等菜单。 menus. 菜单。 I looked up the documentation of cvNamedWindow and I couldn't find any clue. 我查了cvNamedWindow的文档,我找不到任何线索。 Any suggestions? 有什么建议么?

Ps In opencv windows created using QMainWindow, it is straightforwaed to add menu bar. Ps在使用QMainWindow创建的opencv窗口中,可以直接添加菜单栏。 But what I want is to add the menu bar to cvNamedWindow not to a window created using QMainWindow. 但我想要的是将菜单栏添加到cvNamedWindow而不是使用QMainWindow创建的窗口。

OpenCV's user interface is quite limited, so there's no way to accomplish what you are looking for with OpenCV's API. OpenCV的用户界面非常有限,因此无法通过OpenCV的API实现您的目标。

On the other hand, Qt has a rich API for building graphic applications. 另一方面,Qt拥有丰富的API来构建图形应用程序。 Luckily for you, I just shared cvVideo: an example that demonstrates how to play videos on a QWidget surface . 幸运的是,我刚刚分享了cvVideo:一个演示如何在QWidget表面上播放视频的示例 Plus, the demo has some neat tricks to change aspect ratio modes . 此外,该演示有一些巧妙的技巧来改变宽高比模式 Almost forgot, it displays a simple QMenuBar too. 几乎忘了,它也显示了一个简单的QMenuBar

you can use createButton and createTrackbar with namedWindow, but that's it. 你可以使用带有namedWindow的createButton和createTrackbar,但就是这样。

sure, you could simulate a menu with a row of buttons, but if you need something more advanced, stick to the native Qt api. 当然,你可以用一排按钮模拟一个菜单,但如果你需要更高级的东西,坚持使用原生的Qt api。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM