display grayscale image using qt
<p>hello I want to display grayscale image using qt.
my problem is when i have image i get pixel with</p>

<pre><code>QRgb pixel=imagef-&gt;pixel(i,j);
int color= qGray(pixelfft);
</code></pre>

<p>then i apply some modifications then I return the pixel result to image which I want to display grayscale. 
I do that and this work with color images in my source </p>

<blockquote>
  <p>imagef->setPixel(i,j, qRgb(x,x,x));</p>
</blockquote>

<p>but when i choose white and black image then i do my treatment and when i display it that dosen't work only with this</p>

<blockquote>
  <p>imagef->setPixel(i,j,qGray(qRgb(x,x,x)));</p>
</blockquote>

<p>can i find how to display grayscale image with any type of image source?
please help me.</p>