简体   繁体   English

Qt Creator not showing.ui 在运行时发生变化

[英]Qt Creator not showing .ui changes when run

Similar to this question: Qt Creator: Design changes not showing when run类似这个问题: Qt Creator: Design changes not showing when run

I cannot make a simple change in the UI and then see it when I run.我无法在 UI 中进行简单的更改,然后在运行时看到它。 I've tried adding a dummy label and push button.我试过添加一个虚拟 label 和按钮。 No matter how much I edit the MainWindow.ui file, I can not get the UI to change.无论我如何编辑MainWindow.ui文件,我都无法更改 UI。 The ui_MainWindow.h file also does not change. ui_MainWindow.h 文件也没有改变。 It seems like whatever is supposed to generate that file is not being run.似乎应该生成该文件的任何东西都没有运行。

I've tried cleaning before I run.我试过在跑步前打扫卫生。 I've tried unchecking the 'Shadow build' option under Projects >> Build & Run >> General >> Shadow build checkbox and then restarting Qt Creator.我尝试取消选中“项目”>>“构建与运行”>>“常规”>>“影子构建”复选框下的“影子构建”选项,然后重新启动 Qt Creator。 I've tried restarting my PC and then testing.我试过重新启动我的电脑,然后进行测试。 That damn ui_xxx file will not update!那个该死的 ui_xxx 文件不会更新!

Host OS: Windows 7, 64b Qt Creator version: 3.0.1 based on QT 5.2.1 (MSVC 2010, 32 bit), built on Jan 31 2014主机操作系统:Windows 7、64b Qt 创建者版本:3.0.1 基于 QT 5.2.1(MSVC 2010,32 位),构建于 2014 年 1 月 31 日

One reason for this buggy behavior is the Shadow build checkbox is enabled.这种错误行为的一个原因是启用了阴影构建复选框。 Click on the "Project" icon in the Qt creator, under Build-> General, uncheck Shadow build.单击 Qt 创建器中的“项目”图标,在 Build-> General 下,取消选中 Shadow build。 Rebuild again and run.再次重建并运行。

After modifying UI elements on a project what worked for me was to delete the directory: {project dir}/GeneratedFiles followed by a project rebuild.修改项目上的 UI 元素后,对我有用的是删除目录:{project dir}/GeneratedFiles,然后是项目重建。

UI elements including menu changes seem to work after deleting.包括菜单更改在内的 UI 元素在删除后似乎可以工作。 I tried the clean followed by rebuild, including unchecking the shadow build.我尝试了清理然后重建,包括取消选中阴影构建。

Qt Creator 4.11.0 Qt 创作者 4.11.0

Just had the same issue.刚刚有同样的问题。 Delete (or at least put it somewhere else) the ui_*.h file, and recompile the program.删除(或至少把它放在其他地方)ui_*.h 文件,然后重新编译程序。 It fixed for me.它为我修好了。

sk313tOn is correct. sk313tOn 是正确的。 For shadow-build delete ui_mainwindow.h in your project directory.对于 shadow-build,删除项目目录中的 ui_mainwindow.h。 Because for shadow-build the correct location of ui_mainwindow.h is the build directory.因为对于影子构建,ui_mainwindow.h 的正确位置是构建目录。 ui_mainwindow.h will be build in the build directory automatically. ui_mainwindow.h 将自动构建在构建目录中。

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

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