Qt Creator problem. UI changes not showing when pr

2020-06-19 03:09发布

I'm making changes to a form in Creator but when I build the changes are not being "refreshed". I've gone so far as to remove every element from the form and get rid of every stylesheet but when I build the project I get the same result; as if I had never made a change at all. What gives? Am I missing something obvious? (obvious to everyone but me.. obviously)

8条回答
贪生不怕死
2楼-- · 2020-06-19 03:44

This thread is a little dated but since I got caught up in the same problem I thought I would share how I resolved this. I've been incrementally building up a ui with designer under QtCreator 2.4.1/Qt 4.8.1 using a poor man's source control approach: snapshots. At one point I inadvertently created a non-shadowed build project. In a subsequent snapshot I reverted the project back to shadow build and at that point new widgets added in the ui form were no longer being recognized in the build. Solution: Delete stale ui_.h files from the source directory. Delete make and ui_.h files from your shadaow build directory. Rebuild Latest generated ui_.h files will reappear in the shadow build directory. No copies of ui_.h files appear in the source directory indicating that the stale files were taking precedence in the build order. Not obvious.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2020-06-19 03:48

I guess you're using QtCreator 2.0? I found the same strange issue. You have two options:

  • Remove the ui_{the_name_of_design}.h from the project's build dir. Then run qmake again.
  • make clean or Build → Rebuild All

But the second option even doesn't help with me. By the way that's why is good to use a different build dir than that where the sources are. If some changes don't appear to be applied, just delete the content of build dir, and everything goes fine as well.

Cheers

查看更多
登录 后发表回答