user2052244
user2052244

Reputation: 318

C2248 - No access to private member when passing QScopedPointer to function

I´m getting the following error on this piece of code.

QScopedPointer<NoteEvent> onEvent(new NoteEvent(date, chan, pitch, vel, true));
QScopedPointer<NoteEvent> offEvent(new NoteEvent(date + dur, chan, pitch, vel, false));
Score::noteStream->addNoteEvent(onEvent);
Score::noteStream->addNoteEvent(offEvent);


void NoteStream::addNoteEvent(QScopedPointer<NoteEvent> noteEvent)
{
    noteEvents->push_back(noteEvent);
}

Error: C2248: "QScopedPointer": No access to private member declared in QScopedPointer

Reading through other posts was not helpful.

Upvotes: 2

Views: 1066

Answers (1)

Igor Tandetnik
Igor Tandetnik

Reputation: 52471

QScopedPointer doesn't have a public copy constructor. It cannot be passed around by value, nor stored in containers that require its elements to be copyable (which noteEvents might be, depending on how it's declared).

Upvotes: 4

Related Questions