![]() |
Qt 6.x
The Qt SDK
|
#include <qqmlbuiltinfunctions_p.h>
Public Types | |
enum | LoadingMode { Asynchronous = 0 , Synchronous = 1 } |
Public Member Functions | |
Q_ENUM (LoadingMode) | |
Q_INVOKABLE QJSValue | include (const QString &url, const QJSValue &callback=QJSValue()) const |
Q_INVOKABLE bool | isQtObject (const QJSValue &value) const |
\qmlmethod bool Qt::isQtObject(object) | |
Q_INVOKABLE QVariant | color (const QString &name) const |
\qmlmethod color Qt::color(string name) | |
Q_INVOKABLE QVariant | rgba (double r, double g, double b, double a=1) const |
\qmlmethod color Qt::rgba(real red, real green, real blue, real alpha) | |
Q_INVOKABLE QVariant | hsla (double h, double s, double l, double a=1) const |
\qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha) | |
Q_INVOKABLE QVariant | hsva (double h, double s, double v, double a=1) const |
Q_INVOKABLE bool | colorEqual (const QVariant &lhs, const QVariant &rhs) const |
\qmlmethod color Qt::colorEqual(color lhs, string rhs) | |
Q_INVOKABLE QRectF | rect (double x, double y, double width, double height) const |
\qmlmethod rect Qt::rect(real x, real y, real width, real height) | |
Q_INVOKABLE QPointF | point (double x, double y) const |
\qmlmethod point Qt::point(real x, real y) | |
Q_INVOKABLE QSizeF | size (double width, double height) const |
\qmlmethod size Qt::size(real width, real height) | |
Q_INVOKABLE QVariant | vector2d (double x, double y) const |
\qmlmethod vector2d Qt::vector2d(real x, real y) | |
Q_INVOKABLE QVariant | vector3d (double x, double y, double z) const |
\qmlmethod vector3d Qt::vector3d(real x, real y, real z) | |
Q_INVOKABLE QVariant | vector4d (double x, double y, double z, double w) const |
\qmlmethod vector4d Qt::vector4d(real x, real y, real z, real w) | |
Q_INVOKABLE QVariant | quaternion (double scalar, double x, double y, double z) const |
\qmlmethod quaternion Qt::quaternion(real scalar, real x, real y, real z) | |
Q_INVOKABLE QVariant | matrix4x4 () const |
\qmlmethod matrix4x4 Qt::matrix4x4() | |
Q_INVOKABLE QVariant | matrix4x4 (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44) const |
\qmlmethod matrix4x4 Qt::matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44) | |
Q_INVOKABLE QVariant | matrix4x4 (const QJSValue &value) const |
\qmlmethod matrix4x4 Qt::matrix4x4(var values) | |
Q_INVOKABLE QVariant | lighter (const QJSValue &color, double factor=1.5) const |
\qmlmethod color Qt::lighter(color baseColor, real factor) | |
Q_INVOKABLE QVariant | darker (const QJSValue &color, double factor=2.0) const |
\qmlmethod color Qt::darker(color baseColor, real factor) | |
Q_INVOKABLE QVariant | alpha (const QJSValue &baseColor, double value) const |
\qmlmethod color Qt::alpha(color baseColor, real value) | |
Q_INVOKABLE QVariant | tint (const QJSValue &baseColor, const QJSValue &tintColor) const |
\qmlmethod color Qt::tint(color baseColor, color tintColor) | |
Q_INVOKABLE QString | formatDate (const QDate &date, const QString &format) const |
Q_INVOKABLE QString | formatDate (const QDateTime &dateTime, const QString &format) const |
Q_INVOKABLE QString | formatDate (const QString &string, const QString &format) const |
Q_INVOKABLE QString | formatDate (const QDate &date, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatDate (const QDateTime &dateTime, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatDate (const QString &string, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatTime (const QTime &time, const QString &format) const |
Q_INVOKABLE QString | formatTime (const QDateTime &dateTime, const QString &format) const |
Q_INVOKABLE QString | formatTime (const QString &time, const QString &format) const |
Q_INVOKABLE QString | formatTime (const QTime &time, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatTime (const QDateTime &dateTime, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatTime (const QString &time, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatDateTime (const QDateTime &date, const QString &format) const |
Q_INVOKABLE QString | formatDateTime (const QString &string, const QString &format) const |
Q_INVOKABLE QString | formatDateTime (const QDateTime &date, Qt::DateFormat format) const |
Q_INVOKABLE QString | formatDateTime (const QString &string, Qt::DateFormat format) const |
Q_INVOKABLE QUrl | url (const QUrl &url) const |
\qmlmethod url Qt::url(url url) | |
Q_INVOKABLE QUrl | resolvedUrl (const QUrl &url) const |
\qmlmethod url Qt::resolvedUrl(url url) | |
Q_INVOKABLE QUrl | resolvedUrl (const QUrl &url, QObject *context) const |
\qmlmethod url Qt::resolvedUrl(url url, object context) | |
Q_INVOKABLE bool | openUrlExternally (const QUrl &url) const |
\qmlmethod bool Qt::openUrlExternally(url target) | |
Q_INVOKABLE QVariant | font (const QJSValue &fontSpecifier) const |
\qmlmethod font Qt::font(object fontSpecifier) | |
Q_INVOKABLE QStringList | fontFamilies () const |
\qmlmethod list<string> Qt::fontFamilies() | |
Q_INVOKABLE QString | md5 (const QString &data) const |
\qmlmethod string Qt::md5(data) Returns a hex string of the md5 hash of data. | |
Q_INVOKABLE QString | btoa (const QString &data) const |
\qmlmethod string Qt::btoa(data) Binary to ASCII - this function returns a base64 encoding of data. | |
Q_INVOKABLE QString | atob (const QString &data) const |
\qmlmethod string Qt::atob(data) ASCII to binary - this function decodes the base64 encoded data string and returns it. | |
Q_INVOKABLE void | quit () const |
\qmlmethod Qt::quit() | |
Q_INVOKABLE void | exit (int retCode) const |
\qmlmethod Qt::exit(int retCode) | |
Q_INVOKABLE QObject * | createQmlObject (const QString &qml, QObject *parent, const QUrl &url=QUrl(QStringLiteral("inline"))) const |
\qmlmethod object Qt::createQmlObject(string qml, object parent, string filepath) | |
Q_INVOKABLE QQmlComponent * | createComponent (const QUrl &url, QObject *parent) const |
\qmlmethod Component Qt::createComponent(url url, enumeration mode, QtObject parent) | |
Q_INVOKABLE QQmlComponent * | createComponent (const QUrl &url, QQmlComponent::CompilationMode mode=QQmlComponent::PreferSynchronous, QObject *parent=nullptr) const |
Q_INVOKABLE QQmlComponent * | createComponent (const QString &moduleUri, const QString &typeName, QObject *parent) const |
Q_INVOKABLE QQmlComponent * | createComponent (const QString &moduleUri, const QString &typeName, QQmlComponent::CompilationMode mode=QQmlComponent::PreferSynchronous, QObject *parent=nullptr) const |
Q_INVOKABLE QJSValue | binding (const QJSValue &function) const |
\qmlmethod Qt::binding(function) | |
Q_INVOKABLE void | callLater (QQmlV4Function *args) |
QQmlPlatform * | platform () |
QQmlApplication * | application () |
QObject * | inputMethod () const |
QObject * | styleHints () const |
![]() | |
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< QString > | bindableObjectName () |
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). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
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::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), 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 (const QString &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 > | |
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 QObjectList & | children () 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< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () 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 . | |
Static Public Member Functions | |
static QtObject * | create (QQmlEngine *, QJSEngine *jsEngine) |
![]() | |
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) |
Properties | |
QQmlApplication * | application |
QQmlPlatform * | platform |
QObject * | inputMethod |
QObject * | styleHints |
![]() | |
QString | objectName |
the name of this object | |
Friends | |
struct | QV4::ExecutionEngine |
Additional Inherited Members | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
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. | |
![]() | |
QObject * | sender () 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) | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Definition at line 34 of file qqmlbuiltinfunctions_p.h.
Enumerator | |
---|---|
Asynchronous | |
Synchronous |
Definition at line 54 of file qqmlbuiltinfunctions_p.h.
\qmlmethod color Qt::alpha(color baseColor, real value)
Returns baseColor with an alpha value of value.
value is a real ranging from 0 (completely transparent) to 1 (completely opaque).
Definition at line 695 of file qqmlbuiltinfunctions.cpp.
References QQmlColorProvider::alpha(), colorVariantFromJSValue(), ok, and QQml_colorProvider().
QQmlApplication * QtObject::application | ( | ) |
\qmlmethod string Qt::atob(data) ASCII to binary - this function decodes the base64 encoded data string and returns it.
Definition at line 1245 of file qqmlbuiltinfunctions.cpp.
References QByteArray::fromBase64(), and QString::fromUtf8().
\qmlmethod Qt::binding(function)
Returns a JavaScript object representing a \l{Property Binding}{property binding}, with a function that evaluates the binding.
There are two main use-cases for the function: firstly, to apply a property binding imperatively from JavaScript code:
and secondly, to apply a property binding when initializing property values of dynamically constructed objects (via \l{Component::createObject()} {Component.createObject()} or \l{Loader::setSource()}{Loader.setSource()}).
For example, assuming the existence of a DynamicText component:
the output from:
and from:
should both be:
This function cannot be used in property binding declarations (see the documentation on \l{qml-javascript-assignment}{binding declarations and binding assignments}) except when the result is stored in an array bound to a var property.
Definition at line 1672 of file qqmlbuiltinfunctions.cpp.
References e, QJSValuePrivate::fromReturnedValue(), function, QStringLiteral, and v4Engine().
\qmlmethod string Qt::btoa(data) Binary to ASCII - this function returns a base64 encoding of data.
Definition at line 1236 of file qqmlbuiltinfunctions.cpp.
void QtObject::callLater | ( | QQmlV4Function * | args | ) |
Definition at line 1687 of file qqmlbuiltinfunctions.cpp.
References args.
\qmlmethod color Qt::color(string name)
Returns the color corresponding to the given name (i.e. red or #ff0000). If there is no such color, null
is returned.
Definition at line 323 of file qqmlbuiltinfunctions.cpp.
References arg, QQmlStringConverters::colorFromString(), QVariant::fromValue(), ok, QStringLiteral, and QV4::ExecutionEngine::throwError().
\qmlmethod color Qt::colorEqual(color lhs, string rhs)
Returns true
if both lhs and rhs yield equal color values. Both arguments may be either color values or string values. If a string value is supplied it must be convertible to a color, as described for the \l{colorvaluetypedocs}{color} value type.
Definition at line 400 of file qqmlbuiltinfunctions.cpp.
References QQmlStringConverters::colorFromString(), ok, QStringLiteral, QV4::ExecutionEngine::throwError(), QVariant::toString(), and QVariant::userType().
|
static |
Definition at line 290 of file qqmlbuiltinfunctions.cpp.
References globalObject(), QV4::EngineBase::globalObject, QJSEngine::handle(), QV4::ExecutionEngine::newString(), QV4::QObjectWrapper::object(), and QStringLiteral.
QQmlComponent * QtObject::createComponent | ( | const QString & | moduleUri, |
const QString & | typeName, | ||
QObject * | parent | ||
) | const |
Definition at line 1523 of file qqmlbuiltinfunctions.cpp.
References createComponent(), QObject::parent(), QQmlComponent::PreferSynchronous, and typeName.
QQmlComponent * QtObject::createComponent | ( | const QString & | moduleUri, |
const QString & | typeName, | ||
QQmlComponent::CompilationMode | mode = QQmlComponent::PreferSynchronous , |
||
QObject * | parent = nullptr |
||
) | const |
Definition at line 1529 of file qqmlbuiltinfunctions.cpp.
References arg, QQmlComponent::Asynchronous, context, QQmlComponentPrivate::creationContext, QString::endsWith(), engine, QQmlData::explicitIndestructibleSet, QQmlData::get(), QQmlComponentPrivate::get(), QQmlData::indestructible, QString::isEmpty(), QObject::parent(), QQmlComponent::PreferSynchronous, QStringLiteral, QV4::ExecutionEngine::throwError(), QV4::ExecutionEngine::throwTypeError(), and typeName.
QQmlComponent * QtObject::createComponent | ( | const QUrl & | url, |
QObject * | parent | ||
) | const |
\qmlmethod Component Qt::createComponent(url url, enumeration mode, QtObject parent)
Returns a \l Component object created using the QML file at the specified url, or null
if an empty string was given.
The returned component's \l Component::status property indicates whether the component was successfully created. If the status is Component.Error
, see \l Component::errorString() for an error description.
If the optional mode parameter is set to Component.Asynchronous
, the component will be loaded in a background thread. The Component::status property will be Component.Loading
while it is loading. The status will change to Component.Ready
if the component loads successfully, or Component.Error
if loading fails. This parameter defaults to Component.PreferSynchronous
if omitted.
If mode is set to Component.PreferSynchronous
, Qt will attempt to load the component synchronously, but may end up loading it asynchronously if necessary. Scenarios that may cause asynchronous loading include, but are not limited to, the following:
\list
If the optional parent parameter is given, it should refer to the object that will become the parent for the created \l Component object. If no mode was passed, this can be the second argument.
Call \l {Component::createObject()}{Component.createObject()} on the returned component to create an object instance of the component.
For example:
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
To create a QML object from an arbitrary string of QML (instead of a file), use \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()}.
\qmlmethod Component Qt::createComponent(string moduleUri, string typeName, enumeration mode, QtObject parent) This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a \l Component object created for the type specified by moduleUri and typeName. \qml import QtQuick QtObject { id: root property Component myComponent: Qt.createComponent(Rectangle, root) } \endqml This overload mostly behaves as the url
based version, but can be used to instantiate types which do not have an URL (e.g. C++ types registered via \l {QML_ELEMENT}).
Component.Asynchronous
won't have any effect: \list Definition at line 1492 of file qqmlbuiltinfunctions.cpp.
References createComponent(), QObject::parent(), QQmlComponent::PreferSynchronous, and url.
Referenced by createComponent(), and createComponent().
QQmlComponent * QtObject::createComponent | ( | const QUrl & | url, |
QQmlComponent::CompilationMode | mode = QQmlComponent::PreferSynchronous , |
||
QObject * | parent = nullptr |
||
) | const |
Definition at line 1497 of file qqmlbuiltinfunctions.cpp.
References arg, QQmlComponent::Asynchronous, context, QQmlComponentPrivate::creationContext, engine, QQmlData::explicitIndestructibleSet, QQmlData::get(), QQmlComponentPrivate::get(), QQmlData::indestructible, QUrl::isEmpty(), QObject::parent(), QQmlComponent::PreferSynchronous, QStringLiteral, QV4::ExecutionEngine::throwError(), and url.
QObject * QtObject::createQmlObject | ( | const QString & | qml, |
QObject * | parent, | ||
const QUrl & | url = QUrl(QStringLiteral("inline")) |
||
) | const |
\qmlmethod object Qt::createQmlObject(string qml, object parent, string filepath)
Returns a new object created from the given qml string which will have the specified parent, or null
if there was an error in creating the object.
If filepath is specified, it will be used for error reporting for the created object.
Example (where parentItem
is the id of an existing QML item):
In the case of an error, a QQmlError object is thrown. This object has an additional property, qmlErrors
, which is an array of the errors encountered. Each object in this array has the members lineNumber
, columnNumber
, fileName
and message
. For example, if the above snippet had misspelled color as 'colro' then the array would contain an object like the following: { "lineNumber" : 1, "columnNumber" : 32, "fileName" : "dynamicSnippet1", "message" : "Cannot assign to non-existent property \"colro\""}.
Note that this function returns immediately, and therefore may not work if the qml string loads new components (that is, external QML files that have not yet been loaded). If this is the case, consider using \l{QtQml::Qt::createComponent()}{Qt.createComponent()} instead.
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
Definition at line 1309 of file qqmlbuiltinfunctions.cpp.
References QV4::Scoped< T >::asReturnedValue(), QList< T >::at(), QV4::ExecutionEngine::callingQmlContext(), component(), context, create(), engine, QV4::Scope::engine, error, Error, QQmlData::explicitIndestructibleSet, QV4::Value::fromInt32(), QQmlComponentPrivate::fromTypeData(), QQmlData::get(), QQmlComponentPrivate::get(), QQmlContextData::get(), QQmlEnginePrivate::get(), QQmlTypeLoader::getType(), QQmlData::indestructible, QString::isEmpty(), QUrl::isRelative(), QUrl::isValid(), QQmlContext::isValid(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionEngine::newErrorObject(), QV4::ExecutionEngine::newObject(), QV4::ExecutionEngine::newString(), QObject::parent(), QQmlPrivate::Parented, QQmlMetaType::parentFunctions(), QQmlComponentPrivate::progress, Q_ASSERT, QStringLiteral, resolvedUrl(), QList< T >::size(), QQmlTypeLoader::Synchronous, QV4::ExecutionEngine::throwError(), QString::toUtf8(), QQmlEnginePrivate::typeLoader, and url.
\qmlmethod color Qt::darker(color baseColor, real factor)
Returns a color darker than baseColor by the factor provided.
If the factor is greater than 1.0, this function returns a darker color. Setting factor to 3.0 returns a color that has one-third the brightness. If the factor is less than 1.0, the return color is lighter, but we recommend using the Qt.lighter() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, divides the value (V) component by factor and converts the color back to RGB.
If factor is not supplied, returns a color that is 50% darker than baseColor (factor 2.0).
Definition at line 681 of file qqmlbuiltinfunctions.cpp.
References colorVariantFromJSValue(), QQmlColorProvider::darker(), ok, and QQml_colorProvider().
void QtObject::exit | ( | int | retCode | ) | const |
\qmlmethod Qt::exit(int retCode)
This function causes the QQmlEngine::exit(int) signal to be emitted. Within the \l {Prototyping with the QML Runtime Tool}{qml tool}, this causes the launcher application to exit with the specified return code (retCode). To exit from the event loop with a specified return code when this method is called, a C++ application can connect the QQmlEngine::exit(int) signal to the QCoreApplication::exit(int) slot.
Definition at line 1279 of file qqmlbuiltinfunctions.cpp.
References engine, QQmlEnginePrivate::get(), and QQmlEnginePrivate::sendExit().
\qmlmethod font Qt::font(object fontSpecifier)
Returns a font with the properties specified in the fontSpecifier object or the nearest matching font. The fontSpecifier object should contain key-value pairs where valid keys are the \l{fontvaluetypedocs}{font} type's subproperty names, and the values are valid values for each subproperty. Invalid keys will be ignored.
Definition at line 470 of file qqmlbuiltinfunctions.cpp.
References QQmlValueTypeProvider::createValueType(), QJSValue::isObject(), QStringLiteral, and QV4::ExecutionEngine::throwError().
QStringList QtObject::fontFamilies | ( | ) | const |
\qmlmethod list<string> Qt::fontFamilies()
Returns a list of the font families available to the application.
Definition at line 1218 of file qqmlbuiltinfunctions.cpp.
References QQmlGuiProvider::fontFamilies(), and QQml_guiProvider().
Definition at line 811 of file qqmlbuiltinfunctions.cpp.
References date.
Referenced by formatDate(), and formatDate().
QString QtObject::formatDate | ( | const QDate & | date, |
Qt::DateFormat | format | ||
) | const |
Definition at line 816 of file qqmlbuiltinfunctions.cpp.
References date.
Definition at line 821 of file qqmlbuiltinfunctions.cpp.
References dateTime, and QV4::DateObject::dateTimeToDate().
QString QtObject::formatDate | ( | const QDateTime & | dateTime, |
Qt::DateFormat | format | ||
) | const |
Definition at line 834 of file qqmlbuiltinfunctions.cpp.
References dateTime, and QV4::DateObject::dateTimeToDate().
Definition at line 826 of file qqmlbuiltinfunctions.cpp.
References dateFromString(), and formatDate().
QString QtObject::formatDate | ( | const QString & | string, |
Qt::DateFormat | format | ||
) | const |
Definition at line 839 of file qqmlbuiltinfunctions.cpp.
References dateFromString(), and formatDate().
Definition at line 1093 of file qqmlbuiltinfunctions.cpp.
References dateTime.
Referenced by formatDateTime(), and formatDateTime().
QString QtObject::formatDateTime | ( | const QDateTime & | date, |
Qt::DateFormat | format | ||
) | const |
Definition at line 1107 of file qqmlbuiltinfunctions.cpp.
References dateTime.
Definition at line 1098 of file qqmlbuiltinfunctions.cpp.
References dateTimeFromString(), and formatDateTime().
QString QtObject::formatDateTime | ( | const QString & | string, |
Qt::DateFormat | format | ||
) | const |
Definition at line 1112 of file qqmlbuiltinfunctions.cpp.
References dateTimeFromString(), and formatDateTime().
Definition at line 921 of file qqmlbuiltinfunctions.cpp.
References dateTime, and dateTimeToTime().
QString QtObject::formatTime | ( | const QDateTime & | dateTime, |
Qt::DateFormat | format | ||
) | const |
Definition at line 940 of file qqmlbuiltinfunctions.cpp.
References dateTime, and dateTimeToTime().
Definition at line 926 of file qqmlbuiltinfunctions.cpp.
References formatTime(), time, and timeFromString().
QString QtObject::formatTime | ( | const QString & | time, |
Qt::DateFormat | format | ||
) | const |
Definition at line 945 of file qqmlbuiltinfunctions.cpp.
References formatTime(), time, and timeFromString().
Definition at line 916 of file qqmlbuiltinfunctions.cpp.
References time.
Referenced by formatTime(), and formatTime().
QString QtObject::formatTime | ( | const QTime & | time, |
Qt::DateFormat | format | ||
) | const |
Definition at line 935 of file qqmlbuiltinfunctions.cpp.
References time.
QVariant QtObject::hsla | ( | double | h, |
double | s, | ||
double | l, | ||
double | a = 1 |
||
) | const |
\qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha)
Returns a color with the specified hue, saturation, lightness, and alpha components. All components should be in the range 0-1 (inclusive).
Definition at line 360 of file qqmlbuiltinfunctions.cpp.
References QQmlColorProvider::fromHslF(), and QQml_colorProvider().
QVariant QtObject::hsva | ( | double | h, |
double | s, | ||
double | v, | ||
double | a = 1 |
||
) | const |
Returns a color with the specified hue, saturation, value and alpha components. All components should be in the range 0-1 (inclusive).
Definition at line 382 of file qqmlbuiltinfunctions.cpp.
References QQmlColorProvider::fromHsvF(), qBound(), and QQml_colorProvider().
Definition at line 300 of file qqmlbuiltinfunctions.cpp.
References QV4Include::method_include(), resolvedUrl(), and url.
QObject * QtObject::inputMethod | ( | ) | const |
Definition at line 1709 of file qqmlbuiltinfunctions.cpp.
References QQmlGuiProvider::inputMethod(), and QQml_guiProvider().
bool QtObject::isQtObject | ( | const QJSValue & | value | ) | const |
\qmlmethod bool Qt::isQtObject(object)
Returns true
if object is a valid reference to a Qt or QML object, false
otherwise.
Definition at line 312 of file qqmlbuiltinfunctions.cpp.
\qmlmethod color Qt::lighter(color baseColor, real factor)
Returns a color lighter than baseColor by the factor provided.
If the factor is greater than 1.0, this functions returns a lighter color. Setting factor to 1.5 returns a color that is 50% brighter. If the factor is less than 1.0, the return color is darker, but we recommend using the Qt.darker() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, multiplies the value (V) component by factor and converts the color back to RGB.
If factor is not supplied, returns a color that is 50% lighter than baseColor (factor 1.5).
Definition at line 658 of file qqmlbuiltinfunctions.cpp.
References colorVariantFromJSValue(), QQmlColorProvider::lighter(), ok, and QQml_colorProvider().
QVariant QtObject::matrix4x4 | ( | ) | const |
\qmlmethod matrix4x4 Qt::matrix4x4()
Returns an identity matrix4x4.
Definition at line 564 of file qqmlbuiltinfunctions.cpp.
References QQmlValueTypeProvider::createValueType(), QVariant::isValid(), and variant.
\qmlmethod matrix4x4 Qt::matrix4x4(var values)
Returns a matrix4x4 with the specified values. values is expected to be a JavaScript array with 16 entries.
The array indices correspond to positions in the matrix as follows:
\table \row
Definition at line 586 of file qqmlbuiltinfunctions.cpp.
References QQmlValueTypeProvider::createValueType(), QStringLiteral, and QV4::ExecutionEngine::throwError().
QVariant QtObject::matrix4x4 | ( | double | m11, |
double | m12, | ||
double | m13, | ||
double | m14, | ||
double | m21, | ||
double | m22, | ||
double | m23, | ||
double | m24, | ||
double | m31, | ||
double | m32, | ||
double | m33, | ||
double | m34, | ||
double | m41, | ||
double | m42, | ||
double | m43, | ||
double | m44 | ||
) | const |
\qmlmethod matrix4x4 Qt::matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)
Returns a matrix4x4 with the specified values.
The arguments correspond to their positions in the matrix:
\table \row
Definition at line 614 of file qqmlbuiltinfunctions.cpp.
References constructFromJSValue().
\qmlmethod string Qt::md5(data) Returns a hex string of the md5 hash of data.
Definition at line 1227 of file qqmlbuiltinfunctions.cpp.
References QCryptographicHash::hash(), QCryptographicHash::Md5, and QByteArray::toHex().
bool QtObject::openUrlExternally | ( | const QUrl & | url | ) | const |
\qmlmethod bool Qt::openUrlExternally(url target)
Attempts to open the specified target url in an external application, based on the user's desktop preferences. Returns true
if it succeeds, false
otherwise.
true
indicates that the application has successfully requested the operating system to open the URL in an external application. The external application may still fail to launch or fail to open the requested URL. This result will not be reported back to the application. Definition at line 1150 of file qqmlbuiltinfunctions.cpp.
References QQmlGuiProvider::openUrlExternally(), QQml_guiProvider(), resolvedUrl(), and url.
QQmlPlatform * QtObject::platform | ( | ) |
QPointF QtObject::point | ( | double | x, |
double | y | ||
) | const |
\qmlmethod point Qt::point(real x, real y)
Returns a point with the specified x and y coordinates.
Definition at line 446 of file qqmlbuiltinfunctions.cpp.
QtObject::Q_ENUM | ( | LoadingMode | ) |
QVariant QtObject::quaternion | ( | double | scalar, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
\qmlmethod quaternion Qt::quaternion(real scalar, real x, real y, real z)
Returns a quaternion with the specified scalar, x, y, and z values.
Definition at line 554 of file qqmlbuiltinfunctions.cpp.
References constructFromJSValue().
void QtObject::quit | ( | ) | const |
\qmlmethod Qt::quit()
This function causes the QQmlEngine::quit() signal to be emitted. Within the \l {Prototyping with the QML Runtime Tool}{qml tool}, this causes the launcher application to exit; to quit a C++ application when this method is called, connect the QQmlEngine::quit() signal to the QCoreApplication::quit() slot.
Definition at line 1261 of file qqmlbuiltinfunctions.cpp.
References engine, QQmlEnginePrivate::get(), and QQmlEnginePrivate::sendQuit().
QRectF QtObject::rect | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) | const |
\qmlmethod rect Qt::rect(real x, real y, real width, real height)
Returns a rect with the top-left corner at x, y and the specified width and height.
Definition at line 436 of file qqmlbuiltinfunctions.cpp.
\qmlmethod url Qt::resolvedUrl(url url)
Returns url resolved relative to the URL of the caller.
If there is no caller or the caller is not associated with a QML context, returns url resolved relative to the QML engine's base URL. If the QML engine has no base URL, just returns url.
Definition at line 1181 of file qqmlbuiltinfunctions.cpp.
Referenced by createQmlObject(), include(), and openUrlExternally().
\qmlmethod url Qt::resolvedUrl(url url, object context)
Returns url resolved relative to the URL of the QML context of context. If context is not associated with a QML context, returns url resolved relative to the QML engine's base URL. If the QML engine has no base URL, just returns url.
Definition at line 1200 of file qqmlbuiltinfunctions.cpp.
References context, engine, QQmlData::get(), and url.
QVariant QtObject::rgba | ( | double | r, |
double | g, | ||
double | b, | ||
double | a = 1 |
||
) | const |
\qmlmethod color Qt::rgba(real red, real green, real blue, real alpha)
Returns a color with the specified red, green, blue, and alpha components. All components should be in the range 0-1 (inclusive).
Definition at line 340 of file qqmlbuiltinfunctions.cpp.
References QQmlColorProvider::fromRgbF(), and QQml_colorProvider().
QSizeF QtObject::size | ( | double | w, |
double | h | ||
) | const |
\qmlmethod size Qt::size(real width, real height)
Returns a size with the specified width and height.
Definition at line 456 of file qqmlbuiltinfunctions.cpp.
QObject * QtObject::styleHints | ( | ) | const |
Definition at line 1714 of file qqmlbuiltinfunctions.cpp.
References QQml_guiProvider(), and QQmlGuiProvider::styleHints().
\qmlmethod color Qt::tint(color baseColor, color tintColor)
This function allows tinting one color (baseColor) with another (tintColor).
The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque.
\qml Item { Rectangle { x: 0; width: 80; height: 80 color: "lightsteelblue" } Rectangle { x: 100; width: 80; height: 80 color: Qt.tint("lightsteelblue", "#10FF0000") } } \endqml Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color.
Definition at line 728 of file qqmlbuiltinfunctions.cpp.
References colorVariantFromJSValue(), ok, QQml_colorProvider(), QQmlColorProvider::tint(), and v1.
\qmlmethod url Qt::url(url url)
Returns url verbatim. This can be used to force a type coercion to url
. In contrast to Qt.resolvedUrl() this retains any relative URLs. As strings are implicitly converted to urls, the function can be called with a string as argument, and will then return a url.
Definition at line 1165 of file qqmlbuiltinfunctions.cpp.
References url.
QVariant QtObject::vector2d | ( | double | x, |
double | y | ||
) | const |
\qmlmethod vector2d Qt::vector2d(real x, real y)
Returns a vector2d with the specified x and y values.
Definition at line 524 of file qqmlbuiltinfunctions.cpp.
References constructFromJSValue().
QVariant QtObject::vector3d | ( | double | x, |
double | y, | ||
double | z | ||
) | const |
\qmlmethod vector3d Qt::vector3d(real x, real y, real z)
Returns a vector3d with the specified x, y, and z values.
Definition at line 534 of file qqmlbuiltinfunctions.cpp.
References constructFromJSValue().
QVariant QtObject::vector4d | ( | double | x, |
double | y, | ||
double | z, | ||
double | w | ||
) | const |
\qmlmethod vector4d Qt::vector4d(real x, real y, real z, real w)
Returns a vector4d with the specified x, y, z, and w values.
Definition at line 544 of file qqmlbuiltinfunctions.cpp.
References constructFromJSValue().
|
friend |
Definition at line 173 of file qqmlbuiltinfunctions_p.h.
|
read |
Definition at line 263 of file qqmlbuiltinfunctions_p.h.
|
read |
Definition at line 263 of file qqmlbuiltinfunctions_p.h.
|
read |
Definition at line 263 of file qqmlbuiltinfunctions_p.h.
|
read |
Definition at line 263 of file qqmlbuiltinfunctions_p.h.