如何在 Qt5 中将表单类从 UI 转移到另一个文件夹

Posted

技术标签:

【中文标题】如何在 Qt5 中将表单类从 UI 转移到另一个文件夹【英文标题】:How in Qt5 to transfer the form class from the UI to another folder 【发布时间】:2019-08-14 04:05:37 【问题描述】:

将三个文件(h、cpp、ui)传输到另一个目录时,出现错误。

:-1: error: dependent 'enterserialnumber.ui' does not exist.

Default project.

【问题讨论】:

【参考方案1】:

确保更改您的 PRO 文件并删除那些不需要的文件。(#DELETE 标记要删除的文件,因为它们在该位置不再存在。

SOURCES += \
     form.cpp \#DELETE
       form/form.cpp \
     main.cpp \
      mainwindow.cpp

HEADERS += \
        form.h \ #DELETE
        form/form.h \
        mainwindow.h

FORMS += \
     form.ui \#DELETE
       form/form.ui \
     mainwindow.ui

然后运行 ​​qmake 并重建。你应该很高兴。

编码愉快!

【讨论】:

以上是关于如何在 Qt5 中将表单类从 UI 转移到另一个文件夹的主要内容,如果未能解决你的问题,请参考以下文章