简体   繁体   中英

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'. 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. Refer to the following documentation:

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

You probably forgot to include QEvent .

Most of Qt classes are forward declared, try adding:

#include <QtCore/QEvent>

Look at the following quote from qt documentation on keypad navigation. 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; otherwise returns false. The default value is true on Symbian, but false on other platforms. This feature is available in Qt for Embedded Linux, Symbian and Windows CE only. Note: On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. See also navigationMode().

this might make more sense if you are aware that in the source code for the QEvent::Type there is the following:


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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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