Hello Everyone........................
I wana convert a constant string into a pixmap .................
but I have no idea how will it happen????????
if anyone can help me ? I'll very thankful to him
Thanx
Hello Everyone........................
I wana convert a constant string into a pixmap .................
but I have no idea how will it happen????????
if anyone can help me ? I'll very thankful to him
Thanx
Can you elaborate ?I wana convert a constant string into a pixmap .................
Are you trying to save the contents of a textbox/textedit as pixmap ?? If yes, you may have a look at QWidget::render
Use this
Qt Code:
QPainter painter; painter.begin(&myPix); painter.drawText(myPix.rect(), Qt::AlignHCenter | Qt::AlignVCenter, "Hello to All"); painter.end();To copy to clipboard, switch view to plain text mode
A camel can go 14 days without drink,
I can't!!!
Thanx a lot mcosta........
I m very thankful to you...........you solved my problem
but again I need your help as u suggested I used that code in my program but problem is there how can we set the font size and font colour in that pixmap?????????
I m waiting your reply................
Add the "// NEW LINE" section to previous posted code
Qt Code:
QPainter painter; painter.begin(&myPix); // NEW LINES: START painter.setPen(Qt::yellow); // set Color to yellow // NEW LINES: STOP painter.drawText(myPix.rect(), Qt::AlignHCenter | Qt::AlignVCenter, "Hello to All"); painter.end();To copy to clipboard, switch view to plain text mode
A camel can go 14 days without drink,
I can't!!!
thanx, you are really great ..............
you solved my problem......thanx aonce again...........
But mcosta ,there is again a little problem is arising....i.e the pixmap does not contain whole string and how the set the background colour of this pixmap..................???
You can use QPainter::fillRect()
Qt Code:
.... painter.drawText(....); ....To copy to clipboard, switch view to plain text mode
A camel can go 14 days without drink,
I can't!!!
Thank you so much .......................
Now I have not any problem.................................
Bookmarks