gpt4 book ai didi

c++ - Qt UI 测试:无法执行 QTest::keyPress

转载 作者:行者123 更新时间:2023-11-30 03:09:19 27 4
gpt4 key购买 nike

我有继承自 QMainWindow 的类 MyForm

这是我的代码:

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

然而,当我在其上使用 QTest::keyPress 时,我得到:

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

有什么想法吗?

最佳答案

尝试以下操作:

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

第一个参数的类型应为 QWidget* , 不是 std::auto_ptr<MyForm>* .

关于c++ - Qt UI 测试:无法执行 QTest::keyPress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4212591/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com