Results 1 to 4 of 4

Thread: How to get an image from QList data

  1. #1
    Join Date
    Jul 2015
    Posts
    2
    Qt products
    Qt5

    Question How to get an image from QList data

    For example,in the QList are Sixteen zeros,how could I get a 4*4 image through these data.(Each pixel are represented by 0).

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get an image from QList data

    Construct a QImage with the size and format you want, then call QImage::fill(0).

  3. #3
    Join Date
    Jul 2015
    Posts
    2
    Qt products
    Qt5

    Default Re: How to get an image from QList data

    0 is just an example data,could you teach me how to load the data to the image pixels?I mean the pixels are coming from the QList data.I have read the help doc of Qt,but I could not know how to use it. I really need a demo codes.

  4. #4
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get an image from QList data

    Since you have read the documentation of QImage, you must have noticed a whole section that explains how to change the color of a pixel. All you need to do is do that in a loop that iterates over the pixels and the QList.

Similar Threads

  1. Replies: 3
    Last Post: 17th September 2013, 19:40
  2. Using QList data from other .cpp file
    By kango in forum Newbie
    Replies: 4
    Last Post: 13th February 2013, 18:31
  3. QList of variable data type?
    By Phlucious in forum Qt Programming
    Replies: 13
    Last Post: 2nd December 2011, 01:25
  4. QList custom data format
    By sureshkvl in forum Qt Programming
    Replies: 1
    Last Post: 13th October 2010, 14:26
  5. Replies: 4
    Last Post: 20th August 2010, 14:54

Tags for this Thread

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.