Results 1 to 3 of 3

Thread: QPainter error: no match for call ...

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QPainter error: no match for call ...

    If I have a private QPainter :

    QPainter the_painter;

    If I use at paintEvent :
    void AnalogClock:: paintEvent(QPaintEvent *)

    {
    the_painter(this);
    ....
    I have :
    error: no match for call to '(QPainter) (AnalogClock* const)'

    I dont understand what is happen.
    Any idea?

  2. #2
    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: QPainter error: no match for call ...

    The compiler is certainly right. This call:
    Qt Code:
    1. the_painter(this);
    To copy to clipboard, switch view to plain text mode 
    is a function call of a function called "the_painter" passing it a "this" argument.

    I know you meant to call a constructor but the object is already constructed, you can't call a constructor directly in this context. Use QPainter::begin() (and then QPainter::end()) or don't store the painter as a member variable but instead create a local variable in the event handler.
    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.


  3. The following user says thank you to wysota for this useful post:

    tonnot (7th October 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPainter error: no match for call ...

    Aha ! Ok !

Similar Threads

  1. QPainter(&QPrinter) & QPainter(&QImage) communication
    By gufeatza in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2010, 07:25
  2. Replies: 5
    Last Post: 7th September 2009, 20:57
  3. QPainter::save and QPAinter::restore()
    By quickNitin in forum Newbie
    Replies: 2
    Last Post: 17th June 2006, 22:11
  4. How use QPainter
    By avis_phoenix in forum Newbie
    Replies: 3
    Last Post: 2nd June 2006, 15:02
  5. Replies: 3
    Last Post: 30th April 2006, 19:22

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.