C2280: “QQmlPrivate::QQmlElement

如果使用qmlRegisterType注册类型时,报这个错误,八成是写的类,有一个构造函数,并且这个构造函数有一个参数,而且这个参数没有默认值。

要角色这个问题,就把构造函数弄一个默认值吧

class MySortFilterProxyModel : public QSortFilterProxyModel
{
     Q_OBJECT

public:
     MySortFilterProxyModel(QObject *parent = nullptr);
     ~MySortFilterProxyModel();

    int indexToSourceIndex(int index);
};

posted @ 2020-08-04 19:27  瓜蛋  阅读(644)  评论(0编辑  收藏  举报