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

QFocusEvent Class Reference

The QFocusEvent class contains event parameters for widget focus events. More...

#include <QFocusEvent>

Inherits QEvent.

Public Types

Writable Properties

Public Functions

Static Public Members


Detailed Description

The QFocusEvent class contains event parameters for widget focus events.

Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler.

The event handlers QWidget::focusInEvent() and QWidget::focusOutEvent() receive focus events.

Use setReason() to set the reason for all focus events, and resetReason() to reset the reason for all focus events to the previously defined reason before the last setReason() call.

See also QWidget::setFocus() and QWidget::setFocusPolicy().


Member Type Documentation

enum QFocusEvent::Reason

This enum specifies why the focus changed.

QFocusEvent::MouseA mouse action occurred.
QFocusEvent::TabThe Tab key was pressed.
QFocusEvent::BacktabA Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
QFocusEvent::ActiveWindowThe window system made this window either active or inactive.
QFocusEvent::PopupThe application opened/closed a popup that grabbed/released the keyboard focus.
QFocusEvent::ShortcutA keyboard shortcut was input.
QFocusEvent::OtherAnother reason, usually application-specific.

See the keyboard focus overview for more about the keyboard focus.


Member Function Documentation

QFocusEvent::QFocusEvent ( Type type )

Constructs a focus event object.

The type parameter must be either QEvent::FocusIn or QEvent::FocusOut.

QFocusEvent::~QFocusEvent ()

bool QFocusEvent::gotFocus () const

Returns true if the widget received the text input focus; otherwise returns false.

bool QFocusEvent::lostFocus () const

Returns true if the widget lost the text input focus; otherwise returns false.

Reason QFocusEvent::reason ()   [static]

Returns the reason for this focus event.

See also setReason().

void QFocusEvent::resetReason ()   [static]

Resets the reason for all future focus events to the value before the last setReason() call.

See also reason() and setReason().

void QFocusEvent::setReason ( Reason reason )   [static]

Sets the reason for all future focus events to reason.

See also reason() and resetReason().


Copyright © 2004 Trolltech Trademarks
Qt 4.0.0-b1