Classes - Annotated - Tree - Functions - Home - Structure

QTabletEvent Class Reference

The QTabletEvent class contains parameters that describe a Tablet event. More...

#include <qevent.h>

Inherits QEvent.

List of all member functions.

Public Members


Detailed Description

The QTabletEvent class contains parameters that describe a Tablet event.

Tablet Events are generated from a Wacom(c) tablet. Most of the time you will want to deal with events from the tablet as if they were events from a mouse. However, there are times when you may want the extra information given by the tablet device driver, for example, adjusting color brightness based on pressure. QTabletEvent allows you to get the position, pressure, X and Y tilt, and what type of device you are using (stylus, eraser, puck, etc.).

A tablet event contains a special accept flag that indicates whether the receiver wants the event. You should call QTabletEvent::accept() if you handle the wheel event; otherwise it will be sent to the parent widget.

The QWidget::setEnable() function can be used to enable or disable mouse and keyboard events for a widget.

The event handler QWidget::tabletEvent() receives tablet events.


Member Type Documentation

QTabletEvent::TabletDevices

This enum defines what type of device is generating the event.


Member Function Documentation

QTabletEvent::QTabletEvent ( const QPoint & pos, int device, int pressure, int xTilt, int yTilt )

Constructs a tablet event object.

The globalPos() is initialized to QCursor::pos(), i.e. pos, which is usually (but not always) correct. Use the other constructor if you need to specify the global position explicitly. device contains the TabletDevice, pressure contains the pressure exerted on the device, xTilt and yTilt contain the device's degrees of tilt from the X and Y axis respectively.

See also pos(), device(), pressure(), xTilt() and yTilt().

QTabletEvent::QTabletEvent ( const QPoint & pos, const QPoint & globalPos, int device, int pressure, int xTilt, int yTilt )

Constructs a tablet event object. The position when the event occurred is is given in pos and globalPos. device contains the device type, pressure contains the pressure exerted on the device, xTilt and yTilt contain the device's degrees of tilt from the X and Y axis respectively.

On Irix, /a globalPos will contain the high-res coordinates received from the tablet device driver, instead of from the windowing system.

See also pos(), globalPos(), device(), pressure(), xTilt() and yTilt().

void QTabletEvent::accept ()

Sets the accept flag of the tablet event object.

Setting the accept parameter indicates that the receiver of the event wants the wheel event. Unwanted wheel events are sent to the parent widget.

the accept flag is set by default.

See also ignore().

TabletDevices QTabletEvent::device () const

Returns the type of device that generated the event. Useful if you want one end of the pen to do something different than the other.

const QPoint & QTabletEvent::globalPos () const

Returns global position of the device at the time of the event. This is important on asynchronous windows systems like X11; whenever you move your widgets around in response to mouse events, globalPos() can differ a lot from the current position QCursor::pos().

See also globalX() and globalY().

int QTabletEvent::globalX () const

Returns the global X position of the mouse pointer at the time of the event.

See also globalY() and globalPos().

int QTabletEvent::globalY () const

Returns the global Y position of the mouse pointer at the time of the event.

See also globalX() and globalPos().

void QTabletEvent::ignore ()

Clears the accept flag parameter of the wheel event object.

Clearing the accept parameter indicates that the event receiver does not want the wheel event. Unwanted wheel events are sent to the parent widget.

The accept flag is set by default.

See also accept().

int QTabletEvent::isAccepted () const

Returns TRUE if the receiver of the event handles the wheel event; otherwise returns FALSE.

const QPoint & QTabletEvent::pos () const

Returns the position of the device, relative to the widget that received the event.

If you move widgets around in response to mouse events, use globalPos() instead of this function.

See also x(), y() and globalPos().

int QTabletEvent::pressure () const

Returns the pressure that is exerted on the device. This number is a value from 0 (no pressure) to 255 (maximum pressure). This is true regardless of how many pressure levels the underlying hardware supports.

int QTabletEvent::x () const

Returns the X position of the device, relative to the widget that received the event.

See also y() and pos().

int QTabletEvent::xTilt () const

Returns the difference from the perpendicular in the X Axis. Positive values are towards the tablet physical right; range is from -60 to +60 degrees.

See also yTilt().

int QTabletEvent::y () const

Returns the Y position of the device, relative to the widget that received the event.

See also x() and pos().

int QTabletEvent::yTilt () const

Returns the difference from the perpendicular in the Y Axis. Positive values are toward the bottom of the tablet; range is from -60 to +60 degrees.

See also xTilt().


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.


Copyright © 2001 TrolltechTrademarks
Qt version 3.0.0-beta2