每当你新键一个 QT设计界面, QT会自动生成yyy.ui文件,如

<?xml version="1.0" encoding="UTF-8"?>

<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
 </widget>
 <resources/>
 <connections/>
</ui>

 

注意到 name = "Form" ;默认都是这个名字,本人就是照搬mainwindow中的代码才导致这个错误,肤浅啊。

当你在你的头文件中引用此界面时,

创建一个命名空间如

namespace Ui {
class xxx;
}

这里的XXX应与.ui文件中的name一致,否则就会导致如标题如述错误.

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-12-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-21
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
相关资源
相似解决方案