1

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?

NG_
  • 6,895
  • 7
  • 45
  • 67
Owen
  • 4,063
  • 17
  • 58
  • 78

1 Answers1

3

Try the following:

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

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

vitaut
  • 49,672
  • 25
  • 199
  • 336