Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickBoundaryRule Class Reference

#include <qquickboundaryrule_p.h>

+ Inheritance diagram for QQuickBoundaryRule:
+ Collaboration diagram for QQuickBoundaryRule:

Public Types

enum  OvershootFilter { None , Peak }
 

Signals

void enabledChanged ()
 
void minimumChanged ()
 
void minimumOvershootChanged ()
 
void maximumChanged ()
 
void maximumOvershootChanged ()
 
void overshootScaleChanged ()
 
void currentOvershootChanged ()
 
void peakOvershootChanged ()
 
void overshootFilterChanged ()
 
void easingChanged ()
 
void returnDurationChanged ()
 
void returnedToBounds ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QQuickBoundaryRule (QObject *parent=nullptr)
 Defines a restriction on the range of values that can be set on a numeric property.
 
 ~QQuickBoundaryRule ()
 
void setTarget (const QQmlProperty &) override
 Set the target property for the value interceptor.
 
void write (const QVariant &value) override
 This method will be called when a new value is assigned to the property being intercepted.
 
bool enabled () const
 \qmlproperty bool Qt.labs.animation::BoundaryRule::enabled
 
void setEnabled (bool enabled)
 
qreal minimum () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::minimum
 
void setMinimum (qreal minimum)
 
qreal minimumOvershoot () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::minimumOvershoot
 
void setMinimumOvershoot (qreal minimum)
 
qreal maximum () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::maximum
 
void setMaximum (qreal maximum)
 
qreal maximumOvershoot () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::maximumOvershoot
 
void setMaximumOvershoot (qreal maximum)
 
qreal overshootScale () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::overshootScale
 
void setOvershootScale (qreal scale)
 
qreal currentOvershoot () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::currentOvershoot
 
qreal peakOvershoot () const
 \qmlproperty qreal Qt.labs.animation::BoundaryRule::peakOvershoot
 
OvershootFilter overshootFilter () const
 \qmlproperty enumeration Qt.labs.animation::BoundaryRule::overshootFilter
 
void setOvershootFilter (OvershootFilter overshootFilter)
 
Q_INVOKABLE bool returnToBounds ()
 \qmlmethod bool Qt.labs.animation::BoundaryRule::returnToBounds
 
QEasingCurve easing () const
 \qmlsignal Qt.labs.animation::BoundaryRule::returnedToBounds()
 
void setEasing (const QEasingCurve &easing)
 
int returnDuration () const
 \qmlproperty int Qt.labs.animation::BoundaryRule::returnDuration
 
void setReturnDuration (int duration)
 
void classBegin () override
 Invoked after class creation, but before any properties have been set.
 
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlPropertyValueInterceptor
 QQmlPropertyValueInterceptor ()
 Constructs a QQmlPropertyValueInterceptor.
 
virtual ~QQmlPropertyValueInterceptor ()
 
virtual bool bindable (QUntypedBindable *bindable, QUntypedBindable target)
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 

Properties

bool enabled
 
qreal minimum
 
qreal minimumOvershoot
 
qreal maximum
 
qreal maximumOvershoot
 
qreal overshootScale
 
qreal currentOvershoot
 
qreal peakOvershoot
 
OvershootFilter overshootFilter
 
QEasingCurve easing
 
int returnDuration
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

Definition at line 29 of file qquickboundaryrule_p.h.

Member Enumeration Documentation

◆ OvershootFilter

Enumerator
None 
Peak 

Definition at line 51 of file qquickboundaryrule_p.h.

Constructor & Destructor Documentation

◆ QQuickBoundaryRule()

QQuickBoundaryRule::QQuickBoundaryRule ( QObject * parent = nullptr)

Defines a restriction on the range of values that can be set on a numeric property.

\qmltype BoundaryRule

! \nativetype QQuickBoundaryRule \inqmlmodule Qt.labs.animation

Since
5.14

A BoundaryRule defines the range of values that a particular property is allowed to have. When an out-of-range value would otherwise be set, it applies "resistance" via an easing curve.

For example, the following BoundaryRule prevents DragHandler from dragging the Rectangle too far:

import QtQuick
import Qt.labs.animation
Rectangle {
id: root
width: 170; height: 120
color: "green"
DragHandler {
id: dragHandler
yAxis.minimum: -1000
xAxis.minimum: -1000
onActiveChanged: if (!active) xbr.returnToBounds();
}
BoundaryRule on x {
id: xbr
minimum: -50
maximum: 100
minimumOvershoot: 40
maximumOvershoot: 40
}
}

Note that a property cannot have more than one assigned BoundaryRule.

See also
{Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation#Behaviors}{Behavior example}, {Qt Qml}, {Qt Quick Examples - Pointer Handlers}

Definition at line 117 of file qquickboundaryrule.cpp.

◆ ~QQuickBoundaryRule()

QQuickBoundaryRule::~QQuickBoundaryRule ( )

Definition at line 123 of file qquickboundaryrule.cpp.

Member Function Documentation

◆ classBegin()

void QQuickBoundaryRule::classBegin ( )
overridevirtual

Invoked after class creation, but before any properties have been set.

Implements QQmlParserStatus.

Definition at line 450 of file qquickboundaryrule.cpp.

◆ componentComplete()

void QQuickBoundaryRule::componentComplete ( )
overridevirtual

Invoked after the root component that caused this instantiation has completed construction.

At this point all static values and binding values have been assigned to the class.

Implements QQmlParserStatus.

Definition at line 455 of file qquickboundaryrule.cpp.

◆ currentOvershoot()

qreal QQuickBoundaryRule::currentOvershoot ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::currentOvershoot

This property holds the amount by which the most recently set value of the intercepted property exceeds \l maximum or is less than \l minimum.

It is positive if the property value exceeds \l maximum, negative if the property value is less than \l minimum, or 0 if the property value is within both boundaries.

Definition at line 296 of file qquickboundaryrule.cpp.

◆ currentOvershootChanged

void QQuickBoundaryRule::currentOvershootChanged ( )
signal

◆ easing()

QEasingCurve QQuickBoundaryRule::easing ( ) const

\qmlsignal Qt.labs.animation::BoundaryRule::returnedToBounds()

This signal is emitted when \l currentOvershoot returns to 0 again, after the \l maximum or \l minimum constraint has been violated. If the return is animated, the signal is emitted when the animation completes.

See also
returnDuration, returnToBounds()

\qmlproperty enumeration Qt.labs.animation::BoundaryRule::easing

This property holds the easing curve to be applied in overshoot mode (whenever the \l minimum or \l maximum constraint is violated, while the value is still within the respective overshoot range).

The default easing curve is \l QEasingCurve::OutQuad.

Definition at line 410 of file qquickboundaryrule.cpp.

◆ easingChanged

void QQuickBoundaryRule::easingChanged ( )
signal

◆ enabled()

bool QQuickBoundaryRule::enabled ( ) const

\qmlproperty bool Qt.labs.animation::BoundaryRule::enabled

This property holds whether the rule will be enforced when the tracked property changes value.

By default a BoundaryRule is enabled.

Definition at line 139 of file qquickboundaryrule.cpp.

◆ enabledChanged

void QQuickBoundaryRule::enabledChanged ( )
signal

◆ maximum()

qreal QQuickBoundaryRule::maximum ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::maximum

This property holds the largest unconstrained value that the property is allowed to have. If the property is set to a larger value, it will be constrained by \l easing and \l maximumOvershoot.

The default is 1.

Definition at line 213 of file qquickboundaryrule.cpp.

◆ maximumChanged

void QQuickBoundaryRule::maximumChanged ( )
signal

◆ maximumOvershoot()

qreal QQuickBoundaryRule::maximumOvershoot ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::maximumOvershoot

This property holds the amount that the property is allowed to be more than \l maximum. Whenever the value is greater than \l maximum and less than {maximum + maximumOvershoot}, it is constrained by the \l easing curve. When the value attempts to exceed {maximum + maximumOvershoot} there is a hard stop.

The default is 0.

Definition at line 239 of file qquickboundaryrule.cpp.

◆ maximumOvershootChanged

void QQuickBoundaryRule::maximumOvershootChanged ( )
signal

◆ minimum()

qreal QQuickBoundaryRule::minimum ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::minimum

This property holds the smallest unconstrained value that the property is allowed to have. If the property is set to a smaller value, it will be constrained by \l easing and \l minimumOvershoot.

The default is 0.

Definition at line 163 of file qquickboundaryrule.cpp.

◆ minimumChanged

void QQuickBoundaryRule::minimumChanged ( )
signal

◆ minimumOvershoot()

qreal QQuickBoundaryRule::minimumOvershoot ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::minimumOvershoot

This property holds the amount that the property is allowed to be less than \l minimum. Whenever the value is less than \l minimum and greater than {minimum - minimumOvershoot}, it is constrained by the \l easing curve. When the value attempts to go under {minimum - minimumOvershoots} there is a hard stop.

The default is 0.

Definition at line 189 of file qquickboundaryrule.cpp.

◆ minimumOvershootChanged

void QQuickBoundaryRule::minimumOvershootChanged ( )
signal

◆ overshootFilter()

QQuickBoundaryRule::OvershootFilter QQuickBoundaryRule::overshootFilter ( ) const

\qmlproperty enumeration Qt.labs.animation::BoundaryRule::overshootFilter

This property specifies the aggregation function that will be applied to the intercepted property value.

If this is set to BoundaryRule.None (the default), the intercepted property will hold a value whose overshoot is limited to \l currentOvershoot. If this is set to BoundaryRule.Peak, the intercepted property will hold a value whose overshoot is limited to \l peakOvershoot.

Definition at line 331 of file qquickboundaryrule.cpp.

◆ overshootFilterChanged

void QQuickBoundaryRule::overshootFilterChanged ( )
signal

◆ overshootScale()

qreal QQuickBoundaryRule::overshootScale ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::overshootScale

This property holds the amount by which the \l easing is scaled during the overshoot condition. For example if an Item is restricted from moving more than 100 pixels beyond some limit, and the user (by means of some Input Handler) is trying to drag it 100 pixels past the limit, if overshootScale is set to 1, the user will succeed: the only effect of the easing curve is to change the rate at which the item moves from overshoot 0 to overshoot

  1. But if it is set to 0.5, the BoundaryRule provides resistance such that when the user tries to move 100 pixels, the Item will only move 50 pixels; and the easing curve modulates the rate of movement such that it may move in sync with the user's attempted movement at the beginning, and then slows down, depending on the shape of the easing curve.

The default is 0.5.

Definition at line 271 of file qquickboundaryrule.cpp.

◆ overshootScaleChanged

void QQuickBoundaryRule::overshootScaleChanged ( )
signal

◆ peakOvershoot()

qreal QQuickBoundaryRule::peakOvershoot ( ) const

\qmlproperty qreal Qt.labs.animation::BoundaryRule::peakOvershoot

This property holds the most-positive or most-negative value of \l currentOvershoot that has been seen, until \l returnToBounds() is called.

This can be useful when the intercepted property value is known to fluctuate, and you want to find and react to the maximum amount of overshoot rather than to the fluctuations.

See also
overshootFilter

Definition at line 314 of file qquickboundaryrule.cpp.

◆ peakOvershootChanged

void QQuickBoundaryRule::peakOvershootChanged ( )
signal

◆ returnDuration()

int QQuickBoundaryRule::returnDuration ( ) const

\qmlproperty int Qt.labs.animation::BoundaryRule::returnDuration

This property holds the amount of time in milliseconds that \l returnToBounds() will take to return the target property to the nearest bound. If it is set to 0, returnToBounds() will set the property immediately rather than creating an animation job.

The default is 100 ms.

Definition at line 435 of file qquickboundaryrule.cpp.

◆ returnDurationChanged

void QQuickBoundaryRule::returnDurationChanged ( )
signal

◆ returnedToBounds

void QQuickBoundaryRule::returnedToBounds ( )
signal

◆ returnToBounds()

bool QQuickBoundaryRule::returnToBounds ( )

\qmlmethod bool Qt.labs.animation::BoundaryRule::returnToBounds

Returns the intercepted property to a value between \l minimum and \l maximum, such that \l currentOvershoot and \l peakOvershoot are both zero. This will be animated if \l returnDuration is greater than zero.

Returns true if the value needed to be adjusted, or false if it was already within bounds.

See also
returnedToBounds

Definition at line 358 of file qquickboundaryrule.cpp.

◆ setEasing()

void QQuickBoundaryRule::setEasing ( const QEasingCurve & easing)

Definition at line 416 of file qquickboundaryrule.cpp.

◆ setEnabled()

void QQuickBoundaryRule::setEnabled ( bool enabled)

Definition at line 145 of file qquickboundaryrule.cpp.

◆ setMaximum()

void QQuickBoundaryRule::setMaximum ( qreal maximum)

Definition at line 219 of file qquickboundaryrule.cpp.

◆ setMaximumOvershoot()

void QQuickBoundaryRule::setMaximumOvershoot ( qreal maximum)

Definition at line 245 of file qquickboundaryrule.cpp.

◆ setMinimum()

void QQuickBoundaryRule::setMinimum ( qreal minimum)

Definition at line 169 of file qquickboundaryrule.cpp.

◆ setMinimumOvershoot()

void QQuickBoundaryRule::setMinimumOvershoot ( qreal minimum)

Definition at line 195 of file qquickboundaryrule.cpp.

◆ setOvershootFilter()

void QQuickBoundaryRule::setOvershootFilter ( OvershootFilter overshootFilter)

Definition at line 337 of file qquickboundaryrule.cpp.

◆ setOvershootScale()

void QQuickBoundaryRule::setOvershootScale ( qreal scale)

Definition at line 277 of file qquickboundaryrule.cpp.

◆ setReturnDuration()

void QQuickBoundaryRule::setReturnDuration ( int duration)

Definition at line 441 of file qquickboundaryrule.cpp.

◆ setTarget()

void QQuickBoundaryRule::setTarget ( const QQmlProperty & property)
overridevirtual

Set the target property for the value interceptor.

This method will be called by the QML engine when assigning a value interceptor.

Implements QQmlPropertyValueInterceptor.

Definition at line 482 of file qquickboundaryrule.cpp.

◆ write()

void QQuickBoundaryRule::write ( const QVariant & value)
overridevirtual

This method will be called when a new value is assigned to the property being intercepted.

Implements QQmlPropertyValueInterceptor.

Definition at line 461 of file qquickboundaryrule.cpp.

Property Documentation

◆ currentOvershoot

qreal QQuickBoundaryRule::currentOvershoot
read

Definition at line 42 of file qquickboundaryrule_p.h.

◆ easing

QEasingCurve QQuickBoundaryRule::easing
readwrite

Definition at line 45 of file qquickboundaryrule_p.h.

◆ enabled

bool QQuickBoundaryRule::enabled
readwrite

Definition at line 36 of file qquickboundaryrule_p.h.

◆ maximum

qreal QQuickBoundaryRule::maximum
readwrite

Definition at line 39 of file qquickboundaryrule_p.h.

◆ maximumOvershoot

qreal QQuickBoundaryRule::maximumOvershoot
readwrite

Definition at line 40 of file qquickboundaryrule_p.h.

◆ minimum

qreal QQuickBoundaryRule::minimum
readwrite

Definition at line 37 of file qquickboundaryrule_p.h.

◆ minimumOvershoot

qreal QQuickBoundaryRule::minimumOvershoot
readwrite

Definition at line 38 of file qquickboundaryrule_p.h.

◆ overshootFilter

OvershootFilter QQuickBoundaryRule::overshootFilter
readwrite

Definition at line 44 of file qquickboundaryrule_p.h.

◆ overshootScale

qreal QQuickBoundaryRule::overshootScale
readwrite

Definition at line 41 of file qquickboundaryrule_p.h.

◆ peakOvershoot

qreal QQuickBoundaryRule::peakOvershoot
read

Definition at line 43 of file qquickboundaryrule_p.h.

◆ returnDuration

int QQuickBoundaryRule::returnDuration
readwrite

Definition at line 46 of file qquickboundaryrule_p.h.


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