[Qt-interest] QPainter::drawPixmap drawing partial image on first running
Arun Kumar
arunkumaraymuo at gmail.com
Mon Feb 13 07:56:05 CET 2012
Hi,
I created a banner to display image on Label for that I subclassed QLabel
to a new class and override its events, Now my problem is sometime it
display image in distorted manner (One image on top of the another with
partial draw) I dont understand why this happening, I tried
"this->update();" function to refresh it, but the problem still exist, my
code is given below and my development environment is on Mac OS
void QPictureLabel::setPixmap(QPixmap aPicture)
{
if (_qpSource.isNull()) //no image was set, don't draw anything
return;
_qpSource = _qpCurrent = aPicture;
repaint();
}
void QPictureLabel::paintEvent(QPaintEvent *aEvent)
{
QLabel::paintEvent(aEvent);
float cw = width(), ch = height();
_qpCurrent = _qpSource.scaled(cw,
ch,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
QPainter paint(this);
paint.drawPixmap(0, 0, _qpCurrent);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20120212/dcbfba4f/attachment.html
More information about the Qt-interest-old
mailing list