Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QVector.push_back error

Tags:

c++

qt

error in

QVector<LibraryRecord> Library;
Library.push_back(LibraryRecord(DateOfIssue, ReturnDate, FIO,tTekct,FName,TText));

error message:

 no matching function for call to ‘LibraryRecord::LibraryRecord()’

why? Constructor present

//constructor
LibraryRecord::LibraryRecord(QString pDateOfIssue,
                             QString pReturnDate,
                             QString FIO,
                             QString tTekct,
                             QString fName,
                                 QString TTextt)
{..}

Can you tell me how to fix this? Thanks in advance!

like image 609
Бориска Сосиска Avatar asked Dec 13 '22 09:12

Бориска Сосиска


1 Answers

Unlike the C++ Standard Library containers (e.g. std::vector), the Qt containers require that the value type be default constructible.

That is, your type LibraryRecord must also have a default constructor (the constructor that you show, which requires arguments, is not a default constructor).

like image 70
James McNellis Avatar answered Dec 14 '22 22:12

James McNellis