Results 1 to 4 of 4

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

  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

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

    why do I receive this error for the second statement?
    error: invalid use of member (did you forget the '&' ?)

    Qt Code:
    1. const QPixmap *orig_pixmap = ui->label->pixmap();
    2. degrees++;
    3. if(degrees == 90) degrees = 0;
    4.  
    5. QTransform rotate_disc;
    6.  
    7.  
    8. rotate_disc.translate((orig_pixmap->width()-rotate->width())/2 , (orig_pixmap->width()-rotate->height())/2);
    9. rotate_disc.rotate(degrees,Qt::ZAxis);
    10.  
    11. QPixmap pixmap;
    12. //pixmap = orig_disc->scaled(89,89,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
    13. pixmap = orig_pixmap->transformed(rotate_disc,Qt::SmoothTransformation);
    14. ui->label->setPixmap(pixmap);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

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

    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()"?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

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

    Second statement meaning "degrees++"? What is the type of "degrees"? Do you have a method with that name?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

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

    yes, that was it.
    Last edited by saman_artorious; 26th March 2013 at 04:13.

Similar Threads

  1. invalid use of this in non member function
    By dineshkumar in forum Qt Programming
    Replies: 7
    Last Post: 13th December 2015, 19:37
  2. Replies: 2
    Last Post: 23rd February 2012, 12:23
  3. invalid use of member (did you forget the '&')
    By KBMoiloa in forum General Programming
    Replies: 3
    Last Post: 21st May 2011, 19:10
  4. fire and forget way for QProcess
    By qt_gotcha in forum Newbie
    Replies: 2
    Last Post: 17th August 2010, 19:42
  5. error:invalid use of member
    By quickNitin in forum General Programming
    Replies: 4
    Last Post: 19th June 2006, 15:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.