如何使用QPlainTextEdit处理按键事件 [英] How to handle key press events with the QPlainTextEdit

查看:1772
本文介绍了如何使用QPlainTextEdit处理按键事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在QT开发大概一个星期,很高兴地说,我真的很快收拾起来。我是一名中级C ++程序员,但挑选QT的一些部分证明是具有挑战性的。当用户按下Enter键时,我需要处理来自QPlainTextEdit的按键事件,并且我认为该解决方案将涉及对该小部件进行子类化。你可以任何聪明的人给我一个潜在的可实现的解决方案?

I've been developing with QT for around a week now and am pleased to say that I'm picking it up really fast. I'm an intermediate C++ programmer but picking up some parts of QT is proving to be challenging. I need to process key press events from the QPlainTextEdit when the user presses enter and I presume that the solution will involve sub classing the widget. Can any of you smart guys give me a potential implementable solution?

推荐答案

要真正了解Qt和事件处理,有两个关键领域您应该阅读的文档。第一个是事件系统的概述,第二个是该网页上的一个非常重要的位置是 QCoreApplication的隐藏链接::通知。他们应该真的把它移动到事件系统文档的主页,因为它真的使事情相当清楚(至少对我来说)。

To really understand Qt and event handling there are two key areas of the documentation you should read. The first is the overview on The Event System and the second is a very important bit which is a cleverly hidden link on that page for QCoreApplication::notify. They should really move that to the main page of the Event System documentation as it really makes things quite clear (to me at least).

这篇关于如何使用QPlainTextEdit处理按键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆