Question

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?

Was it helpful?

Solution

Try the following:

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top