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
qdbusmetaobject.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
7
8#include <QtCore/qbytearray.h>
9#include <QtCore/qhash.h>
10#include <QtCore/qstring.h>
11#include <QtCore/qvarlengtharray.h>
12
13#include "qdbusutil_p.h"
14#include "qdbuserror.h"
15#include "qdbusmetatype.h"
16#include "qdbusargument.h"
19
20#include <private/qmetaobject_p.h>
21#include <private/qmetaobjectbuilder_p.h>
22
23#ifndef QT_NO_DBUS
24
26
27using namespace Qt::StringLiterals;
28
30{
31public:
32 QDBusMetaObjectGenerator(const QString &interface,
33 const QDBusIntrospection::Interface *parsedData);
34 void write(QDBusMetaObject *obj);
35 void writeWithoutXml(QDBusMetaObject *obj);
36
37private:
38 struct Method {
39 QList<QByteArray> parameterNames;
40 QByteArray tag;
41 QByteArray name;
42 QVarLengthArray<int, 4> inputTypes;
43 QVarLengthArray<int, 4> outputTypes;
44 QByteArray rawReturnType;
45 quint32 flags;
46 };
47
48 struct Property {
49 QByteArray typeName;
50 QByteArray signature;
51 int type;
52 quint32 flags;
53 };
54 struct Type {
55 int id;
56 QByteArray name;
57 };
58
60 MethodMap signals_;
61 MethodMap methods;
62 QMap<QByteArray, Property> properties;
63
65 QString interface;
66
67 Type findType(const QByteArray &signature,
68 const QDBusIntrospection::Annotations &annotations,
69 const char *direction = "Out", int id = -1);
70
71 void parseMethods();
72 void parseSignals();
73 void parseProperties();
74
75 static qsizetype aggregateParameterCount(const MethodMap &map);
76};
77
78static const qsizetype intsPerProperty = 2;
79static const qsizetype intsPerMethod = 2;
80
86
88 const QDBusIntrospection::Interface *parsedData)
90{
91 if (data) {
92 parseProperties();
93 parseSignals(); // call parseSignals first so that slots override signals
94 parseMethods();
95 }
96}
97
98static int registerComplexDBusType(const QByteArray &typeName)
99{
100 struct QDBusRawTypeHandler : QtPrivate::QMetaTypeInterface
101 {
102 const QByteArray name;
103 QDBusRawTypeHandler(const QByteArray &name)
104 : QtPrivate::QMetaTypeInterface {
105 0, sizeof(void *), sizeof(void *), QMetaType::RelocatableType, 0, nullptr,
106 name.constData(),
107 nullptr, nullptr, nullptr, nullptr,
108 nullptr, nullptr, nullptr,
109 nullptr, nullptr, nullptr
110 },
111 name(name)
112 {}
113 };
114
115 Q_CONSTINIT static QBasicMutex mutex;
116 Q_CONSTINIT static struct Hash : QHash<QByteArray, QMetaType>
117 {
118 ~Hash()
119 {
120 for (QMetaType entry : std::as_const(*this))
121 QMetaType::unregisterMetaType(entry);
122 }
123 } hash;
124 QMutexLocker lock(&mutex);
125 QMetaType &metatype = hash[typeName];
126 if (!metatype.isValid())
127 metatype = QMetaType(new QDBusRawTypeHandler(typeName));
128 return metatype.id();
129}
130
131Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false;
132
134QDBusMetaObjectGenerator::findType(const QByteArray &signature,
135 const QDBusIntrospection::Annotations &annotations,
136 const char *direction, int id)
137{
138 Type result;
139 result.id = QMetaType::UnknownType;
140
141 int type = QDBusMetaType::signatureToMetaType(signature).id();
142 if (type == QMetaType::UnknownType && !qt_dbus_metaobject_skip_annotations) {
143 // it's not a type normally handled by our meta type system
144 // it must contain an annotation
145 QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
146 if (id >= 0)
147 annotationName += QString::fromLatin1(".%1%2")
148 .arg(QLatin1StringView(direction))
149 .arg(id);
150
151 // extract from annotations:
152 auto annotation = annotations.value(annotationName);
153 QByteArray typeName = annotation.value.toLatin1();
154
155 // verify that it's a valid one
156 if (typeName.isEmpty()) {
157 // try the old annotation from Qt 4
158 annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
159 if (id >= 0)
160 annotationName += QString::fromLatin1(".%1%2")
161 .arg(QLatin1StringView(direction))
162 .arg(id);
163 annotation = annotations.value(annotationName);
164 typeName = annotation.value.toLatin1();
165 }
166
167 if (!typeName.isEmpty()) {
168 // type name found
169 type = QMetaType::fromName(typeName).id();
170 }
171
172 if (type == QMetaType::UnknownType || signature != QDBusMetaType::typeToSignature(QMetaType(type))) {
173 // type is still unknown or doesn't match back to the signature that it
174 // was expected to, so synthesize a fake type
175 typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
176 type = registerComplexDBusType(typeName);
177 }
178
179 result.name = typeName;
180 } else if (type == QMetaType::UnknownType) {
181 // this case is used only by the qdbus command-line tool
182 // invalid, let's create an impossible type that contains the signature
183
184 if (signature == "av") {
185 result.name = "QVariantList";
186 type = QMetaType::QVariantList;
187 } else if (signature == "a{sv}") {
188 result.name = "QVariantMap";
189 type = QMetaType::QVariantMap;
190 } else if (signature == "a{ss}") {
191 result.name = "QMap<QString,QString>";
192 type = qMetaTypeId<QMap<QString, QString> >();
193 } else if (signature == "aay") {
194 result.name = "QByteArrayList";
195 type = qMetaTypeId<QByteArrayList>();
196 } else {
197 result.name = "{D-Bus type \"" + signature + "\"}";
198 type = registerComplexDBusType(result.name);
199 }
200 } else {
201 result.name = QMetaType(type).name();
202 }
203
204 result.id = type;
205 return result; // success
206}
207
208void QDBusMetaObjectGenerator::parseMethods()
209{
210 //
211 // TODO:
212 // Add cloned methods when the remote object has return types
213 //
214
215 for (const QDBusIntrospection::Method &m : std::as_const(data->methods)) {
216 Method mm;
217
218 mm.name = m.name.toLatin1();
219 QByteArray prototype = mm.name;
220 prototype += '(';
221
222 bool ok = true;
223
224 // build the input argument list
225 for (qsizetype i = 0; i < m.inputArgs.size(); ++i) {
226 const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
227
228 Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
229 if (type.id == QMetaType::UnknownType) {
230 ok = false;
231 break;
232 }
233
234 mm.inputTypes.append(type.id);
235
236 mm.parameterNames.append(arg.name.toLatin1());
237
238 prototype.append(type.name);
239 prototype.append(',');
240 }
241 if (!ok) continue;
242
243 // build the output argument list:
244 for (qsizetype i = 0; i < m.outputArgs.size(); ++i) {
245 const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
246
247 Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
248 if (type.id == QMetaType::UnknownType) {
249 ok = false;
250 break;
251 }
252
253 mm.outputTypes.append(type.id);
254
255 if (i == 0 && type.id == -1) {
256 mm.rawReturnType = type.name;
257 }
258 if (i != 0) {
259 // non-const ref parameter
260 mm.parameterNames.append(arg.name.toLatin1());
261
262 prototype.append(type.name);
263 prototype.append("&,");
264 }
265 }
266 if (!ok) continue;
267
268 // convert the last commas:
269 if (!mm.parameterNames.isEmpty())
270 prototype[prototype.size() - 1] = ')';
271 else
272 prototype.append(')');
273
274 // check the async tag
275 if (m.annotations.value(ANNOTATION_NO_WAIT ""_L1).value == "true"_L1)
276 mm.tag = "Q_NOREPLY";
277
278 // meta method flags
279 mm.flags = AccessPublic | MethodSlot | MethodScriptable;
280
281 // add
282 methods.insert(QMetaObject::normalizedSignature(prototype), mm);
283 }
284}
285
286void QDBusMetaObjectGenerator::parseSignals()
287{
288 for (const QDBusIntrospection::Signal &s : std::as_const(data->signals_)) {
289 Method mm;
290
291 mm.name = s.name.toLatin1();
292 QByteArray prototype = mm.name;
293 prototype += '(';
294
295 bool ok = true;
296
297 // build the output argument list
298 for (qsizetype i = 0; i < s.outputArgs.size(); ++i) {
299 const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
300
301 Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
302 if (type.id == QMetaType::UnknownType) {
303 ok = false;
304 break;
305 }
306
307 mm.inputTypes.append(type.id);
308
309 mm.parameterNames.append(arg.name.toLatin1());
310
311 prototype.append(type.name);
312 prototype.append(',');
313 }
314 if (!ok) continue;
315
316 // convert the last commas:
317 if (!mm.parameterNames.isEmpty())
318 prototype[prototype.size() - 1] = ')';
319 else
320 prototype.append(')');
321
322 // meta method flags
323 mm.flags = AccessPublic | MethodSignal | MethodScriptable;
324
325 // add
326 signals_.insert(QMetaObject::normalizedSignature(prototype), mm);
327 }
328}
329
330void QDBusMetaObjectGenerator::parseProperties()
331{
332 for (const QDBusIntrospection::Property &p : std::as_const(data->properties)) {
333 Property mp;
334 Type type = findType(p.type.toLatin1(), p.annotations);
335 if (type.id == QMetaType::UnknownType)
336 continue;
337
338 QByteArray name = p.name.toLatin1();
339 mp.signature = p.type.toLatin1();
340 mp.type = type.id;
341 mp.typeName = type.name;
342
343 // build the flags:
344 mp.flags = StdCppSet | Scriptable | Stored | Designable;
345 if (p.access != QDBusIntrospection::Property::Write)
346 mp.flags |= Readable;
347 if (p.access != QDBusIntrospection::Property::Read)
348 mp.flags |= Writable;
349
350 // add the property:
351 properties.insert(name, mp);
352 }
353}
354
355// Returns the sum of all parameters (including return type) for the given
356// \a map of methods. This is needed for calculating the size of the methods'
357// parameter type/name meta-data.
358qsizetype QDBusMetaObjectGenerator::aggregateParameterCount(const MethodMap &map)
359{
360 qsizetype sum = 0;
361 for (const Method &m : map)
362 sum += m.inputTypes.size() + qMax(qsizetype(1), m.outputTypes.size());
363 return sum;
364}
365
366void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
367{
368 // this code here is mostly copied from qaxbase.cpp
369 // with a few modifications to make it cleaner
370
371 QString className = interface;
372 className.replace(u'.', "::"_L1);
373 if (className.isEmpty())
374 className = "QDBusInterface"_L1;
375
376 QVarLengthArray<uint> idata;
377 idata.resize(sizeof(QDBusMetaObjectPrivate) / sizeof(uint));
378
379 qsizetype methodParametersDataSize =
380 ((aggregateParameterCount(signals_)
381 + aggregateParameterCount(methods)) * 2) // types and parameter names
382 - signals_.size() // return "parameters" don't have names
383 - methods.size(); // ditto
384
385 QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data());
386 static_assert(QMetaObjectPrivate::OutputRevision == 13, "QtDBus meta-object generator should generate the same version as moc");
387 header->revision = QMetaObjectPrivate::OutputRevision;
388 header->className = 0;
389 header->classInfoCount = 0;
390 header->classInfoData = 0;
391 header->methodCount = int(signals_.size() + methods.size());
392 header->methodData = int(idata.size());
393 header->propertyCount = int(properties.size());
394 header->propertyData = int(header->methodData + header->methodCount *
395 QMetaObjectPrivate::IntsPerMethod + methodParametersDataSize);
396 header->enumeratorCount = 0;
397 header->enumeratorData = 0;
398 header->constructorCount = 0;
399 header->constructorData = 0;
400 header->flags = RequiresVariantMetaObject | AllocatedMetaObject;
401 header->signalCount = signals_.size();
402 // These are specific to QDBusMetaObject:
403 header->propertyDBusData = int(header->propertyData + header->propertyCount
404 * QMetaObjectPrivate::IntsPerProperty);
405 header->methodDBusData = int(header->propertyDBusData + header->propertyCount * intsPerProperty);
406
407 qsizetype data_size = idata.size() +
408 (header->methodCount * (QMetaObjectPrivate::IntsPerMethod+intsPerMethod)) + methodParametersDataSize +
409 (header->propertyCount * (QMetaObjectPrivate::IntsPerProperty+intsPerProperty));
410
411 // Signals must be added before other methods, to match moc.
412 std::array<std::reference_wrapper<const MethodMap>, 2> methodMaps = { signals_, methods };
413
414 for (const auto &methodMap : methodMaps) {
415 for (const Method &mm : methodMap.get())
416 data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
417 }
418 idata.resize(data_size + 1);
419
420 QMetaStringTable strings(className.toLatin1());
421
422 qsizetype offset = header->methodData;
423 qsizetype parametersOffset = offset + header->methodCount * QMetaObjectPrivate::IntsPerMethod;
424 qsizetype signatureOffset = header->methodDBusData;
425 qsizetype typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod;
426 idata[typeidOffset++] = 0; // eod
427
428 qsizetype totalMetaTypeCount = properties.size();
429 ++totalMetaTypeCount; // + 1 for metatype of dynamic metaobject
430 for (const auto &methodMap : methodMaps) {
431 for (const Method &mm : methodMap.get()) {
432 qsizetype argc = mm.inputTypes.size() + qMax(qsizetype(0), mm.outputTypes.size() - 1);
433 totalMetaTypeCount += argc + 1;
434 }
435 }
436 QMetaType *metaTypes = new QMetaType[totalMetaTypeCount];
437 int propertyId = 0;
438
439 // add each method:
440 qsizetype currentMethodMetaTypeOffset = properties.size() + 1;
441
442 for (const auto &methodMap : methodMaps) {
443 for (const Method &mm : methodMap.get()) {
444 qsizetype argc = mm.inputTypes.size() + qMax(qsizetype(0), mm.outputTypes.size() - 1);
445
446 idata[offset++] = strings.enter(mm.name);
447 idata[offset++] = argc;
448 idata[offset++] = parametersOffset;
449 idata[offset++] = strings.enter(mm.tag);
450 idata[offset++] = mm.flags;
451 idata[offset++] = currentMethodMetaTypeOffset;
452
453 // Parameter types
454 for (qsizetype i = -1; i < argc; ++i) {
455 int type;
456 QByteArray typeName;
457 if (i < 0) { // Return type
458 if (!mm.outputTypes.isEmpty()) {
459 type = mm.outputTypes.first();
460 if (type == -1) {
461 type = IsUnresolvedType | strings.enter(mm.rawReturnType);
462 }
463 } else {
464 type = QMetaType::Void;
465 }
466 } else if (i < mm.inputTypes.size()) {
467 type = mm.inputTypes.at(i);
468 } else {
469 Q_ASSERT(mm.outputTypes.size() > 1);
470 type = mm.outputTypes.at(i - mm.inputTypes.size() + 1);
471 // Output parameters are references; type id not available
472 typeName = QMetaType(type).name();
473 typeName.append('&');
474 type = QMetaType::UnknownType;
475 }
476 int typeInfo;
477 if (!typeName.isEmpty())
478 typeInfo = IsUnresolvedType | strings.enter(typeName);
479 else
480 typeInfo = type;
481 metaTypes[currentMethodMetaTypeOffset++] = QMetaType(type);
482 idata[parametersOffset++] = typeInfo;
483 }
484 // Parameter names
485 for (qsizetype i = 0; i < argc; ++i)
486 idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
487
488 idata[signatureOffset++] = typeidOffset;
489 idata[typeidOffset++] = mm.inputTypes.size();
490 memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.size() * sizeof(uint));
491 typeidOffset += mm.inputTypes.size();
492
493 idata[signatureOffset++] = typeidOffset;
494 idata[typeidOffset++] = mm.outputTypes.size();
495 memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.size() * sizeof(uint));
496 typeidOffset += mm.outputTypes.size();
497 }
498 }
499
500 Q_ASSERT(offset == header->methodData + header->methodCount * QMetaObjectPrivate::IntsPerMethod);
501 Q_ASSERT(parametersOffset == header->propertyData);
502 Q_ASSERT(signatureOffset == header->methodDBusData + header->methodCount * intsPerMethod);
503 Q_ASSERT(typeidOffset == idata.size());
504 offset += methodParametersDataSize;
505 Q_ASSERT(offset == header->propertyData);
506
507 // add each property
508 signatureOffset = header->propertyDBusData;
509 for (const auto &[name, mp] : std::as_const(properties).asKeyValueRange()) {
510 // form is name, typeinfo, flags
511 idata[offset++] = strings.enter(name);
512 Q_ASSERT(mp.type != QMetaType::UnknownType);
513 idata[offset++] = mp.type;
514 idata[offset++] = mp.flags;
515 idata[offset++] = -1; // notify index
516 idata[offset++] = 0; // revision
517
518 idata[signatureOffset++] = strings.enter(mp.signature);
519 idata[signatureOffset++] = mp.type;
520
521 metaTypes[propertyId++] = QMetaType(mp.type);
522 }
523 metaTypes[propertyId] = QMetaType(); // we can't know our own metatype
524
525 Q_ASSERT(offset == header->propertyDBusData);
526 Q_ASSERT(signatureOffset == header->methodDBusData);
527
528 char *string_data = new char[strings.blobSize()];
529 strings.writeBlob(string_data);
530
531 uint *uint_data = new uint[idata.size()];
532 memcpy(uint_data, idata.data(), idata.size() * sizeof(uint));
533
534 // put the metaobject together
535 obj->d.data = uint_data;
536 obj->d.relatedMetaObjects = nullptr;
537 obj->d.static_metacall = nullptr;
538 obj->d.extradata = nullptr;
539 obj->d.stringdata = reinterpret_cast<const uint *>(string_data);
540 obj->d.superdata = &QDBusAbstractInterface::staticMetaObject;
541 obj->d.metaTypes = reinterpret_cast<QtPrivate::QMetaTypeInterface *const *>(metaTypes);
542}
543
544#if 0
545void QDBusMetaObjectGenerator::writeWithoutXml(const QString &interface)
546{
547 // no XML definition
548 QString tmp(interface);
549 tmp.replace(u'.', "::"_L1);
550 QByteArray name(tmp.toLatin1());
551
552 QDBusMetaObjectPrivate *header = new QDBusMetaObjectPrivate;
553 memset(header, 0, sizeof *header);
554 header->revision = 1;
555 // leave the rest with 0
556
557 char *stringdata = new char[name.length() + 1];
558 stringdata[name.length()] = '\0';
559
560 d.data = reinterpret_cast<uint*>(header);
561 d.relatedMetaObjects = 0;
562 d.static_metacall = 0;
563 d.extradata = 0;
564 d.stringdata = stringdata;
565 d.superdata = &QDBusAbstractInterface::staticMetaObject;
566 cached = false;
567}
568#endif
569
570/////////
571// class QDBusMetaObject
572
573QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, const QString &xml,
574 QHash<QString, QDBusMetaObject *> &cache,
575 QDBusError &error)
576{
577 error = QDBusError();
578 QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml);
579
580 QDBusMetaObject *we = nullptr;
581 QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin();
582 QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd();
583 for ( ; it != end; ++it) {
584 // check if it's in the cache
585 bool us = it.key() == interface;
586
587 QDBusMetaObject *obj = cache.value(it.key(), 0);
588 if (!obj && (us || !interface.startsWith("local."_L1 ))) {
589 // not in cache; create
590 obj = new QDBusMetaObject;
591 QDBusMetaObjectGenerator generator(it.key(), it.value().constData());
592 generator.write(obj);
593
594 if ((obj->cached = !it.key().startsWith("local."_L1)))
595 // cache it
596 cache.insert(it.key(), obj);
597 else if (!us)
598 delete obj;
599
600 }
601
602 if (us)
603 // it's us
604 we = obj;
605 }
606
607 if (we)
608 return we;
609 // still nothing?
610
611 if (parsed.isEmpty()) {
612 // object didn't return introspection
613 we = new QDBusMetaObject;
614 QDBusMetaObjectGenerator generator(interface, nullptr);
615 generator.write(we);
616 we->cached = false;
617 return we;
618 } else if (interface.isEmpty()) {
619 // merge all interfaces
620 it = parsed.constBegin();
621 QDBusIntrospection::Interface merged = *it.value().constData();
622
623 for (++it; it != end; ++it) {
624 merged.annotations.insert(it.value()->annotations);
625 merged.methods.unite(it.value()->methods);
626 merged.signals_.unite(it.value()->signals_);
627 merged.properties.insert(it.value()->properties);
628 }
629
630 merged.name = "local.Merged"_L1;
631 merged.introspection.clear();
632
633 we = new QDBusMetaObject;
634 QDBusMetaObjectGenerator generator(merged.name, &merged);
635 generator.write(we);
636 we->cached = false;
637 return we;
638 }
639
640 // mark as an error
641 error = QDBusError(QDBusError::UnknownInterface,
642 "Interface '%1' was not found"_L1.arg(interface));
643 return nullptr;
644}
645
646QDBusMetaObject::QDBusMetaObject()
647{
648}
649
650static inline const QDBusMetaObjectPrivate *priv(const uint* data)
651{
652 return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
653}
654
655const int *QDBusMetaObject::inputTypesForMethod(int id) const
656{
657 //id -= methodOffset();
658 if (id >= 0 && id < priv(d.data)->methodCount) {
659 int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
660 return reinterpret_cast<const int*>(d.data + d.data[handle]);
661 }
662 return nullptr;
663}
664
665const int *QDBusMetaObject::outputTypesForMethod(int id) const
666{
667 //id -= methodOffset();
668 if (id >= 0 && id < priv(d.data)->methodCount) {
669 int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
670 return reinterpret_cast<const int*>(d.data + d.data[handle + 1]);
671 }
672 return nullptr;
673}
674
675int QDBusMetaObject::propertyMetaType(int id) const
676{
677 //id -= propertyOffset();
678 if (id >= 0 && id < priv(d.data)->propertyCount) {
679 int handle = priv(d.data)->propertyDBusData + id*intsPerProperty;
680 return d.data[handle + 1];
681 }
682 return 0;
683}
684
685QT_END_NAMESPACE
686
687#endif // QT_NO_DBUS
void writeWithoutXml(QDBusMetaObject *obj)
QDBusMetaObjectGenerator(const QString &interface, const QDBusIntrospection::Interface *parsedData)
void write(QDBusMetaObject *obj)
#define ANNOTATION_NO_WAIT
Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations
static const qsizetype intsPerMethod
static int registerComplexDBusType(const QByteArray &typeName)
static const qsizetype intsPerProperty