Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
4.6.0
-
None
-
Gentoo Linux (X11), Qt-4.6.0, gcc-4.4.2
-
eb94abb952114e826e02ba4562d9048e77f46644
Description
QPixmap::transformed() returns a bad (badly cached, I guess) pixmap in certain cases using Qt-4.6.0. AFAIK Qt-4.5.x isn't affected.
QImage::transformed() works correctly.
This bug can be reproduced using the following example (sorry for using QPixmap::scaled() - but it uses transformed() internally):
#include <QApplication> #include <QColor> #include <QIcon> #include <QHBoxLayout> #include <QPixmap> #include <QToolButton> #include <QWidget> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget *window = new QWidget; QHBoxLayout *layout = new QHBoxLayout(window); QToolButton *btn = 0; btn = new QToolButton(window); QPixmap p1(20, 20); p1.fill(Qt::black); p1 = p1.scaled(15, 15); // here <--v btn->setIcon(QIcon(p1)); btn->setToolTip("black"); layout->addWidget(btn); btn = new QToolButton(window); QPixmap p2 = QPixmap(20, 20); p2.fill(Qt::red); p2 = p2.scaled(15, 15); // if the size is exactly the same as here ^, // a bug is triggered (we get black pixmap here) btn->setIcon(QIcon(p2)); btn->setToolTip("red"); layout->addWidget(btn); // similar example: btn = new QToolButton(window); QPixmap p(20, 20); p.fill(Qt::green); p = p.scaled(25, 25); // if it was QSize(15, 15), we would get black pixmap btn->setIcon(QIcon(p)); btn->setToolTip("green"); layout->addWidget(btn); btn = new QToolButton(window); p = QPixmap(20, 20); // without this line the bug isn't trigerred (I don't get it...) p.fill(Qt::yellow); p = p.scaled(25, 25); // we get green pixmap here btn->setIcon(QIcon(p)); btn->setToolTip("yellow"); layout->addWidget(btn); window->show(); return app.exec(); }