Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickReplaceSignalHandler Class Reference

\qmltype PropertyChanges \inqmlmodule QtQuick More...

+ Inheritance diagram for QQuickReplaceSignalHandler:
+ Collaboration diagram for QQuickReplaceSignalHandler:

Public Member Functions

 QQuickReplaceSignalHandler ()
 
 ~QQuickReplaceSignalHandler ()
 
EventType type () const override
 
void execute () override
 
bool isReversable () override
 
void reverse () override
 
void saveOriginals () override
 
bool needsCopy () override
 
void copyOriginals (QQuickStateActionEvent *other) override
 
void rewind () override
 
void saveCurrentValues () override
 
bool mayOverride (QQuickStateActionEvent *other) override
 
- Public Member Functions inherited from QQuickStateActionEvent
virtual ~QQuickStateActionEvent ()
 
virtual bool isRewindable ()
 
virtual void saveTargetValues ()
 
virtual bool changesBindings ()
 
virtual void clearBindings ()
 

Public Attributes

QQmlProperty property
 
QQmlRefPointer< QQmlBoundSignalExpressionexpression
 
QQmlRefPointer< QQmlBoundSignalExpressionreverseExpression
 
QQmlRefPointer< QQmlBoundSignalExpressionrewindExpression
 

Additional Inherited Members

- Public Types inherited from QQuickStateActionEvent
enum  EventType { Script , SignalHandler , ParentChange , AnchorChanges }
 

Detailed Description

\qmltype PropertyChanges \inqmlmodule QtQuick

Describes new property bindings or values for a state.

PropertyChanges is used to define the property values or bindings in a \l State. This enables an item's property values to be changed when it \l {Qt Quick States}{changes between states}.

To create a PropertyChanges object, bind to properties of the target item like you would bind to local properties. This way you can define the new property values or bindings. For example:

\codeline

Item {
id: container
width: 300; height: 300
Rectangle {
id: rect
width: 100; height: 100
color: "red"
MouseArea {
id: mouseArea
anchors.fill: parent
}
states: State {
name: "resized"; when: mouseArea.pressed
PropertyChanges {
rect {
color: "blue"
height: container.height
}
}
}
}
}

When the mouse is pressed, the \l Rectangle changes to the resized state. In this state, the PropertyChanges object sets the rectangle's color to blue and the height value to that of container.height.

Note this automatically binds rect.height to container.height in the resized state. If a property binding should not be established, and the height should just be set to the value of container.height at the time of the state change, set the \l explicit property to true.

A PropertyChanges object can also override the default signal handler for an object to implement a signal handler specific to the new state:

\qml PropertyChanges { myMouseArea.onClicked: doSomethingDifferent() } \endqml

Note
PropertyChanges can be used to change anchor margins, but not other anchor values; use AnchorChanges for this instead. Similarly, to change an \l Item's \l {Item::}{parent} value, use ParentChange instead.

Definition at line 117 of file qquickpropertychanges.cpp.

Constructor & Destructor Documentation

◆ QQuickReplaceSignalHandler()

QQuickReplaceSignalHandler::QQuickReplaceSignalHandler ( )
inline

Definition at line 120 of file qquickpropertychanges.cpp.

◆ ~QQuickReplaceSignalHandler()

QQuickReplaceSignalHandler::~QQuickReplaceSignalHandler ( )
inline

Definition at line 121 of file qquickpropertychanges.cpp.

Member Function Documentation

◆ copyOriginals()

void QQuickReplaceSignalHandler::copyOriginals ( QQuickStateActionEvent * other)
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 145 of file qquickpropertychanges.cpp.

References other(), reverseExpression, and saveCurrentValues().

+ Here is the call graph for this function:

◆ execute()

void QQuickReplaceSignalHandler::execute ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 130 of file qquickpropertychanges.cpp.

References QQmlRefPointer< T >::data(), expression, property, and QQmlPropertyPrivate::setSignalExpression().

+ Here is the call graph for this function:

◆ isReversable()

bool QQuickReplaceSignalHandler::isReversable ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 134 of file qquickpropertychanges.cpp.

◆ mayOverride()

bool QQuickReplaceSignalHandler::mayOverride ( QQuickStateActionEvent * other)
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 161 of file qquickpropertychanges.cpp.

References other(), and property.

+ Here is the call graph for this function:

◆ needsCopy()

bool QQuickReplaceSignalHandler::needsCopy ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 144 of file qquickpropertychanges.cpp.

◆ reverse()

void QQuickReplaceSignalHandler::reverse ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 135 of file qquickpropertychanges.cpp.

References QQmlRefPointer< T >::data(), property, reverseExpression, and QQmlPropertyPrivate::setSignalExpression().

+ Here is the call graph for this function:

◆ rewind()

void QQuickReplaceSignalHandler::rewind ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 154 of file qquickpropertychanges.cpp.

References QQmlRefPointer< T >::data(), property, rewindExpression, and QQmlPropertyPrivate::setSignalExpression().

+ Here is the call graph for this function:

◆ saveCurrentValues()

void QQuickReplaceSignalHandler::saveCurrentValues ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 157 of file qquickpropertychanges.cpp.

References property, rewindExpression, and QQmlPropertyPrivate::signalExpression().

Referenced by copyOriginals(), and saveOriginals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOriginals()

void QQuickReplaceSignalHandler::saveOriginals ( )
inlineoverridevirtual

Reimplemented from QQuickStateActionEvent.

Definition at line 139 of file qquickpropertychanges.cpp.

References reverseExpression, rewindExpression, and saveCurrentValues().

+ Here is the call graph for this function:

◆ type()

EventType QQuickReplaceSignalHandler::type ( ) const
inlineoverridevirtual

Member Data Documentation

◆ expression

QQmlRefPointer<QQmlBoundSignalExpression> QQuickReplaceSignalHandler::expression

◆ property

◆ reverseExpression

QQmlRefPointer<QQmlBoundSignalExpression> QQuickReplaceSignalHandler::reverseExpression

Definition at line 127 of file qquickpropertychanges.cpp.

Referenced by copyOriginals(), reverse(), and saveOriginals().

◆ rewindExpression

QQmlRefPointer<QQmlBoundSignalExpression> QQuickReplaceSignalHandler::rewindExpression

Definition at line 128 of file qquickpropertychanges.cpp.

Referenced by rewind(), saveCurrentValues(), and saveOriginals().


The documentation for this class was generated from the following file: