gpt4 book ai didi

c++ - 'QObject::QObject(const QObject&)' 是私有(private)的

转载 作者:太空狗 更新时间:2023-10-29 21:18:51 26 4
gpt4 key购买 nike

<分区>

我收到错误:

C:\Qt\5.3\mingw482_32\include\QtCore\qobject.h:465: error : 'QObject::QObject(const QObject&)' is private
Q_DISABLE_COPY(QObject)
^
Qt\MyMediaLibraries\MyMediaLibraries\cpp.films\Movie.h:10: error : within this context
class Movie: public QObject
^

我已经阅读了很多相关内容,但实际上我不知道我的情况出了什么问题。我知道 QObject 构造函数不可复制,但我不会在这里这样做。或者实际上我不知道我在做它^^。这是我的代码:电影.h:

class Movie: public QObject
{

Q_OBJECT

public:
Movie();
Movie(const int &movie_id, const QString &movie_title, const QString &movie_md5, const QDate &movie_releaseDate, const QString &movie_genre,
const int &movie_note, const bool &movie_alreadySeen, const bool &movie_favourite, const bool &movie_toBeSeen,
const QString &movie_synopsis, const int &movie_duration, const QString &movie_backdropPath, const QString &movie_path,
const QString &movie_backdropMD5, const QString &movie_posterMD5, const QString &movie_posterPath, const QString &movie_collection);
void getInfos();

//TheMovieDB *tmdb;

int id;
QString title;
QDate releaseDate;
QString genre;
int note;
bool alreadySeen;
bool favourite;
bool toBeSeen;
QString synopsis;
int duration;
QString path;
QString md5;
QString backdropPath;
QString backdropMD5;
QString posterPath;
QString posterMD5;
QString collection;

public slots:
void updateDatas();
};

电影.cpp:

Movie::Movie()
{
title = "";
md5 = "";
id = 0;
path = "";
releaseDate = QDate();
genre = "";
note = 0;
alreadySeen = false;
favourite = false;
toBeSeen = false;
synopsis = "";
duration = 0;
backdropPath = "";
backdropMD5 = "";
posterPath = "";
posterMD5 = "";
collection = "";
}

Movie::Movie(const int &movie_id, const QString &movie_title, const QString &movie_md5, const QDate &movie_releaseDate,
const QString &movie_genre, const int &movie_note, const bool &movie_alreadySeen, const bool &movie_favourite,
const bool &movie_toBeSeen, const QString &movie_synopsis, const int &movie_duration,
const QString &movie_backdropPath, const QString &movie_path, const QString &movie_backdropMD5,
const QString &movie_posterMD5, const QString &movie_posterPath, const QString &movie_collection)
{
id = movie_id;
title = movie_title;
md5 = movie_md5;
path = movie_path;
releaseDate = movie_releaseDate;
genre = movie_genre;
note = movie_note;
alreadySeen = movie_alreadySeen;
favourite = movie_favourite;
toBeSeen = movie_toBeSeen;
synopsis = movie_synopsis;
duration = movie_duration;
backdropPath = movie_backdropPath;
backdropMD5 = movie_backdropMD5;
posterPath = movie_posterPath;
posterMD5 = movie_posterMD5;
collection = movie_collection;
}

void Movie::getInfos()
{
QObject::connect( tmdb , SIGNAL( dataRetrieved() ) , this , SLOT( updateDatas() ));
tmdb->search(title);
}


void Movie::updateDatas()
{
title = tmdb->t_infosList["title"].toString();
md5 = "";
id = tmdb->t_infosList["id"].toInt();
path = "";
releaseDate = tmdb->t_infosList["release_date"].toDate();
note = tmdb->t_infosList["note"].toInt();
synopsis = tmdb->t_infosList["overview"].toString();
backdropPath = tmdb->t_infosList["backdrop"].toString();
backdropMD5 = GeneralFunctions::hashMD5(tmdb->t_infosList["backdrop"].toString());
posterPath = tmdb->t_infosList["poster"].toString();
posterMD5 = GeneralFunctions::hashMD5(tmdb->t_infosList["poster"].toString());
collection = tmdb->t_infosList["collection"].toString();

QStringList genres = tmdb->t_infosList["genres"].toStringList();
genre = genres[0];
for(int i=0 ; i<genres.size() ; i++)
{
genre =genre + ", " + genres[i];
}
}

谢谢你的帮助

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com