本文整理汇总了C++中QMetaMethod::revision方法的典型用法代码示例。如果您正苦于以下问题:C++ QMetaMethod::revision方法的具体用法?C++ QMetaMethod::revision怎么用?C++ QMetaMethod::revision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMetaMethod
的用法示例。
在下文中一共展示了QMetaMethod::revision方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metaData
QVariant ObjectMethodModel::metaData(const QModelIndex &index, const QMetaMethod &method,
int role) const
{
if (role == Qt::DisplayRole && index.column() == 0) {
return Util::prettyMethodSignature(method);
} else if (role == ObjectMethodModelRole::MetaMethod) {
return QVariant::fromValue(method);
} else if (role == ObjectMethodModelRole::MetaMethodType && index.column() == 1) {
return QVariant::fromValue(method.methodType());
} else if (role == ObjectMethodModelRole::MethodAccess && index.column() == 2) {
return QVariant::fromValue(method.access());
} else if (role == ObjectMethodModelRole::MethodSignature && index.column() == 0) {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return method.signature();
#else
return method.methodSignature();
#endif
} else if (role == ObjectMethodModelRole::MethodTag && index.column() == 0 && qstrlen(method.tag())) {
return method.tag();
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
} else if (role == ObjectMethodModelRole::MethodRevision && index.column() == 0) {
return method.revision();
#endif
} else if (role == ObjectMethodModelRole::MethodIssues && index.column() == 0) {
const QMetaObject *mo = m_metaObject;
while (mo->methodOffset() > index.row())
mo = mo->superClass();
const auto r = QMetaObjectValidator::checkMethod(mo, method);
return r == QMetaObjectValidatorResult::NoIssue ? QVariant() : QVariant::fromValue(r);
}
return QVariant();
}
示例2: while
void QDeclarativePropertyCache::Data::lazyLoad(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
relatedIndex = -1;
flags |= Data::IsFunction;
if (m.methodType() == QMetaMethod::Signal)
flags |= Data::IsSignal;
propType = QVariant::Invalid;
const char *returnType = m.typeName();
if (returnType && *returnType) {
propTypeName = returnType;
flags |= Data::NotFullyResolved;
}
const char *signature = m.signature();
while (*signature != '(') { Q_ASSERT(*signature != 0); ++signature; }
++signature;
if (*signature != ')') {
flags |= Data::HasArguments;
if (0 == ::strcmp(signature, "QDeclarativeV8Function*)")) {
flags |= Data::IsV8Function;
}
}
revision = m.revision();
}
示例3: metaData
QVariant ObjectMethodModel::metaData(const QModelIndex &index,
const QMetaMethod &method, int role) const
{
if (role == Qt::DisplayRole) {
if (index.column() == 0) {
return Util::prettyMethodSignature(method);
}
if (index.column() == 1) {
switch (method.methodType()) {
case QMetaMethod::Method:
return tr("Method");
case QMetaMethod::Constructor:
return tr("Constructor");
case QMetaMethod::Slot:
return tr("Slot");
case QMetaMethod::Signal:
return tr("Signal");
default:
return tr("Unknown");
}
}
if (index.column() == 2) {
switch (method.access()) {
case QMetaMethod::Public:
return tr("Public");
case QMetaMethod::Protected:
return tr("Protected");
case QMetaMethod::Private:
return tr("Private");
default:
return tr("Unknown");
}
}
if (index.column() == 3) {
return method.tag();
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
if (index.column() == 4) {
return QString::number(method.revision());
}
#endif
} else if (role == ObjectMethodModelRole::MetaMethod) {
return QVariant::fromValue(method);
} else if (role == ObjectMethodModelRole::MetaMethodType) {
return QVariant::fromValue(method.methodType());
} else if (role == ObjectMethodModelRole::MethodSignature) {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return method.signature();
#else
return method.methodSignature();
#endif
}
return QVariant();
}
示例4: metaData
QVariant ObjectMethodModel::metaData(const QModelIndex &index,
const QMetaMethod &method, int role) const
{
if (role == Qt::DisplayRole) {
if (index.column() == 0) {
return Util::prettyMethodSignature(method);
}
if (index.column() == 1) {
switch (method.methodType()) {
case QMetaMethod::Method:
return tr("Method");
case QMetaMethod::Constructor:
return tr("Constructor");
case QMetaMethod::Slot:
return tr("Slot");
case QMetaMethod::Signal:
return tr("Signal");
default:
return tr("Unknown");
}
}
if (index.column() == 2) {
switch (method.access()) {
case QMetaMethod::Public:
return tr("Public");
case QMetaMethod::Protected:
return tr("Protected");
case QMetaMethod::Private:
return tr("Private");
default:
return tr("Unknown");
}
}
} else if (role == Qt::ToolTipRole) {
QString tt = Util::prettyMethodSignature(method);
tt += tr("\nTag: %1\n").arg(qstrlen(method.tag()) > 0 ? method.tag() : tr("<none>"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
tt += tr("Revision: %1").arg(method.revision());
#endif
return tt;
} else if (role == ObjectMethodModelRole::MetaMethod) {
return QVariant::fromValue(method);
} else if (role == ObjectMethodModelRole::MetaMethodType) {
return QVariant::fromValue(method.methodType());
} else if (role == ObjectMethodModelRole::MethodSignature) {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return method.signature();
#else
return method.methodSignature();
#endif
}
return QVariant();
}
示例5:
void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
relatedIndex = -1;
flags |= Data::IsFunction;
if (m.methodType() == QMetaMethod::Signal)
flags |= Data::IsSignal;
propType = m.returnType();
QList<QByteArray> params = m.parameterTypes();
if (!params.isEmpty())
flags |= Data::HasArguments;
revision = m.revision();
}