[Qt-interest] Qt-interest Digest, Vol 6, Issue 142
Stefanos Antaris
santaris at csd.auth.gr
Sat May 16 14:43:38 CEST 2009
Stefanos Antaris wrote:
> qt-interest-request at trolltech.com wrote:
>> Send Qt-interest mailing list submissions to
>> qt-interest at trolltech.com
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>> or, via email, send a message with subject or body 'help' to
>> qt-interest-request at trolltech.com
>>
>> You can reach the person managing the list at
>> qt-interest-owner at trolltech.com
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Qt-interest digest..."
>>
>>
>> Today's Topics:
>>
>> 1. Re: draw a pixmap with a table (Ender EREL)
>> 2. QT and SNMP NMS (Kosta)
>> 3. Data has to be valid on rowsAboutToBeRemoved? (Emil Eriksson)
>> 4. Re: Data has to be valid on rowsAboutToBeRemoved? (Arnold Krille)
>> 5. Need help: Build qt 4.5.1 for Mac OS X leopard (10.5.7) with
>> cocoa but get library for carbon (Lei Zhang)
>> 6. Re: Communication Problem (Tim W)
>> 7. QTableView/QSqlTableModel: how to set order of columns in
>> header ? (Stephen Collyer)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 15 May 2009 17:57:37 +0300
>> From: Ender EREL <erelender at yahoo.com>
>> Subject: Re: [Qt-interest] draw a pixmap with a table
>> To: qt-interest at trolltech.com
>> Message-ID: <gujvt2$i19$1 at eple.troll.no>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> 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.
>>
>>
> Ok.Assistant really helps but what i have to do is to receive an
> unsigned char table.Every cell has only one value.Not three.The qt
> assistant's example take a qRgb value and the pixels is shown using
> that value.What i have to do is to turn the unsigned char to Ascii and
> put this value to each pixel.If i am doing this my example crash.Here
> is my code.
> [code]
> QImage img(500,500,QImage::Format_Indexed8);
> for(i=0;i<500;i++)
> for(int k=0;k<500;k++){
> QChar c = (QChar)testMap[i][k];
> img.setPixel(i,k,c.toAscii());
> ui->showMapLabel->setPixmap(QPixmap::fromImage(img));
> }
>
> [/code]
> Any help?
One more think.I want to do it on grayscale.I tried to paint the label
just on one pixel but it shows me a lot of colors.And it is shown in all
the QLabel.Not on a pixel.
Co
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090516/e75dbce0/attachment.html
More information about the Qt-interest-old
mailing list