QT 编译时 Warning: The name 'layoutWidget' (QWidget) is already in use, defaulting to 'layoutWidget1'.

总之,是Qt Creator 的 bug. 只能用文本编辑器修改 .ui 文件来消除这个 warning.

It means that inside the .ui XML file, the element named "layoutWidget" has already been used somewhere, and the moc compiler is complaining about that, and telling you that it is changing the name to make it unique.

Open the .ui file using a text editor (*not Qt Designer*) and do a search for "layoutWidget". You should find it twice. Change the name of one to something unique, and the warning will go away.

I don't know why this happens - it is probably a bug in Qt Designer somewhere that results in a name being reused. It is harmless, but if it bothers you, find it in a text editor (or using the Qt Designer hierarchy browser) and fix it.

原文地址:https://www.cnblogs.com/liujx2019/p/14143406.html