单击鼠标时不调用 Qt 重载鼠标事件处理程序
我正在使用我自己的名为 chessCV 的类编写一个国际象棋程序,该类派生自 QGraphicsView ,然后我将其作为成员添加到我的 MainWindow 类中。我似乎无法让程序执行我重载的 MousePressEvent(QMouseEvent * event)
函数。它永远不会被调用。我想这可能与我从 QGraphicsView 继承的方式有关,但我尝试在 MainWindow 类中重载 MousePressEvent(QMouseEvent * event)
,但这不是被称为。我完全被难住了。任何帮助表示赞赏。谢谢大家。
I am writing a chess program using my own class called chessCV, which is derived from QGraphicsView
, and then I am adding it to my MainWindow class as a member. I cannot seem to get the program to execute the MousePressEvent(QMouseEvent * event)
function, which I overloaded. It never gets called. I thought maybe it had to do with the way that I inherited from QGraphicsView
, but I tried overloading the MousePressEvent(QMouseEvent * event)
in the MainWindow class, and that is not being called either. I am completely stumped. Any help is appreciated. Thanks everyone.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试重载
QGraphicsView::mousePressEvent(QMouseEvent* event)
,则 m 不应大写。If you are trying to overload
QGraphicsView::mousePressEvent(QMouseEvent* event)
, the m should not be capitalized.