Results 1 to 19 of 19

Thread: how to use loadFromData in painter

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    123
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default how to use loadFromData in painter

    hi everyone,

    i have a RGB values in an character array. can anyone say me to use loadFromData function in QPixmap inorder to convert the RGB datas to a pixmap...?
    i did as follows:

    Qt Code:
    1. void paintEvent(QPaintEvent *)
    2. {
    3. unsigned char buffer[20]={0,0,0,0,0,255,255,255,255,255,0,0,0,0,0};
    4. QPixmap pixmap;
    5. if(pixmap.loadFromData(buffer,20,0,QPixmap::Auto);
    6. QPainter p(this);
    7. p.drawPIxmap(0,0,pixmap,0,0,-1,-1);
    8. }
    To copy to clipboard, switch view to plain text mode 
    . the code gets compiled without error. but nothing is coming on the screen.can anyone provide suggestions for this...?
    are these steps correct...? if no can any correct me...?

    thanks in advance,

    saravanan
    Last edited by wysota; 22nd January 2007 at 14:22. Reason: missing [code] tags

Similar Threads

  1. Strange Painter behaviour
    By cwomeijer in forum Qt Programming
    Replies: 2
    Last Post: 4th September 2006, 20:52
  2. How to manage QPainter?
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2006, 13:20
  3. Painter not active!
    By Caius Aérobus in forum Qt Programming
    Replies: 7
    Last Post: 30th March 2006, 15:44

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.