KDeclarative::QmlObject
#include <KDeclarative/QmlObject>

Properties | |
bool | initializationDelayed |
QObject | rootObject |
QUrl | source |
QQmlComponent::Status | status |
QString | translationDomain |
![]() | |
objectName | |
Signals | |
void | finished () |
void | statusChanged (QQmlComponent::Status) |
Public Slots | |
void | completeInitialization (const QVariantHash &initialProperties=QVariantHash()) |
Public Member Functions | |
QmlObject (QObject *parent=nullptr) | |
QmlObject (QQmlEngine *engine, QObject *parent=nullptr) | |
QmlObject (QQmlEngine *engine, QQmlContext *rootContext, QObject *parent=nullptr) | |
QObject * | createObjectFromComponent (QQmlComponent *component, QQmlContext *context=nullptr, const QVariantHash &initialProperties=QVariantHash()) |
QObject * | createObjectFromSource (const QUrl &source, QQmlContext *context=nullptr, const QVariantHash &initialProperties=QVariantHash()) |
QQmlEngine * | engine () |
bool | isInitializationDelayed () const |
void | loadPackage (const QString &packageName) |
QQmlComponent * | mainComponent () const |
KPackage::Package | package () const |
QQmlContext * | rootContext () const |
QObject * | rootObject () const |
void | setInitializationDelayed (const bool delay) |
void | setPackage (const KPackage::Package &package) |
void | setSource (const QUrl &source) |
void | setTranslationDomain (const QString &translationDomain) |
QUrl | source () const |
QQmlComponent::Status | status () const |
QString | translationDomain () const |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
QmlObject (QQmlEngine *engine, QQmlContext *rootContext, QmlObject *obj, QObject *parent=nullptr) | |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
![]() | |
typedef | QObjectList |
Detailed Description
An object that instantiates an entire QML context, with its own declarative engine.
KDeclarative::QmlObject provides a class to conveniently use QML based declarative user interfaces inside Plasma widgets. A QmlObject corresponds to one QML file (which can include others). It will have its own QQmlEngine with a single root object, described in the QML file.
Definition at line 38 of file qmlobject.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a new QmlObject.
- Parameters
-
parent the parent of this object
Definition at line 129 of file qmlobject.cpp.
|
explicit |
Constructs a new QmlObject.
- Parameters
-
engine a QQmlEngine we want to use parent the parent of this object
Definition at line 145 of file qmlobject.cpp.
|
explicit |
Constructs a new QmlObject.
- Parameters
-
engine the QQmlEngine to use rootContext the root context to use for object creation parent the parent of this object
Definition at line 151 of file qmlobject.cpp.
|
explicitprotected |
Constructs a new QmlObject.
- Parameters
-
engine a QQmlEngine we want to use rootContext the root context we want to use for objects creation obj setupEngine is called when this is set to nullptr. This way the creator can influence if the engine should be initialized or not in case it is shared between multiple objects (such as QmlObjectSharedEngine) parent the parent of this object
- Since
- 5.45
Definition at line 157 of file qmlobject.cpp.
Member Function Documentation
|
slot |
Finishes the process of initialization.
If isInitializationDelayed() is false, calling this will have no effect.
- Parameters
-
initialProperties optional properties that will be set on the object when created (and before Component.onCompleted gets emitted
Definition at line 291 of file qmlobject.cpp.
QObject * KDeclarative::QmlObject::createObjectFromComponent | ( | QQmlComponent * | component, |
QQmlContext * | context = nullptr , |
||
const QVariantHash & | initialProperties = QVariantHash() |
||
) |
Creates and returns an object based on the provided QQmlComponent with the same QQmlEngine and the same root context as the admin object, that will be the parent of the newly created object.
- Parameters
-
component the component we want to instantiate context The QQmlContext in which we will create the object, if 0 it will use the engine's root context initialProperties optional properties that will be set on the object when created (and before Component.onCompleted gets emitted
Definition at line 332 of file qmlobject.cpp.
QObject * KDeclarative::QmlObject::createObjectFromSource | ( | const QUrl & | source, |
QQmlContext * | context = nullptr , |
||
const QVariantHash & | initialProperties = QVariantHash() |
||
) |
Creates and returns an object based on the provided url to a Qml file with the same QQmlEngine and the same root context as the main object, that will be the parent of the newly created object.
- Parameters
-
source url where the QML file is located context The QQmlContext in which we will create the object, if 0 it will use the engine's root context initialProperties optional properties that will be set on the object when created (and before Component.onCompleted gets emitted
Definition at line 324 of file qmlobject.cpp.
QQmlEngine * KDeclarative::QmlObject::engine | ( | ) |
- Returns
- the declarative engine that runs the qml file assigned to this widget.
Definition at line 240 of file qmlobject.cpp.
|
signal |
Emitted when the parsing and execution of the QML file is terminated.
bool KDeclarative::QmlObject::isInitializationDelayed | ( | ) | const |
- Returns
- true if the initialization of the QML file will be delayed at the end of the event loop
Definition at line 235 of file qmlobject.cpp.
void KDeclarative::QmlObject::loadPackage | ( | const QString & | packageName | ) |
Load the package called packageName, then loads the mainscript file for that package.
- Parameters
-
packageName the plugin name of the package
Definition at line 212 of file qmlobject.cpp.
QQmlComponent * KDeclarative::QmlObject::mainComponent | ( | ) | const |
- Returns
- the main QQmlComponent of the engine
Definition at line 254 of file qmlobject.cpp.
KPackage::Package KDeclarative::QmlObject::package | ( | ) | const |
- Returns
- the optional package, if any
Definition at line 225 of file qmlobject.cpp.
QQmlContext * KDeclarative::QmlObject::rootContext | ( | ) | const |
QObject* KDeclarative::QmlObject::rootObject | ( | ) | const |
- Returns
- the root object of the declarative object tree
void KDeclarative::QmlObject::setInitializationDelayed | ( | const bool | delay | ) |
Sets whether the execution of the QML file has to be delayed later in the event loop.
It has to be called before setQmlPath(). In this case it will be possible to assign new objects in the main engine context before the main component gets initialized. In that case it will be possible to access it immediately from the QML code. The initialization will either be completed automatically asynchronously or explicitly by calling completeInitialization()
- Parameters
-
delay if true the initialization of the QML file will be delayed at the end of the event loop
Definition at line 230 of file qmlobject.cpp.
void KDeclarative::QmlObject::setPackage | ( | const KPackage::Package & | package | ) |
Sets a package, then loads the mainscript file for that package.
- Parameters
-
package the package we want to use to provide QML files to this QML object
Definition at line 219 of file qmlobject.cpp.
void KDeclarative::QmlObject::setSource | ( | const QUrl & | source | ) |
Sets the path of the QML file to parse and execute.
- Parameters
-
path the absolute path of a QML file
Definition at line 201 of file qmlobject.cpp.
void KDeclarative::QmlObject::setTranslationDomain | ( | const QString & | translationDomain | ) |
Call this method before calling setupBindings to install a translation domain for all i18n global functions.
If a translation domain is set all i18n calls delegate to the matching i18nd calls with the provided translation domain.
The translationDomain affects all i18n calls including those from imports. Because of that modules intended to be used as imports should prefer the i18nd variants and set the translation domain explicitly in each call.
This method is only required if your declarative usage is inside a library. If it's in an application there is no need to set the translation domain as the application's domain can be used.
- Parameters
-
translationDomain The translation domain to be used for i18n calls.
- Since
- 5.0
Definition at line 191 of file qmlobject.cpp.
QUrl KDeclarative::QmlObject::source | ( | ) | const |
- Returns
- the absolute path of the current QML file
QQmlComponent::Status KDeclarative::QmlObject::status | ( | ) | const |
The component's current status.
- Since
- 5.11
QString KDeclarative::QmlObject::translationDomain | ( | ) | const |
- Returns
- the translation domain for the i18n calls done in this QML engine
- Since
- 5.0
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Mar 4 2021 22:40:05 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.