直升機那裏,設置的QList子對象
我設置一個對象來獲得它在QML ......在這個對象的定義,我得到
(location_in_my_computer):25: candidate constructor
not viable: no known conversion from 'QList<QString>' to 'QList<const QString> &'
for 10th argument GroupObject(...,
^
在我的代碼我使用這個類(最小舉例):
class GroupObject : public QObject
{
public:
GroupObject(QObject *parent=0);
GroupObject(
QList<const QString> &tags, QObject *parent=0);
QList<const QString> tags();
void setTags(QList<const QString> &tags);
private:
QList<QString> m_tags;
};
而他實現:
#include "groupobject.h"
GroupObject::GroupObject(QList<const QString> &tags, QObject *parent) QObject(parent),
m_tags(tags){
}
QList<const QString> GroupObject::tags()
{
return m_tags;
}
void GroupObject::setTags(QList<const QString> &tags)
{
if(tags != m_tags){
m_tags = tags;
}
}
我打電話約定GroupObject之一的QList在如下例子:
QList<QString> tags;
QList<QObject*> dataList;
dataList.append(new GroupObject(tags));
我怎麼能在正確的概念做到這一點?
由於