I want to ask:
i created and object type class name Movie:
#ifndef MOVIE_H
#define MOVIE_H
#include <QObject>
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
{
Q_OBJECT
public:
~Movie();
public slots:
{return _name;}
{_name = name_in;}
{return _date;}
{_date = date_in;}
{return _about;}
{_about = about_in;}
{return _picture;}
void setPicture
(QString picture_in
) {_picture = picture_in;}
private:
};
#endif // MOVIE_H
#ifndef MOVIE_H
#define MOVIE_H
#include <QObject>
QT_BEGIN_NAMESPACE
class QLabel;
QT_END_NAMESPACE
class Movie : public QObject
{
Q_OBJECT
public:
Movie(QObject *parent = 0);
~Movie();
public slots:
QString name()
{return _name;}
void setName(QString name_in)
{_name = name_in;}
QString date()
{return _date;}
void setDate(QString date_in)
{_date = date_in;}
QString about()
{return _about;}
void setAbout(QString about_in)
{_about = about_in;}
QString picture()
{return _picture;}
void setPicture(QString picture_in)
{_picture = picture_in;}
private:
QString _name;
QString _date;
QString _about;
QString _picture;
};
#endif // MOVIE_H
To copy to clipboard, switch view to plain text mode
In mine main application i Use the following code:
asd->setName(titleString);
QObject *asd = new Movie;
asd->setName(titleString);
To copy to clipboard, switch view to plain text mode
I get the following error:
'class QObject' has no member named 'setName'
What am I doing wrong?
Bookmarks