Hi,
I want create my own QPixmap or QImage using my own data. so that I able to set this QPixmap to QLabel instead of drawing the same content again and again in paintEvent()
Thanks & Regards
Hi,
I want create my own QPixmap or QImage using my own data. so that I able to set this QPixmap to QLabel instead of drawing the same content again and again in paintEvent()
Thanks & Regards
Qt Code:
QPixmap pix; p.drawXYZ(); lablel->setPixmap(pix);To copy to clipboard, switch view to plain text mode
Hi,
I have tried this code but it is not working.
Added after 55 minutes:
Hi,
Again i tried but it doesn't work. Can you give me small code so that I can get help from it.
Last edited by sagirahmed; 27th October 2010 at 08:29.
What have you tried? Show us your code.
Qt Code:
void DrawImage() { painter.save(); labelPixmap->setPixmap(pix); }To copy to clipboard, switch view to plain text mode
This is my code that I have written. It show some garbage color on Label. Not showing the text
Last edited by wysota; 27th October 2010 at 10:38. Reason: missing [code] tags
First we have [CODE]-tags. Second is nonsense here! Third read the documentation about QPainter::drawText() especially what the point is defining. And forth: You might want to fill the pixmap with a color first because it is initialized with no specific value.
Hi,
Thanks I am successfully drawn the image using QPainter and set this image to Qlabel.
Thanks & Regards
Hi,
I want to create a large QPixmap. The size of QPixmap pix(741,2000000). It cause crashing when we execute the code is
QPixmap pix(741,2000000);
QPainter painter(&pix);
QColor clrbg(144,204,114);
pix.fill(clrbg); /// it crash at this point
So help me for creating very large pixmap
If you are not using the [CODE] tags I won't help you!
Hi,
I want to create a large QPixmap. The size of QPixmap pix(741,2000000). It cause crashing when we execute the code is
QPixmap pix(741,2000000);
QPainter painter(&pix);
QColor clrbg(144,204,114);
pix.fill(clrbg); /// it crash at this point
So help me for creating very large pixmap
741 * 2000000 = 1482000000 pixels
Considering 32 bit per pixel
741 * 2000000 * 32 bits are required
ie. 741 * 2000000 * 4 == 5928000000 bytes
ie 5789062 KB
ie 5653 MB
ie 5.5 GB
Do you even have that much RAM ??? Where do you think the memory will be allocated ?
Obviously its gonna crash !!
Hi,
So How can I solve this problem. If I have to create QPixmap of this size(741*2000000)
Hi,
How store short part Qpixmap on to disk. that I have I drawn using QPainter.
Am not sure, but you can try this -
pixmap is a IO device,, so you can use seek() to write to a particular point.
So use that and try writing smaller rects into the pixmap..
Be aware that for some picture formats, you can't just load a certain part of it.
Thus, when you want to save such a large file, you're going to get into trouble at some point. Always save files in managable parts and then create software that can stich those parts together. Look at google maps for example.
Hi,
so can you suggest me other way to create very large Qpixmap or any other class that will handle this. If I have to create QPixmap of this size(741*2000000)
I know take very huge amount of memory.
I'll give you an extremely powerfull tip:
Do NOT paint what is NOT on screen.
Unfortunatly, when you're dealing with jpg files for example, and you want to save a stupendously large file, you WILL get into problems very fast.
Either use another format that allows you to stream the file to disk or from disk or rethink what you're doing (like splitting up the very large jpg into 10 or 100 smaller jpg's)
Bookmarks