【发布时间】:2015-05-19 20:43:46
【问题描述】:
我的代码是
class ExampleTest : public QObject
{
Q_OBJECT
public:
ExampleTest() {}
private Q_SLOTS:
void DoAllExampleTests();
};
void ExampleTest::DoAllExampleTests()
{
QProcess p;
p.start( "cmd /c wmic path Win32_usbcontrollerdevice|grep VID_1004" );
qDebug() << "Here 1";
QVERIFY( TRUE == p.waitForFinished() );
qDebug() << "Here 2";
}
QTEST_APPLESS_MAIN(ExampleTest);
我在 Here 1 和 Here 2 之间收到一个 qwarn
QObject::startTimer: Timers can only be used with threads started with QThread
我从QObject::startTimer: Timers can only be used with threads started with QThread 了解到,当我对 Qt 类进行子类化时,子类的成员之一不是 Qt 层次结构的一部分。我有从 QObject 继承的 ExampleTest 类,但我仍然收到警告。如何避免这个警告?
【问题讨论】:
标签: c++ qt unit-testing oop