简体   繁体   English

Qt 4.5.3 QEvent :: EnterEditFocus

[英]Qt 4.5.3 QEvent::EnterEditFocus

In Qt docs EnterEditFocus is a event about an editor widget gaining focus for editing but using Qt 4.5.3 the compilation fails with 'EnterEditFocus' is not a member of 'QEvent'. 在Qt docs中,EnterEditFocus是有关编辑器小部件获得焦点进行编辑的事件,但是使用Qt 4.5.3编译失败,因为“ EnterEditFocus”不是“ QEvent”的成员。 What's wrong? 怎么了?

If Idan's suggestion doesn't work, note that QEvent::EnterEditFocus isn't defined unless you built Qt with QT_KEYPAD_NAVIGATION defined. 如果Idan的建议不起作用,请注意,除非您使用定义的QT_KEYPAD_NAVIGATION构建Qt,否则不会定义QEvent :: EnterEditFocus。 Refer to the following documentation: 请参阅以下文档:

http://doc.qt.io/archives/4.6/qapplication.html#keypadNavigationEnabled http://doc.qt.io/archives/4.6/qapplication.html#keypadNavigationEnabled

You probably forgot to include QEvent . 您可能忘记了包含QEvent

Most of Qt classes are forward declared, try adding: 大多数Qt类都是前向声明的,请尝试添加:

#include <QtCore/QEvent>

Look at the following quote from qt documentation on keypad navigation. 请参阅有关键盘导航的qt文档中的以下引用。 It sounds like this feature is deprecated or preferably used on embedded platforms: 听起来好像不推荐使用此功能,或者最好在嵌入式平台上使用此功能:

bool QApplication::keypadNavigationEnabled () [static]
This function is deprecated. 不推荐使用此功能。 Returns true if Qt is set to use keypad navigation; 如果Qt设置为使用键盘导航,则返回true;否则,返回true。 otherwise returns false. 否则返回false。 The default value is true on Symbian, but false on other platforms. 默认值在Symbian上为true,在其他平台上为false。 This feature is available in Qt for Embedded Linux, Symbian and Windows CE only. Qt仅在嵌入式Linux,Symbian和Windows CE中可用。 Note: On Windows CE this feature is disabled by default for touch device mkspecs. 注意:在Windows CE上,触摸设备mkspecs默认禁用此功能。 To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. 要启用键盘导航,请使用定义的QT_KEYPAD_NAVIGATION构建Qt。 See also navigationMode(). 另请参见navigationMode()。

this might make more sense if you are aware that in the source code for the QEvent::Type there is the following: 如果您知道QEvent :: Type的源代码中包含以下内容,则这可能更有意义:


#ifdef QT_KEYPAD_NAVIGATION
EnterEditFocus = 150, // enter edit mode in keypad navigation
LeaveEditFocus = 151, // enter edit mode in keypad navigation
#endif

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM