mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
do not create QImage in addition to QPixmap in QLabel
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
783b4e90e9
commit
ec682f91f2
2 changed files with 1 additions and 9 deletions
|
@ -41,7 +41,6 @@ QLabelPrivate::QLabelPrivate()
|
|||
margin(0),
|
||||
pixmap(nullptr),
|
||||
scaledpixmap(nullptr),
|
||||
cachedimage(nullptr),
|
||||
align(Qt::AlignLeft | Qt::AlignVCenter),
|
||||
indent(-1),
|
||||
scaledcontents(false),
|
||||
|
@ -990,10 +989,8 @@ void QLabel::paintEvent(QPaintEvent *ev)
|
|||
QPixmap pix;
|
||||
if (d->scaledcontents) {
|
||||
if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
|
||||
if (!d->cachedimage)
|
||||
d->cachedimage = new QImage(d->pixmap->toImage());
|
||||
delete d->scaledpixmap;
|
||||
d->scaledpixmap = new QPixmap(QPixmap::fromImage(d->cachedimage->scaled(cr.size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
|
||||
d->scaledpixmap = new QPixmap(d->pixmap->scaled(cr.size() ,Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
pix = *d->scaledpixmap;
|
||||
} else
|
||||
|
@ -1180,8 +1177,6 @@ void QLabelPrivate::clearContents()
|
|||
|
||||
delete scaledpixmap;
|
||||
scaledpixmap = 0;
|
||||
delete cachedimage;
|
||||
cachedimage = 0;
|
||||
delete pixmap;
|
||||
pixmap = 0;
|
||||
|
||||
|
@ -1305,8 +1300,6 @@ void QLabel::setScaledContents(bool enable)
|
|||
if (!enable) {
|
||||
delete d->scaledpixmap;
|
||||
d->scaledpixmap = 0;
|
||||
delete d->cachedimage;
|
||||
d->cachedimage = 0;
|
||||
}
|
||||
update(contentsRect());
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ public:
|
|||
QString text;
|
||||
QPixmap *pixmap;
|
||||
QPixmap *scaledpixmap;
|
||||
QImage *cachedimage;
|
||||
#ifndef QT_NO_MOVIE
|
||||
QPointer<QMovie> movie;
|
||||
void _q_movieUpdated(const QRect&);
|
||||
|
|
Loading…
Add table
Reference in a new issue