PDA

View Full Version : invalid use of member (did you forget the '&' ?)



saman_artorious
25th March 2013, 12:25
why do I receive this error for the second statement?

error: invalid use of member (did you forget the '&' ?)




const QPixmap *orig_pixmap = ui->label->pixmap();
degrees++;
if(degrees == 90) degrees = 0;

QTransform rotate_disc;


rotate_disc.translate((orig_pixmap->width()-rotate->width())/2 , (orig_pixmap->width()-rotate->height())/2);
rotate_disc.rotate(degrees,Qt::ZAxis);

QPixmap pixmap;
//pixmap = orig_disc->scaled(89,89,Qt::IgnoreAspectRatio,Qt::SmoothTrans formation);
pixmap = orig_pixmap->transformed(rotate_disc,Qt::SmoothTransformation);
ui->label->setPixmap(pixmap);

d_stranz
25th March 2013, 19:42
There is nothing wrong with that code that I can see, but then you haven't shown enough to tell whether or not there is something about the context in which that code appears which would cause the error. For example, is the method a const method? Is there a member function named "degrees()"?

wysota
25th March 2013, 19:54
Second statement meaning "degrees++"? What is the type of "degrees"? Do you have a method with that name?

saman_artorious
26th March 2013, 04:06
yes, that was it.