---
name: "SoQtSpaceball"
section: "3"
platform: "linux"
package: "libsoqt-dev-common"
version: "1.4.2~svn20090224-3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/SoQtSpaceball"
---

# SoQtSpaceball(3)

The SoQtSpaceball class is the spaceball input device abstraction. The SoQtSpaceball class is the glue between native spaceball handling and how those events translates to generic events for the Inventor API scenegraph.

## NAME

SoQtSpaceball -

The **SoQtSpaceball** class is the spaceball input device abstraction.

The **SoQtSpaceball** class is the glue between native spaceball handling and how those events translates to generic events for the Inventor API scenegraph.

## SYNOPSIS

`#include <Inventor/Qt/devices/SoQtSpaceball.h>`

Inherits **SoQtDevice**.

### Public Types

enum **Mask** { **MOTION\_EVENT** =  0x01, **MOTION** =  MOTION\_EVENT, **PRESS\_EVENT** =  0x02, **PRESS** =  PRESS\_EVENT, **RELEASE\_EVENT** =  0x04, **RELEASE** =  RELEASE\_EVENT, **ALL\_EVENTS** =  MOTION\_EVENT \| PRESS\_EVENT \| RELEASE\_EVENT, **ALL** =  ALL\_EVENTS }\
 enum **DeviceType** { **SPACE\_BALL** =  0x01, **MAGELLAN\_SPACE\_MOUSE** =  0x02 }\

### Public Member Functions

virtual SoType **getTypeId** (void) const \
 **SoQtSpaceball** (int events=ALL\_EVENTS)\
 virtual **~SoQtSpaceball** ()\
 virtual void **enable** (QWidget \*widget, SoQtEventHandler \*handler, void \*closure)\
 virtual void **disable** (QWidget \*widget, SoQtEventHandler \*handler, void \*closure)\
 virtual const SoEvent \* **translateEvent** (QEvent \*event)\
 void **setRotationScaleFactor** (float f)\
 float **getRotationScaleFactor** (void) const \
 void **setTranslationScaleFactor** (float f)\
 float **getTranslationScaleFactor** (void) const \
 void **setFocusToWindow** (SbBool flag)\
 SbBool **isFocusToWindow** (void) const \

### Static Public Member Functions

static void **initClass** (void)\
 static SoType **getClassTypeId** (void)\
 static void \* **createInstance** (void)\
 static SbBool **exists** (void)\

## Detailed Description

The **SoQtSpaceball** class is the spaceball input device abstraction.

The **SoQtSpaceball** class is the glue between native spaceball handling and how those events translates to generic events for the Inventor API scenegraph.

## Member Enumeration Documentation

### enum SoQtSpaceball::Mask Enumeration of spaceball input device event types.

### enum SoQtSpaceball::DeviceType Enumeration of spaceball input device types.

## Constructor & Destructor Documentation

### SoQtSpaceball::SoQtSpaceball (int mask = `ALL_EVENTS`) Public constructor. The *mask* argument specifies which events we are interested in.

### SoQtSpaceball::~SoQtSpaceball ()` [virtual]` Destructor.

## Member Function Documentation

### void SoQtSpaceball::initClass (void)` [static]` Sets up initialization for data common to all instances of this class, submitting necessary information to the internal SoQt type system.

Reimplemented from **SoQtDevice**.

### SoType SoQtSpaceball::getClassTypeId (void)` [static]` This static method returns the SoType object associated with objects of this class.

Reimplemented from **SoQtDevice**.

### SoType SoQtSpaceball::getTypeId (void) const` [virtual]` Returns the type identification of an object derived from a class inheriting SoQtObject. This is used for run-time type checking and 'downward' casting.

Usage example:

```
  void foo(SoQtViewer * comp)
  {
    if (comp->getTypeId() == SoQtExaminerViewer::getClassTypeId()) {
      // safe downward cast, knows the type
      SoQtExaminerViewer * exviewer = (SoQtExaminerViewer *)comp;
    }
    else if (comp->getTypeId().isOfType(SoQtFlyViewer::getClassTypeId())) {
      // safe downward cast, knows the type
      SoQtFlyViewer * flyviewer = (SoQtFlyViewer *)comp;
      // then something else
    }
  }
```

Reimplemented from **SoQtDevice**.

### void SoQtSpaceball::enable (QWidget \* widget, SoQtEventHandler \* handler, void \* closure)` [virtual]` This method will enable the device for the widget.

*handler* is invoked with the *closure* argument when an event occur in *widget*.

Implements **SoQtDevice**.

### void SoQtSpaceball::disable (QWidget \* widget, SoQtEventHandler \* handler, void \* closure)` [virtual]` This method will disable the handler for the device.

Implements **SoQtDevice**.

### const SoEvent \* SoQtSpaceball::translateEvent (QEvent \* event)` [virtual]` This method translates from native events to Open Inventor SoEvent events.

Implements **SoQtDevice**.

### void SoQtSpaceball::setRotationScaleFactor (float f) This method sets the scale factor for the spaceball rotation vectors.

### float SoQtSpaceball::getRotationScaleFactor (void) const This method returns the scale factor for the spaceball rotation vectors.

### void SoQtSpaceball::setTranslationScaleFactor (float f) This method sets the scale factor for the spaceball translation vectors.

### float SoQtSpaceball::getTranslationScaleFactor (void) const This method returns the scale factor for the spaceball translation vectors.

### SbBool SoQtSpaceball::exists (void)` [static]` Returns `TRUE` iff there could be a device of this type available on the system.

Note that a return value of `TRUE` does *not* signify that there is such a device active.

Referenced by SoQtRenderArea::afterRealizeHook().

### void SoQtSpaceball::setFocusToWindow (SbBool flag) Set to `TRUE` if you want spaceball events to be received even when the component does not have focus.

### SbBool SoQtSpaceball::isFocusToWindow (void) const Returns whether or not spaceball events are caught even when the component does not have focus.

## Author

Generated automatically by Doxygen for SoQt from the source code.
