Results 1 to 2 of 2

Thread: paintEvent problem

  1. #1
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default paintEvent problem

    Dear Experts!!
    I have a problem with my painter. I want to paint my form by without using paint event.
    Is it possible? In some examples I saw that they use QPixmap for painting on it. Is it a good way to paint on a pixmap and locate it on my form?

    Thanks


    Qt Code:
    1. pixmap = QPixmap(100, 100);
    2. pixmap.fill(Qt::transparent);
    3.  
    4. QRadialGradient gradient(50, 50, 50, 50, 50);
    5. gradient.setColorAt(0, QColor::fromRgbF(1, 0, 0, 1));
    6. gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0));
    7. QPainter painter(&pixmap);
    8. painter.fillRect(0, 0, 100, 100, gradient);
    9.  
    10. channelImage = pixmap.alphaChannel();
    11. update();
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: paintEvent problem

    At some point a paintEvent will have to be used. Why do you want to avoid using paintEvent?

Similar Threads

  1. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 20:17
  2. Replies: 3
    Last Post: 27th November 2006, 09:56
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. Problem with QScrollArea updating from 4.0.1 to 4.1.0
    By SkripT in forum Qt Programming
    Replies: 8
    Last Post: 28th January 2006, 22:35

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
  •  
Qt is a trademark of The Qt Company.