在Eclipse中设计一个Qt + OpenGL应用程序 [英] Designing a Qt + OpenGL application in Eclipse

查看:156
本文介绍了在Eclipse中设计一个Qt + OpenGL应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中使用OpenGL和Qt为UI启动一个C ++项目。我想创建一个UI,其中窗口的一部分包含一个用于OpenGL渲染的框架,其余的将包含其他Qt小部件,如按钮等。



我没有在eclipse中使用Qt或GUI编辑器,我想知道最好的方法是什么?我应该通过手工编码创建UI,或者更容易使用eclipse的GUI设计器 - 我有一个快速的看看这里,似乎没有一个内置的OpenGL小部件。



感谢

解决方案

如果您使用Qt Designer(我认为可以通过Eclipse集成)放置一个基本的QWidget在布局,然后提升该小部件到一个QGLWidget。要执行此操作:


  1. 将QWidget添加到布局中所需的位置

  2. 右键单击

  3. 选择促销至

  4. 输入QGLWidget作为类名和标题
  5. >点击添加
  6. 从对话框顶部的宣传窗口小部件列表中选择QGLWidget

  7. >

这样,您不必通过占位符路径创建额外的图层。 p>

I'm starting a C++ project using OpenGL and Qt for the UI in eclipse. I would like to create a UI where a portion of the window contains a frame for OpenGL rendering and the rest would contain other Qt widgets such as buttons and so on.

I haven't used Qt or the GUI editor in eclipse before and I'm wondering what the best approach would be? Should I create the UI by hand coding or would it be easier to use eclipse's GUI designer - I had a quick look at this and there doesn't seem to be an OpenGL widget built in.

Thanks

解决方案

If you are using Qt Designer (which I think is available via Eclipse Integration), you can place a base QWidget in the layout and then "promote" that widget to a QGLWidget. To do this:

  1. Add the QWidget to the desired place in the layout
  2. Right-click on the widget
  3. Select "Promote To"
  4. Enter QGLWidget as the class name and as the header
  5. Hit Add
  6. Select the QGLWidget from the list of promoted widgets at the top of the dialog
  7. Hit Promote

This way you don't have to go through the placeholder route and create an additional layer.

这篇关于在Eclipse中设计一个Qt + OpenGL应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆