Results 1 to 2 of 2

Thread: Setting background Image in Selected cell In CalenderWidget

  1. #1
    Join Date
    Apr 2011
    Posts
    25
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Setting background Image in Selected cell In CalenderWidget

    i hv tried this code in setting backgroundImage in a particular cell in CalenderWidget but an error occur..cn u please check the error..

    Qt Code:
    1. void PainterApp::paintEvent(QPaintEvent *)
    2. {
    3. QPainter painter(this);
    4. QRectF target(30.0, 40.0, 80.0, 60.0);
    5. QRectF source(30.0, 40.0, 70.0, 40.0);
    6. QImage image("C:/QTWork/back-icon.png");
    7.  
    8.  
    9. painter.drawImage(target, image, source);
    10.  
    11. ui->calendarWidget->paintCell(painter,target,QDate::currentDate());
    12.  
    13. painter.end();
    14. }
    To copy to clipboard, switch view to plain text mode 
    regards
    Anshuman

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Setting background Image in Selected cell In CalenderWidget

    error occur.
    1. in such cases post what the error is.
    2. Unless you are not posting from a cell phone, and your keyboard is fully functional, please don't use sms short writing, it is really annoying and is NOT cool!

    I guess the error has to do with paintCell() being protected.
    If so, read about C++ class inheritance, and what 'public' 'protected' and 'private' mean.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Problems setting a background image
    By franco.amato in forum Qt Programming
    Replies: 10
    Last Post: 28th January 2011, 23:33
  2. Replies: 1
    Last Post: 3rd July 2010, 12:17
  3. Setting QDial background image using stylesheet
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2010, 14:13
  4. Setting background image for Central Widget
    By xfurrier in forum Qt Programming
    Replies: 8
    Last Post: 25th February 2010, 11:14
  5. Setting background image of QFrame
    By Claymore in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2007, 20:50

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.