Qt:Документация 4.3.2/qwskeyboardhandler
Материал из Wiki.crossplatform.ru
Внимание: Актуальная версия перевода документации находится здесь |
__NOTOC__
Главная · Все классы · Основные классы · Классы по группам · Модули · Функции |
[править] QWSKeyboardHandler Class Reference
[модуль QtGui ]
The QWSKeyboardHandler class is a base class for keyboard drivers in Qtopia Core. Далее...
#include <QWSKeyboardHandler>
[править] Открытые функции
- QWSKeyboardHandler ()
- virtual ~QWSKeyboardHandler ()
- virtual void processKeyEvent ( int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat )
[править] Защищенные функции
- void beginAutoRepeat ( int unicode, int keycode, Qt::KeyboardModifiers modifier )
- void endAutoRepeat ()
- int transformDirKey ( int keycode )
[править] Подробное описание
The QWSKeyboardHandler class is a base class for keyboard drivers in Qtopia Core.
Note that this class is only available in Qtopia Core.
Qtopia Core provides ready-made drivers for several keyboard protocols, see the character input documentation for details. Custom keyboard drivers can be implemented by subclassing the QWSKeyboardHandler class and creating a keyboard driver plugin (derived from QKbdDriverPlugin). Qtopia Core's implementation of the QKbdDriverFactory class will automatically detect the plugin, and load the driver into the server application at runtime using Qt's plugin system.
The keyboard driver receives keyboard events from the system device and encapsulates each event with an instance of the QWSEvent class which it then passes to the server application (the server is responsible for propagating the event to the appropriate client). To receive keyboard events, a QWSKeyboardHandler object will usually create a QSocketNotifier object for the given device. The QSocketNotifier class provides support for monitoring activity on a file descriptor. When the socket notifier receives data, it will call the keyboard driver's processKeyEvent() function to send the event to the Qtopia Core server application for relaying to clients.
QWSKeyboardHandler also provides functions to control auto-repetion of key sequences, beginAutoRepeat() and endAutoRepeat(), and the transformDirKey() function enabling transformation of arrow keys according to the display orientation.
See also QKbdDriverPlugin, QKbdDriverFactory, and Qtopia Core Character Input.
[править] Описание функций-членов
[править] QWSKeyboardHandler::QWSKeyboardHandler ()
Constructs a keyboard driver.
Call the QWSServer::setKeyboardHandler() function to make the newly created keyboard driver, the primary driver. Note that the primary driver is controlled by the system, i.e., the system will delete it upon exit.
[править] QWSKeyboardHandler::~QWSKeyboardHandler () [virtual]
Destroys this keyboard driver.
Do not call this function if this driver is the primary keyboard handler, i.e., if QWSServer::setKeyboardHandler() function has been called passing this driver as argument. The primary keyboard driver is deleted by the system.
[править] void QWSKeyboardHandler::beginAutoRepeat ( int unicode, int keycode, Qt::KeyboardModifiers modifier ) [protected]
Begins auto-repeating the specified key press; after a short delay the key press is sent periodically until the endAutoRepeat() function is called.
The key press is specified by its unicode, keycode and modifier state.
See also endAutoRepeat() and processKeyEvent().
[править] void QWSKeyboardHandler::endAutoRepeat () [protected]
Stops auto-repeating a key press.
See also beginAutoRepeat() and processKeyEvent().
[править] void QWSKeyboardHandler::processKeyEvent ( int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat ) [virtual]
Sends a key event to the Qtopia Core server application.
The key event is identified by its unicode value and the keycode, modifiers, isPress and autoRepeat parameters.
The keycode parameter is the Qt keycode value as defined by the Qt::Key enum. The modifiers is an OR combination of Qt::KeyboardModifier values, indicating whether Shift/Alt/Ctrl keys are pressed. The isPress parameter is true if the event is a key press event and autoRepeat is true if the event is caused by an auto-repeat mechanism and not an actual key press.
See also beginAutoRepeat(), endAutoRepeat(), and transformDirKey().
[править] int QWSKeyboardHandler::transformDirKey ( int keycode ) [protected]
Transforms the arrow key specified by the given keycode, to the orientation of the display and returns the transformed keycode.
The keycode is a Qt::Key value. The values identifying arrow keys are:
See also processKeyEvent().
Copyright © 2007 Trolltech | Trademarks | Qt 4.3.2
|