I don't find any solutions to this error: invalid initialization of non-const reference of type ‘Controller&’ from an rvalue of type ‘ < brace-enclosed initializer list> ’
it's in this function:
QTPlay::QTPlay(Controller &c,QWidget *parent) : c{ c }, QWidget{ parent }
{
this->initGUI();
this->currentMovie = this->c.repo.movies;
this->populaterepo();
}
this is the object:
class QTPlay : public QWidget
{
private:
Q_OBJECT
public:
QTPlay(Controller &c, QWidget *parent =0);
private:
Controller &c;
std::vector<Movie> currentMovie;
QListWidget* repo;
QLineEdit* title;
QLineEdit* genre;
QLineEdit* year;
QLineEdit* likes;
QLineEdit* trailer;
QPushButton* addButton;
QPushButton* deleteButton;
QPushButton* filterButton;
QPushButton* moveOneMovieButton;
QPushButton* playmovieButton;
QPushButton* nextmovieButton;
QListWidget* playList;
void initGUI();
void populaterepo();
void populatePlaylist();
int getRepoListSelectedIndex();
int getPlayListSelectedIndex();
void connectSignalsAndSlots();
private slots:
void listItemChanged();
void addMovie();
void deleteMovie();
void filterRepoMovies();
void moveMovieToPlaylist();
void playmovie();
void nextmovie();
};
I call it here:
Controller c(repo, p);
QTPlay w{c};
I am also working with the Linux version of Qt if that is relevant.
This question is different since the type is not int but a custom made Controller and uses the framework Qt.