Results 1 to 2 of 2

Thread: Sir, Find error in this code? Why am i not able to draw the symbols?

  1. #1
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sir, Find error in this code? Why am i not able to draw the symbols?

    Qt Code:
    1. class Symbol:public QwtSymbol{
    2.  
    3. public:
    4. Symbol(QwtSymbol *p=0);
    5. void drawSymbols(QPainter * painter, const QPointF * point, int numPoints) const;
    6. };
    7. Symbol::Symbol(QwtSymbol *p):QwtSymbol(p){
    8.  
    9. }
    10.  
    11. void Symbol::drawSymbols(QPainter *painter, const QPointF *point, int numPoints) const{
    12. QPixmap *pixx;
    13. pixx->load(":/Images/AlarmEvent.png");
    14. painter->drawPixmap(point,pixx);
    15. }
    16.  
    17.  
    18. // in constructor---->
    19. Symbol *symb;
    20. QPainter *pnt;
    21. for(int i=0;i<yData_1.size();i++){
    22. const QPointF point(xData_1.at(i),yData_1.at(i));
    23. mark_1[i]=new QwtPlotMarker;
    24. symb=new Symbol(QwtSymbol::drawSymbols(pnt, &point, 1));
    25. mark_1[i]->setSymbol(symb);
    26. mark_1[i]->setValue(xData_2.at(i),yData_2.at(i));
    27. mark_1[i]->attach(plot);
    28. }
    To copy to clipboard, switch view to plain text mode 

    Why am i not able to draw the symbol??????

    error i am getting is : no matching function for call to 'QPainter::drawPixmap(const QPointF*&, QPixmap*&)'

    E:\TempLog_Sonu1\TempLog\TempLogWidget.h:43: error: no matching function for call to 'QwtSymbol::QwtSymbol(QwtSymbol*&)'

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Sir, Find error in this code? Why am i not able to draw the symbols?

    Whenever you see such error message, check that your pointers are ok...

    You are trying to load the image file into an uninitialized pointer.
    Try this
    QPixmap pixx; // Make it a QPixmap, not a pointer to it. If you wish to have a pointer variable, you need to create the piix with 'new' operator
    pixx.load(":/Images/AlarmEvent.png");
    painter->drawPixmap(*point,pixx); // pass the point reference, not the pointer to it

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

    sonulohani (30th May 2012)

Similar Threads

  1. How to find debug or release mode using code?
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 14th December 2011, 07:42
  2. find source code for kde ( or gnome ) clock
    By FredB in forum KDE Forum
    Replies: 1
    Last Post: 31st March 2011, 23:01
  3. PyQt code to draw image from raw data?
    By StevenB in forum Qt Programming
    Replies: 5
    Last Post: 31st August 2010, 06:09
  4. Find one error
    By BadKnees in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2009, 15:33
  5. The error: /usr/bin/ld: cannot find -lphonon
    By learning_qt in forum Qt Programming
    Replies: 1
    Last Post: 1st October 2008, 22:12

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.