Rename tools/qmldesigner to tools/qml
82
src/tools/qml/qmlmetatype/main.cpp
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QMetaObject>
|
||||||
|
#include <QtCore/QMetaProperty>
|
||||||
|
#include <QtDeclarative/QmlMetaType>
|
||||||
|
|
||||||
|
void messageOutput(QtMsgType type, const char *msg)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case QtDebugMsg:
|
||||||
|
fprintf(stdout, "%s\n", msg);
|
||||||
|
break;
|
||||||
|
case QtWarningMsg:
|
||||||
|
fprintf(stderr, "Warning: %s\n", msg);
|
||||||
|
break;
|
||||||
|
case QtCriticalMsg:
|
||||||
|
fprintf(stderr, "Critical: %s\n", msg);
|
||||||
|
break;
|
||||||
|
case QtFatalMsg:
|
||||||
|
fprintf(stderr, "Fatal: %s\n", msg);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void dumpProperty(QMetaProperty qProperty)
|
||||||
|
{
|
||||||
|
qDebug() << "\t\t" << qProperty.name() << "\t\t"
|
||||||
|
<< qProperty.typeName()
|
||||||
|
<< "readable=" << qProperty.isReadable()
|
||||||
|
<< "writable=" << qProperty.isWritable()
|
||||||
|
<< "resettable=" << qProperty.isResettable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dumpType(QmlType *type)
|
||||||
|
{
|
||||||
|
qDebug() << "Type:" << type->qmlTypeName() << type->majorVersion() << type->minorVersion() << "(C++: " << type->typeName() << ")";
|
||||||
|
|
||||||
|
const QMetaObject *qMetaObject = type->metaObject();
|
||||||
|
if (!qMetaObject) {
|
||||||
|
qDebug() << "\tNo metaObject! Skipping ...";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "\tProperties (default property :" << QmlMetaType::defaultProperty(qMetaObject).typeName() << ")";
|
||||||
|
for (int i = 0; i < qMetaObject->propertyCount(); ++i) {
|
||||||
|
dumpProperty(qMetaObject->property(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "\tSuper Classes:";
|
||||||
|
if (qMetaObject->superClass()) {
|
||||||
|
if (QmlType *qmlParentType = QmlMetaType::qmlType(qMetaObject->superClass())) {
|
||||||
|
if (!qmlParentType->qmlTypeName().isEmpty()) {
|
||||||
|
qDebug() << "\t\t" << qmlParentType->qmlTypeName();
|
||||||
|
} else {
|
||||||
|
qDebug() << "\t\t" << "(no Qml Type name)" << qmlParentType->typeName();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const QString parentClass = qMetaObject->superClass()->className();
|
||||||
|
qDebug() << "\t\t" << "(no Qml Type)" << parentClass;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "\t\t" << "no superclass";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
|
qInstallMsgHandler(messageOutput);
|
||||||
|
|
||||||
|
qDebug() << "Registered qml meta types:\n\n";
|
||||||
|
foreach (const QByteArray &typeName, QmlMetaType::qmlTypeNames()) {
|
||||||
|
if (typeName.isEmpty()) {
|
||||||
|
qDebug() << "Empty type name!!! Skipping ...";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QmlType *qmlType = QmlMetaType::qmlType(typeName, 4, 6);
|
||||||
|
Q_ASSERT(qmlType);
|
||||||
|
dumpType(qmlType);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
src/tools/qml/qmlmetatype/qmlmetatype.pro
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2009-04-09T15:54:21
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT -= gui
|
||||||
|
QT += declarative
|
||||||
|
|
||||||
|
TARGET = qmlmetatype
|
||||||
|
CONFIG += console
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += main.cpp
|
||||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |