【发布时间】:2017-09-25 22:08:38
【问题描述】:
我正在尝试为我的项目创建单元测试,但与 costumn 小部件有困难。
在编译测试单元时,ui_mainwindow.h 再也找不到我的widget.h。
我的项目结构如下:
Project
scr
scr.pro
scr.pri
mainwindow.ui
CostumnWidgets
widget.h
test
test.pro
在 Qt-Designer 中,我使用 ./CostumnWidgets/widget.h 引用我的小部件
scr.pri
QT += core gui
TEMPLATE = app
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += $$PWD/mainwindow.cpp \
$$PWD/CostumnWidgets/widget.cpp
HEADERS += $$PWD/mainwindow.h \
$$PWD/CostumnWidgets/widget.h
FORMS += $$PWD/mainwindow.ui
test.pro
TARGET = Test
include(../scr/scr.pri)
QT += widgets
QT += testlib
SOURCES += $$PWD/test.cpp
如何在不将我的 CostumnWidget 文件夹复制到我的测试目录的情况下解决这个问题? 谢谢!
【问题讨论】:
-
尝试添加到.pro文件
INCLUDEPATH += <your path>。顺便说一句,你的意思是 custom 小部件吗?
标签: qt widget qt-designer