문제

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>*.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top