Qt-UI文件未在Visual Studio中更新 [英] Qt - UI Files Not Updating in Visual Studio

查看:33
本文介绍了Qt-UI文件未在Visual Studio中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用Qt(某种速成课程)并将其与Visual Studio集成(如

I recently started working with Qt (sort of a crash course) and integrated it with Visual Studio (as described here), and now for some reason the files don't appear to be updating with my saved .ui file after making the changes in the Qt Designer.

文件保存正确(如果我在Visual Studio中单击它,则显示添加的组件),但是在"ui_MainForm.h"文件中未引用任何添加的组件.我在保存过程中错过了应该重新编译该UI头文件的步骤吗?

The file is saving correctly (if I click on it in Visual Studio, it shows the added components), but none of the added components are referenced in the "ui_MainForm.h" file. Is there a step I missed somewhere along the lines of saving that should have recompiled that UI header file?

我也不确定这是否有所不同,但是在解决方案资源管理器中,生成的文件旁边有一个红色图标,如下所示:

I'm also not sure if this makes a difference or not, but the generated files have a red icon next to them in the solution explorer as so:

推荐答案

更改MainForm.ui文件后,ui_MainForm.h文件不会自动更新.

The ui_MainForm.h file does not get updated automatically as soon as you change the MainForm.ui file.

仅当您开始编译项目时,.ui文件才会被编译为.h文件.如果您想更新.h文件,例如为了IntelliSense,您应该能够右键单击.ui文件,然后单击编译".这将运行uic.exe,然后您将更新.h文件.

Only when you start to compile your project, the .ui file will be compiled into the .h file. If you want to update the .h file, e.g. for the sake of IntelliSense, you should be able to right click the .ui file and click "Compile". This runs uic.exe and you will have your .h file updated by that.


正如 rcmadruga Summer Sun 所指出的那样,有时有时需要通过选择菜单项 Project-> Rescan Solution 来另外更新您的IntelliSense数据库.>随Visual Studio 2010一起引入.


As pointed out by rcmadruga and Summer Sun, it is sometimes necessary to additionally update your IntelliSense database by selecting the menu entry Project->Rescan Solution which was introduced with Visual Studio 2010.

这篇关于Qt-UI文件未在Visual Studio中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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