Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QWSServer Class Reference

The QWSServer class provides server-specific functionality in Qt/Embedded. More...

    #include <QWSServer>

Inherits QObject.

- List of all members, including inherited members
- Compatibility members

### Public Types

- class KeyMap
- class KeyOverride
- class KeyboardFilter
- enum GUIMode { NoGui, NormalGUI, Server }
- enum ServerFlags { DisableKeyboard, DisableMouse }
- enum WindowEvent { Create, Destroy, Hide, Show, Raise, ..., Name }

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

- QWSServer ( int flags = 0, QObject * parent = 0 )
- ~QWSServer ()
- const QList<QWSWindow *> clientWindows ()
- void closeKeyboard ()
- void closeMouse ()
- void enablePainting ( bool e )
- QWSPropertyManager * manager ()
- void openKeyboard ()
- void openMouse ()
- void refresh ()
- void refresh ( QRegion & r )
- void sendIMEvent ( IMState state, const QString & txt, int cpos, int selLen )
- QWSWindow * windowAt ( const QPoint & pos )

- 24 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- void markedText ( const QString & text )
- void newChannel ( const QString & channel )
- void removedChannel ( const QString & channel )
- void windowEvent ( QWSWindow * w, QWSServer::WindowEvent e )

- 1 signal inherited from QObject

### Static Public Members

- void addKeyboardFilter ( KeyboardFilter * f )
- bool isCursorVisible ()
- const KeyMap * keyMap ()
- QWSKeyboardHandler * keyboardHandler ()
- QWSMouseHandler * mouseHandler ()
- void removeKeyboardFilter ()
- void requestMarkedText ()
- void screenSaverActivate ( bool activate )
- bool screenSaverActive ()
- void sendKeyEvent ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )
- void setCursorVisible ( bool vis )
- void setDefaultKeyboard ( const char * k )
- void setDefaultMouse ( const char * m )
- void setDesktopBackground ( const QImage & img )
- void setDesktopBackground ( const QColor & c )
- void setKeyboardHandler ( QWSKeyboardHandler * kh )
- void setMaxWindowRect ( const QRect & r )
- void setScreenSaverInterval ( int ms )
- void setScreenSaverIntervals ( int * ms )

- 4 static public members inherited from QObject

### Protected Functions

- 9 protected functions inherited from QObject

## Detailed Description

The QWSServer class provides server-specific functionality in Qt/Embedded.

When you run a Qt/Embedded application, it either runs as a server or connects to an existing server. If it runs as a server, some additional operations are provided by this class.

This class is instantiated by QApplication for Qt/Embedded server processes. You should never construct this class yourself.

A pointer to the QWSServer instance can be obtained via the global `qwsServer` variable.

The mouse and keyboard devices can be opened with openMouse() and openKeyboard(). (Close them with closeMouse() and closeKeyboard().)

The display is refreshed with refresh(), and painting can be enabled or disabled with enablePainting().

Obtain the list of client windows with clientWindows() and find out which window is at a particular point with windowAt().

Many static functions are provided, for example, setKeyboardFilter(), setKeyboardHandler(), setDefaultKeyboard() and setDefaultMouse().

The size of the window rectangle can be set with setMaxWindowRect(), and the desktop's background can be set with setDesktopBackground().

The screen saver is controlled with setScreenSaverInterval() and screenSaverActivate().

## Member Type Documentation

### enum QWSServer::GUIMode

This determines what sort of QWS server to create:

`QWSServer::NoGui` | This is used for non-graphical Qt applications.
`QWSServer::NormalGUI` | A normal Qt/Embedded application (not the server).
`QWSServer::Server` | A Qt/Embedded server (e.g. if `-qws` has been specified on the command line.

### enum QWSServer::ServerFlags

This enum is used to pass various options to the window system server.

`QWSServer::DisableKeyboard` | Ignore all keyboard input.
`QWSServer::DisableMouse` | Ignore all mouse input.

### enum QWSServer::WindowEvent

This specifies what sort of event has occurred to a top-level window:

`QWSServer::Create` | A new window has been created (QWidget constructor).
`QWSServer::Destroy` | The window has been closed and deleted (QWidget destructor).
`QWSServer::Hide` | The window has been hidden with QWidget::hide().
`QWSServer::Show` | The window has been shown with QWidget::show() or similar.
`QWSServer::Raise` | The window has been raised to the top of the desktop.
`QWSServer::Lower` | The window has been lowered.
`QWSServer::Geometry` | The window has changed size or position.
`QWSServer::Active` | The window has become the active window (has keyboard focus).
`QWSServer::Name` | The window has been named.

## Member Function Documentation

### QWSServer::QWSServer ( int flags = 0, QObject * parent = 0 )

Construct a QWSServer object.

Warning: This class is instantiated by QApplication for Qt/Embedded server processes. You should never construct this class yourself.

The flags are used for keyboard and mouse setting. The server's parent is parent.

### QWSServer::~QWSServer ()

Destruct QWSServer

### void QWSServer::addKeyboardFilter ( KeyboardFilter * f ) `[static]`

Adds a filter f to be invoked for all key events from physical keyboard drivers (events sent via processKeyEvent()).

The filter is not invoked for keys generated by virtual keyboard drivers (events sent via sendKeyEvent()).

Keyboard filters are removed by removeKeyboardFilter().

### const QList<QWSWindow *> QWSServer::clientWindows ()

Returns the list of top-level windows. This list will change as applications add and remove wigdets so it should not be stored for future use. The windows are sorted in stacking order from top-most to bottom-most.

### void QWSServer::closeKeyboard ()

Closes keyboard device(s).

### void QWSServer::closeMouse ()

Closes the pointer device(s).

### void QWSServer::enablePainting ( bool e )

If e is true, painting on the display is enabled; if e is false, painting is disabled.

### bool QWSServer::isCursorVisible () `[static]`

Returns true if the cursor is visible; otherwise returns false.

See also setCursorVisible().

### const KeyMap * QWSServer::keyMap () `[static]`

Returns the keyboard mapping table used to convert keyboard scancodes to Qt keycodes and Unicode values. It's used by the keyboard driver in `qkeyboard_qws.cpp`.

### QWSKeyboardHandler * QWSServer::keyboardHandler () `[static]`

Returns the primary keyboard handler.

### QWSPropertyManager * QWSServer::manager ()

Returns the QWSPropertyManager, which is used for implementing X11-style window properties.

### void QWSServer::markedText ( const QString & text ) `[signal]`

This signal is emitted whenever some text is selected. The selection is passed in text.

### QWSMouseHandler * QWSServer::mouseHandler () `[static]`

Returns the primary mouse handler.

### void QWSServer::newChannel ( const QString & channel ) `[signal]`

This signal is emitted when the QCopChannel channel is created.

### void QWSServer::openKeyboard ()

Opens the keyboard device(s).

### void QWSServer::openMouse ()

Opens the mouse device(s).

### void QWSServer::refresh ()

Refreshes the entire display.

### void QWSServer::refresh ( QRegion & r )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Refreshes the region r.

### void QWSServer::removeKeyboardFilter () `[static]`

Removes and deletes the most-recently added filter. The caller is responsible for matching each addition with a corresponding removal.

### void QWSServer::removedChannel ( const QString & channel ) `[signal]`

This signal is emitted immediately after the QCopChannel channel is destroyed. Note that a channel is not destroyed until all its listeners have unregistered.

### void QWSServer::requestMarkedText () `[static]`

Asks for the marked text of the current input widget. If there is a current input widget, and it has marked text, and it supports the request, the server will emit the markedText() signal at a later time (ie. asynchronously).

### void QWSServer::screenSaverActivate ( bool activate ) `[static]`

If activate is true the screensaver is activated immediately; if activate is false the screensaver is deactivated.

### bool QWSServer::screenSaverActive () `[static]`

Returns true if the screensaver is active (i.e. the screen is blanked); otherwise returns false.

### void QWSServer::sendIMEvent ( IMState state, const QString & txt, int cpos, int selLen )

This function sends an input method event to the server. The current state is passed in state and the current text in txt. The cursor's position in the text is given by cpos, and the selection length (which could be 0) is given in selLen.

### void QWSServer::sendKeyEvent ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) `[static]`

Send a key event. You can use this to send key events generated by "virtual keyboards". unicode is the Unicode value of the key to send, keycode the Qt keycode (e.g. `Qt::Key_Left`), modifiers indicates whether, Shift/Alt/Ctrl keys are pressed, isPress is true if this is a key down event and false if it's a key up event, and autoRepeat is true if this is an autorepeat event (i.e. the user has held the key down and this is the second or subsequent key event being sent).

### void QWSServer::setCursorVisible ( bool vis ) `[static]`

If vis is true, makes the cursor visible; if vis is false, makes the cursor invisible.

See also isCursorVisible().

### void QWSServer::setDefaultKeyboard ( const char * k ) `[static]`

Set the keyboard driver to k, e.g. if `$QWS_KEYBOARD` is not defined. The default is platform-dependent.

### void QWSServer::setDefaultMouse ( const char * m ) `[static]`

Set the mouse driver m to use if `$QWS_MOUSE_PROTO` is not defined. The default is platform-dependent.

### void QWSServer::setDesktopBackground ( const QImage & img ) `[static]`

Sets the image img to be used as the background in the absence of obscuring windows.

### void QWSServer::setDesktopBackground ( const QColor & c ) `[static]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the color c to be used as the background in the absence of obscuring windows.

### void QWSServer::setKeyboardHandler ( QWSKeyboardHandler * kh ) `[static]`

Sets the primary keyboard handler to kh.

### void QWSServer::setMaxWindowRect ( const QRect & r ) `[static]`

Sets the area of the screen which Qt/Embedded applications will consider to be the maximum area to use for windows to r.

See also QWidget::showMaximized().

### void QWSServer::setScreenSaverInterval ( int ms ) `[static]`

Sets the timeout for the screensaver to ms milliseconds. A setting of zero turns off the screensaver.

### void QWSServer::setScreenSaverIntervals ( int * ms ) `[static]`

Sets an array of timeouts for the screensaver to a list of ms milliseconds. A setting of zero turns off the screensaver. The array must be 0-terminated.

### QWSWindow * QWSServer::windowAt ( const QPoint & pos )

Returns the window containing the point pos or 0 if there is no window under the point.

### void QWSServer::windowEvent ( QWSWindow * w, QWSServer::WindowEvent e ) `[signal]`

This signal is emitted whenever something happens to a top-level window (e.g. it's created or destroyed). w is the window to which the event of type e has occurred.