[Qt-interest] draw a pixmap with a table

Ender EREL erelender at yahoo.com
Fri May 15 16:57:37 CEST 2009


Stefanos Antaris wrote:
> Hello.I am going to receive a 2 dimension table which is going to have 
> unsigned char on each cell.Every cell is going to show me the brightness 
> of the pixels.Now i found that QPixmap can do that but i can't manage 
> it.Can anyone help me how could i draw a widget with that table?With 
> QPixmap or something else?Thanks.

First, create a QImage with the size of your table.
Second, set value of each pixel using myImage.setPixel(x,y,value).
Then, set pixmap of a label using 
mylabel->setPixmap(QPixmap::fromImage(myImage));

A little reference from the Assistant can answer a lot of questions.

-- 
Ender EREL



More information about the Qt-interest-old mailing list