我使用QML。我有这个C ++代码
O(N^2)
在QML中,我这样做:
#include <QObject>
class ShowTime : public QObject
{
Q_OBJECT
public:
explicit ShowTime(QObject *parent = nullptr);
Q_INVOKABLE std::string whatToShow(int index);
private:
std::string mWhatToShow = "";
};
但是结果是我得到一个错误:
错误:未知的方法返回类型:std :: string 。
我在做什么错了?
答案 0 :(得分:-1)
@GrecKo是的,它有所帮助。谢谢。 我将std :: string更改为QString。