简体   繁体   中英

Qt UI testing : Can't perform QTest::keyPress

I have class MyForm which inherited from QMainWindow .

Here's my code:

std::auto_ptr<MyForm> pForm(new MyForm(3,3));
QTest::keyPress(&pForm, Qt::Key_0);

However when I use QTest::keyPress on it, I'm getting:

error: no matching function for call to keyPress(std::auto_ptr*, Qt::Key)

Any ideas?

Try the following:

QTest::keyPress(pForm.get(), Qt::Key_0);

The first argument should have type QWidget* , not std::auto_ptr<MyForm>* .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM