Home

QtState Class Reference
[QtGui module]

The QtState class describes a state with connections and properties for QObjects, QWidgets and QGraphicsItems. More...

 #include <QtState>

This class is under development and is subject to change.

Inherits QObject.

This class was introduced in qtanimationframework 4.5.

Properties

Public Functions

Public Slots

Signals

Protected Functions

Additional Inherited Members


Detailed Description

The QtState class describes a state with connections and properties for QObjects, QWidgets and QGraphicsItems.

This class is part of {The Animation Framework}.

QtState provides a convenient API for configuring properties, connections and other features related to state changes in your application. When used together with QtTransition, it also allows you to define how these values change, possibly using animations over time.

States can be independent, or part of a group of mutually exclusive states (i.e., only one state in a group can be active at any time). You can activate or deactivate a state by calling the setActive(), activate() or deactivate() slots. When the state is activated, it configures all properties and connections for that state, and it also calls the virtual enterState() and leaveState() functions, which you can reimplement in a subclass of QtState to provide custom state change logic. QtState also emits the activated() and deactivated() signals, so that you can define custom state logic in a connected slot.

See also QtTransition, QtAnimation, and The Animation Framework.


Property Documentation

active : bool

This property holds whether or not the state is active.

This property describes whether this state is active or not. You can activate a state by passing true to setActive(), or by calling activate(). A state can also become active if it's the default state of a QtStateGroup, and another state in the group is deactivated.

To deactivate a group, you can either pass false to setActive(), or call deactivate().

When a state is activated, it emits the activated() signal, and calls the virtual enterState() function. When it loses activation, it emits the deactivated() signal, and calls the virtual leaveState() function. The default implementations of enterState() and leaveState() manage the properties and connections defined for this state.

Access functions:

See also activate() and deactivate().

group : QtStateGroup *

This property holds the state's group.

This property describes the QtStateGroup that the state belongs to. If the state is not part of a group (i.e., an independent state), the group() function will return 0.

Access functions:

restoreProperties : bool

This property holds whether the state should restore previous property values when deactivated.

If restoreProperties is true, the state will store the current value of all properties it changes as the state is activated, and restore these values when the state is deactivated again. By default this value is true.

Access functions:


Member Function Documentation

QtState::QtState ( QObject * parent = 0 )

Constructs a QtState object. parent is passed to QObject's constructor.

QtState::~QtState ()   [virtual]

Destroys the QtState object.

void QtState::activate ()   [slot]

This function is equivalent to calling setActive(true).

See also deactivate() and active.

void QtState::activated ( bool active )   [signal]

QtState emits this signal when the state is either activated or deactivated. If active is true, the state is activated; otherwise, it is deactivated.

See also deactivated() and setActive().

void QtState::activated ()   [signal]

This is an overloaded member function, provided for convenience.

QtState emits this signal when the state is activated.

See also deactivated() and setActive().

void QtState::clear ()   [virtual]

Deactivates and clears the state, removing all connections and property values for all objects and items. This function has no effect on the state's group membership, its active state and any defined transitions.

If the state is active and has defined property values, these properties will also be unset in the target objects and items.

See also deactivate().

void QtState::deactivate ()   [slot]

This function is equivalent to calling setActive(false).

See also activate() and active.

void QtState::deactivated ()   [signal]

QtState emits this signal when the state is deactivated.

See also activated() and setActive().

void QtState::enterState ( QtState * fromState )   [virtual protected]

This virtual function is called when this state is activated. fromState is the previous state. If there was no previous state, fromState is 0.

The default implementation manages the properties and connections for this state.

See also leaveState().

QRectF QtState::geometry ( QGraphicsWidget * widget ) const

Returns the geometry for widget when this state is active.

See also setGeometry().

QRect QtState::geometry ( QWidget * widget ) const

This is an overloaded member function, provided for convenience.

Returns the geometry for widget when this state is active.

See also setGeometry().

void QtState::leaveState ( QtState * toState )   [virtual protected]

This virtual function is called by QtState when the state is deactivated. toState is a pointer to the next state. If there is no next state, toState is 0.

The default implementation manages the properties and connections for this state.

See also enterState().

qreal QtState::opacity ( QGraphicsItem * item ) const

Returns the opacity for item when this state is active.

See also setOpacity().

QPointF QtState::pos ( QGraphicsItem * item ) const

Returns the position for item when this state is active.

See also setPos().

QPoint QtState::pos ( QWidget * widget ) const

This is an overloaded member function, provided for convenience.

Returns the position for widget when this state is active.

See also setPos().

QVariant QtState::property ( QObject * object, const char * propertyName ) const

Returns the value that the property propertyName should have for object when this state is active.

See also setProperty() and unsetProperty().

QVariant QtState::property ( QGraphicsItem * item, const char * propertyName ) const

This is an overloaded member function, provided for convenience.

Returns the value that the property propertyName should have for item when this state is active.

See also setProperty() and unsetProperty().

void QtState::setConnectionState ( QObject * sender, const char * signal, QObject * receiver, const char * member, Qt::ConnectionType connectionType = Qt::AutoConnection )

Instructs the state to establish a connection from sender and signal to receiver and member, using connectionType, when this state is activated.

See also unsetConnectionState().

void QtState::setGeometry ( QGraphicsWidget * widget, const QRectF & geom )

Instructs the state to set the geometry of widget to geom when activated.

See also geometry().

void QtState::setGeometry ( QWidget * widget, const QRect & geom )

This is an overloaded member function, provided for convenience.

Instructs the state to set the geometry of widget to geom when activated.

See also geometry().

void QtState::setOpacity ( QGraphicsItem * item, qreal opacity )

Instructs the state to set the opacity of item to opacity when this state is activated.

See also opacity().

void QtState::setPos ( QGraphicsItem * item, const QPointF & pos )

Instructs the state to set the position of item to pos when activated.

See also pos().

void QtState::setPos ( QWidget * widget, const QPoint & pos )

This is an overloaded member function, provided for convenience.

Instructs the state to set the position of widget to pos when activated.

See also pos().

void QtState::setProperty ( QObject * object, const char * propertyName, const QVariant & value )

Instructs the state to set the property propertyName to value on object when activated.

See also property() and unsetProperty().

void QtState::setProperty ( QGraphicsItem * item, const char * propertyName, const QVariant & value )

This is an overloaded member function, provided for convenience.

Instructs the state to set the property propertyName to value on item when activated.

Although QGraphicsItem doesn't technically support properties like QObject does, this function emulates the behavior for all property-like functions in QGraphicsItem, allowing you as a user to treat the two the same way.

See also property() and unsetProperty().

void QtState::unsetConnectionState ( QObject * sender, const char * signal, QObject * receiver, const char * member )

Removes the connection from sender and signal to receiver and member for this state.

See also setConnectionState().

void QtState::unsetProperty ( QObject * object, const char * propertyName )

Removes the value of the property propertyName for object for this state. When activated, this state will no longer affect the property.

See also setProperty() and property().

void QtState::unsetProperty ( QGraphicsItem * item, const char * propertyName )

This is an overloaded member function, provided for convenience.

Removes the value of the property propertyName for item for this state. When activated, this state will no longer affect the property.

See also setProperty() and property().


Copyright © 2008 Nokia Trademarks
Qt Solutions