将QT Form添加到现有的VS2008项目中

发布于 2024-09-16 02:59:19 字数 503 浏览 1 评论 0原文

我有一个正常的 VS2008 项目,我已经工作了一段时间,它正在做一些基于 OpenGL 的东西。主窗口是用 GLUT 创建的,到目前为止,这对于我的 GUI 来说已经足够了。

然而,现在我想添加一个小窗口的按钮,并且我需要以跨平台的方式完成它,所以我决定使用QT。我已经安装了所有 QT 组件,包括 VS 插件,一切似乎都工作正常,但我不知道如何将 QT 表单添加到我的项目中(因为它最初并未配置为使用 QT) 。我真的不想在 QT Creator 中创建一个新项目并将所有现有代码迁移到其中,因为我已经在三个不同平台上为此代码库正确设置和配置了开发环境。有没有什么方法可以告诉 Visual Studio 对 .ui 文件做正确的事情,以便我可以在现有项目中使用它?

编辑:顺便说一下,当我说我不知道​​如何向项目添加 QT 表单时,我可以添加一个表单(即 .ui 文件),单击该表单会打开 QT 设计器。我不知道该怎么做就是让它编译。它默认添加了一个“自定义构建规则”,但命令行是空白的,而且我对 qmake 的了解不够,无法让它为我构建 .ui 文件。

I have a normal VS2008 project that I've been working on for awhile that is doing some OpenGL based stuff. The main window is created with GLUT and until now that has been sufficient for my GUI.

Now, however, I want to add a small window of buttons, and I need to do it in a cross platform way, so I decided to use QT. I've installed all of the QT components including the VS add-in and everything seems to work fine, but I can't figure out how to add a QT form to my project (since it wasn't originally configured to use QT). I really don't want to create a new project in QT Creator and migrate all of my existing code into it, since I already have development environments set up and configured correctly for this code base on three different platforms. Is there some way to tell visual studio to just do the right thing with the .ui file so I can use it in my existing project?

EDIT: By the way, when I say I can't figure out how to add a QT form to the project, I am able to add a form--meaning a .ui file--that when clicked on opens the QT designer. What I can't figure out how to do is make it compile. It has a "custom build rule" added by default, but the command line is blank, and I don't know enough about qmake to get it to build the .ui file for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

暮色兮凉城 2024-09-23 02:59:26

我使用这些行作为自定义构建规则(其中 $QTDIR 是 Qt 安装的位置):

"$(QTDIR)\bin\uic.exe" -o ".\tmp\ui_$(InputName).h" "$(InputPath)"

I use these line as custom build rule (where $QTDIR is the location of your Qt installation):

"$(QTDIR)\bin\uic.exe" -o ".\tmp\ui_$(InputName).h" "$(InputPath)"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文