zoukankan      html  css  js  c++  java
  • 通过metamethod调用函数

    通过metamethod调用函数普通函数,发现indexOfMethod总是返回-1,查看文档,发现下面:

    Q_INVOKABLE
    Apply this macro to definitions of member functions to allow them to be invoked via the meta-object system. The macro is written before the return type, as shown in the following example:

    class Window : public QWidget
    {
         Q_OBJECT

    public:
         Window();
         void normalMethod();
         Q_INVOKABLE void invokableMethod();
    };
    The invokableMethod() function is marked up using Q_INVOKABLE, causing it to be registered with the meta-object system and enabling it to be invoked using QMetaObject::invokeMethod(). Since normalMethod() function is not registered in this way, it cannot be invoked using QMetaObject::invokeMethod().

    这个语句作用是把这个方法注册到meta-object system ,才能用

  • 相关阅读:
    tornado之获取参数
    tornado中命名路由及反向解析使用
    options模块介绍
    服务的启动
    redis操作
    python中使用redis模块, 设置过期时间
    LaTeX
    word 摘要
    常用命令
    机器学习的建议
  • 原文地址:https://www.cnblogs.com/cute/p/2097541.html
Copyright © 2011-2022 走看看