简体   繁体   English

将QT表单添加到现有VS2008项目中

[英]Adding QT Form to an existing VS2008 project

I have a normal VS2008 project that I've been working on for awhile that is doing some OpenGL based stuff. 我有一个普通的VS2008项目,已经从事了一段时间,它正在做一些基于OpenGL的工作。 The main window is created with GLUT and until now that has been sufficient for my GUI. 主窗口是使用GLUT创建的,到目前为止,对于我的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. 但是,现在,我想添加一个小的按钮窗口,并且需要以跨平台的方式进行操作,因此我决定使用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). 我已经安装了包括VS加载项在内的所有QT组件,并且看起来一切正常,但是我不知道如何向我的项目中添加QT表单(因为它最初并未配置为使用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. 我真的不想在QT Creator中创建一个新项目并将所有现有代码迁移到其中,因为我已经在三个不同的平台上为此代码正确设置和配置了开发环境。 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? 是否可以通过某种方式告诉Visual Studio对.ui文件执行正确的操作,以便可以在现有项目中使用它?

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. 编辑:顺便说一句,当我说我不知道​​如何向项目中添加QT表单时,我能够添加一个表单-意味着.ui文件-单击该按钮可以打开QT设计器。 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. 它默认情况下添加了“自定义生成规则”,但命令行为空,我对qmake的了解还不足以让它为我构建.ui文件。

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

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

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

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