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
qqmlglobal_p.h File Reference

(5c5a2c24847c636857153078e4716fcb242f394d)

#include <private/qmetaobject_p.h>
#include <private/qqmlmetaobject_p.h>
#include <private/qqmltype_p.h>
#include <private/qtqmlglobal_p.h>
#include <QtQml/qqml.h>
#include <QtCore/qobject.h>
+ Include dependency graph for qqmlglobal_p.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QQmlValueTypeProvider
 
class  QQmlColorProvider
 
class  QQmlGuiProvider
 
class  QQmlApplication
 
class  QQmlApplicationPrivate
 
struct  QQmlSourceLocation
 

Macros

#define DEFINE_BOOL_CONFIG_OPTION(name, var)
 
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
 Connect Signal of Sender to Method of Receiver.
 
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
 Disconnect Signal of Sender from Method of Receiver.
 
#define IS_SIGNAL_CONNECTED(Sender, SenderType, Name, Arguments)
 

Functions

QT_BEGIN_NAMESPACE bool qmlConvertBoolConfigOption (const char *v)
 
template<typename T , T(*)(const char *) Convert>
qmlGetConfigOption (const char *var)
 
Q_QML_EXPORT bool qmlobject_can_cpp_cast (QObject *object, const QMetaObject *mo)
 
Q_QML_EXPORT bool qmlobject_can_qml_cast (QObject *object, const QQmlType &type)
 
template<class T >
qmlobject_cast (QObject *object)
 This method is identical to qobject_cast<T>() except that it does not require lazy QMetaObjects to be built, so should be preferred in all QML code that might interact with QML built objects.
 
template<>
QQuickItemqmlobject_cast< QQuickItem * > (QObject *object)
 
bool QQml_isFileCaseCorrect (const QString &fileName, int length=-1)
 Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise.
 
void QQml_setParent_noEvent (QObject *object, QObject *parent)
 Makes the object a child of parent.
 
Q_QML_EXPORT QQmlColorProviderQQml_setColorProvider (QQmlColorProvider *)
 
Q_QML_EXPORT QQmlColorProviderQQml_colorProvider ()
 
Q_QML_EXPORT QQmlGuiProviderQQml_setGuiProvider (QQmlGuiProvider *)
 
Q_AUTOTEST_EXPORT QQmlGuiProviderQQml_guiProvider ()
 

Macro Definition Documentation

◆ DEFINE_BOOL_CONFIG_OPTION

#define DEFINE_BOOL_CONFIG_OPTION ( name,
var )
Value:
static bool name() \
{ \
static const bool result = qmlGetConfigOption<bool, qmlConvertBoolConfigOption>(#var); \
return result; \
}
GLuint name
GLuint64EXT * result
[6]

Definition at line 41 of file qqmlglobal_p.h.

◆ IS_SIGNAL_CONNECTED

#define IS_SIGNAL_CONNECTED ( Sender,
SenderType,
Name,
Arguments )
Value:
do { \
QObject *sender = (Sender); \
void (SenderType::*signal)Arguments = &SenderType::Name; \
static int signalIdx = QMetaObjectPrivate::signalIndex(method); \
return QObjectPrivate::get(sender)->isSignalConnected(signalIdx); \
} while (0)
\inmodule QtCore
Definition qmetaobject.h:19
static QMetaMethod fromSignal(PointerToMemberFunction signal)
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:150
\inmodule QtCore
Definition qobject.h:103
auto signal
std::list< QString >::iterator Name
Definition lalr.h:28
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
static Q_CORE_EXPORT int signalIndex(const QMetaMethod &m)

Definition at line 163 of file qqmlglobal_p.h.

Referenced by QQuickCustomAffector::isAffectConnected(), QQuickParticleAffector::isAffectedConnected(), QQmlDelegateModelGroupPrivate::isChangedConnected(), QQuickMouseAreaPrivate::isClickConnected(), QQuickMouseAreaPrivate::isDoubleClickConnected(), QQuickParticleEmitter::isEmitConnected(), QQuickTextPrivate::isLineLaidOutConnected(), QQuickTextPrivate::isLinkActivatedConnected(), QQuickTextPrivate::isLinkHoveredConnected(), QQuickTextEditPrivate::isLinkHoveredConnected(), and QQuickMouseAreaPrivate::isPressAndHoldConnected().

◆ qmlobject_connect

#define qmlobject_connect ( Sender,
SenderType,
Signal,
Receiver,
ReceiverType,
Method )
Value:
do { \
SenderType *sender = (Sender); \
ReceiverType *receiver = (Receiver); \
const char *signal = (Signal); \
const char *method = (Method); \
static int signalIdx = -1; \
static int methodIdx = -1; \
if (signalIdx < 0) { \
Q_ASSERT((int(*signal) - '0') == QSIGNAL_CODE); \
signalIdx = SenderType::staticMetaObject.indexOfSignal(signal+1); \
} \
if (methodIdx < 0) { \
int code = (int(*method) - '0'); \
Q_ASSERT(code == QSLOT_CODE || code == QSIGNAL_CODE); \
if (code == QSLOT_CODE) \
methodIdx = ReceiverType::staticMetaObject.indexOfSlot(method+1); \
else \
methodIdx = ReceiverType::staticMetaObject.indexOfSignal(method+1); \
} \
Q_ASSERT(signalIdx != -1 && methodIdx != -1); \
QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); \
} while (0)
@ DirectConnection
#define QSIGNAL_CODE
Definition qobjectdefs.h:42
#define QSLOT_CODE
Definition qobjectdefs.h:41

Connect Signal of Sender to Method of Receiver.

Signal must be of type SenderType and Receiver of type ReceiverType.

Unlike QObject::connect(), this macro caches the lookup of the signal and method indexes. It also does not require lazy QMetaObjects to be built so should be preferred in all QML code that might interact with QML built objects.

textEdit, QQuickTextEdit, SLOT(updateDocument()));
\inmodule QtCore\reentrant
Definition qrect.h:484
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
QGraphicsWidget * textEdit

Definition at line 63 of file qqmlglobal_p.h.

Referenced by QQuickImageResponse::QQuickImageResponse(), QQuickTextControl::QQuickTextControl(), QQuickItemPrivate::_states(), QQuick3DObjectPrivate::_states(), QQuick3DObjectPrivate::data_append(), QQuickBorderImagePrivate::getScaleGrid(), QQuickFlickablePrivate::init(), QQuickPathViewPrivate::init(), QQuickTextEditPrivate::init(), QQuickTextInputPrivate::init(), QQuickBorderImage::load(), QQuickLayout::maybeSubscribeToBaseLineOffsetChanges(), QQuickItemPrivate::resources_append(), QQuick3DObjectPrivate::resources_append(), QQuickTextControlPrivate::setContent(), QQuickShapePath::setFillGradient(), QQuickPathView::setModel(), QQuickRepeater::setModel(), QQuick3DRepeater::setModel(), QQuickPathView::setPath(), QQuickScreenInfo::setWrappedScreen(), and QQuickScreenAttached::windowChanged().

◆ qmlobject_disconnect

#define qmlobject_disconnect ( Sender,
SenderType,
Signal,
Receiver,
ReceiverType,
Method )
Value:
do { \
SenderType *sender = (Sender); \
ReceiverType *receiver = (Receiver); \
const char *signal = (Signal); \
const char *method = (Method); \
static int signalIdx = -1; \
static int methodIdx = -1; \
if (signalIdx < 0) { \
Q_ASSERT((int(*signal) - '0') == QSIGNAL_CODE); \
signalIdx = SenderType::staticMetaObject.indexOfSignal(signal+1); \
} \
if (methodIdx < 0) { \
int code = (int(*method) - '0'); \
Q_ASSERT(code == QSLOT_CODE || code == QSIGNAL_CODE); \
if (code == QSLOT_CODE) \
methodIdx = ReceiverType::staticMetaObject.indexOfSlot(method+1); \
else \
methodIdx = ReceiverType::staticMetaObject.indexOfSignal(method+1); \
} \
Q_ASSERT(signalIdx != -1 && methodIdx != -1); \
QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); \
} while (0)

Disconnect Signal of Sender from Method of Receiver.

Signal must be of type SenderType and Receiver of type ReceiverType.

Unlike QObject::disconnect(), this macro caches the lookup of the signal and method indexes. It also does not require lazy QMetaObjects to be built so should be preferred in all QML code that might interact with QML built objects.

textEdit, QQuickTextEdit, SLOT(updateDocument()));
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.

Definition at line 102 of file qqmlglobal_p.h.

Referenced by QQuickLayout::maybeSubscribeToBaseLineOffsetChanges(), QQuickItemPrivate::resources_clear(), QQuick3DObjectPrivate::resources_clear(), QQuickItemPrivate::resources_removeLast(), QQuickTextControlPrivate::setContent(), QQuickShapePath::setFillGradient(), QQuickPathView::setModel(), QQuickRepeater::setModel(), QQuick3DRepeater::setModel(), QQuickPathView::setPath(), and QQuickScreenAttached::windowChanged().

Function Documentation

◆ qmlConvertBoolConfigOption()

QT_BEGIN_NAMESPACE bool qmlConvertBoolConfigOption ( const char * v)
inline

Definition at line 28 of file qqmlglobal_p.h.

References qstrcmp().

+ Here is the call graph for this function:

◆ qmlGetConfigOption()

template<typename T , T(*)(const char *) Convert>
T qmlGetConfigOption ( const char * var)

Definition at line 34 of file qqmlglobal_p.h.

References Q_UNLIKELY, qEnvironmentVariableIsEmpty(), qgetenv(), and var.

Referenced by QV4::ExecutionEngine::diskCacheOptions().

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

◆ qmlobject_can_cpp_cast()

Q_QML_EXPORT bool qmlobject_can_cpp_cast ( QObject * object,
const QMetaObject * mo )

Definition at line 917 of file qqmlglobal.cpp.

References ddata_for_cast(), mo, and Q_ASSERT.

Referenced by QV4::MatchScore(), and qmlobject_cast().

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

◆ qmlobject_can_qml_cast()

Q_QML_EXPORT bool qmlobject_can_qml_cast ( QObject * object,
const QQmlType & type )

Definition at line 925 of file qqmlglobal.cpp.

References QQmlRefPointer< T >::data(), ddata_for_cast(), QQmlMetaType::findPropertyCacheInCompositeTypes(), and Q_ASSERT.

Referenced by QV4::coerceQObject().

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

◆ qmlobject_cast()

template<class T >
T qmlobject_cast ( QObject * object)

This method is identical to qobject_cast<T>() except that it does not require lazy QMetaObjects to be built, so should be preferred in all QML code that might interact with QML built objects.

if (QQuickTextEdit *textEdit = qmlobject_cast<QQuickTextEdit *>(object)) {
// ...Do something...
}
GLuint object
[3]

Definition at line 142 of file qqmlglobal_p.h.

References qmlobject_can_cpp_cast().

+ Here is the call graph for this function:

◆ qmlobject_cast< QQuickItem * >()

◆ QQml_colorProvider()

Q_QML_EXPORT QQmlColorProvider * QQml_colorProvider ( )

Definition at line 780 of file qqmlglobal.cpp.

References getColorProvider().

Referenced by QtObject::alpha(), QQuickColorValueType::alpha(), QQmlStringConverters::colorFromString(), QtObject::darker(), QQuickColorValueType::darker(), QuickTestResult::fuzzyCompare(), QtObject::hsla(), QtObject::hsva(), QtObject::lighter(), QQuickColorValueType::lighter(), QtObject::rgba(), QQmlStringConverters::rgbaFromString(), QtObject::tint(), and QQuickColorValueType::tint().

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

◆ QQml_guiProvider()

Q_AUTOTEST_EXPORT QQmlGuiProvider * QQml_guiProvider ( )

Definition at line 833 of file qqmlglobal.cpp.

References getGuiProvider().

Referenced by QtObject::fontFamilies(), QtObject::inputMethod(), QtObject::openUrlExternally(), QQmlPlatform::pluginName(), and QtObject::styleHints().

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

◆ QQml_isFileCaseCorrect()

bool QQml_isFileCaseCorrect ( const QString & fileName,
int length = -1 )

Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise.

This is used to ensure that the behavior of QML on a case-insensitive file system is the same as on a case-sensitive file system. This function performs a "best effort" attempt to determine the real case of the file. It may have false positives (say the case is correct when it isn't), but it should never have a false negative (say the case is incorrect when it is correct).

Length specifies specifies the number of characters to be checked from behind. That is, if a file name results from a relative path specification like "foo/bar.qml" and is made absolute, the original length (11) should be passed indicating that only the last part of the relative path should be checked.

Definition at line 2043 of file qqmlengine.cpp.

References QString::at(), fileName, info, QString::lastIndexOf(), QString::length(), Q_UNUSED, and qMin().

Referenced by QQmlPluginImporter::importDynamicPlugin(), QQmlFile::load(), QQmlFile::load(), QQmlTypeLoader::qmldirContent(), and QQmlImportInstance::resolveType().

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

◆ QQml_setColorProvider()

Q_QML_EXPORT QQmlColorProvider * QQml_setColorProvider ( QQmlColorProvider * newProvider)

Definition at line 762 of file qqmlglobal.cpp.

References colorProvider.

Referenced by QQuick_initializeModule().

+ Here is the caller graph for this function:

◆ QQml_setGuiProvider()

Q_QML_EXPORT QQmlGuiProvider * QQml_setGuiProvider ( QQmlGuiProvider * newProvider)

Definition at line 816 of file qqmlglobal.cpp.

References guiProvider.

Referenced by QQuick_initializeModule().

+ Here is the caller graph for this function:

◆ QQml_setParent_noEvent()

void QQml_setParent_noEvent ( QObject * object,
QObject * parent )
inline

Makes the object a child of parent.

Note that when using this method, neither parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events.

Definition at line 197 of file qqmlglobal_p.h.

References QObject::d_ptr, QObjectPrivate::get(), QQuickItem::parent, and QObjectData::sendChildEvents.

Referenced by QQmlDelegateModelAttached::QQmlDelegateModelAttached(), QQmlDelegateModelAttached::QQmlDelegateModelAttached(), QQuickMenuPrivate::beginCreateItem(), QQuickMenuBarPrivate::beginCreateItem(), QQuickItemViewPrivate::createComponentItem(), QQuickFolderBreadcrumbBarPrivate::createDelegateItem(), QQuickPathViewPrivate::createHighlight(), QQuickListViewPrivate::getSectionItem(), QQuickFlickablePrivate::init(), QQuickWindowPrivate::init(), QQuickStateGroupPrivate::setCurrentStateInternal(), QQuickLoaderPrivate::setInitialState(), QQmlStrongJSQObjectReference< T >::setObject(), and QQuickViewPrivate::setRootObject().

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