Hi,

I noticed that gradient rendering has changed in latest snapshot, and I am not 
sure if it has been changed to fix a bug (i.e. my code is wrong), or if it is 
a regression.

I am attaching test case and resulting images.

Thanks.
#include <QtGui/QWidget>
#include <QtGui/QPainter>

class Canvas : public QWidget
{
    Q_OBJECT

    public:
        Canvas(QWidget *parent = 0) : QWidget(parent) {
            /* */
        }
        ~Canvas() {
            /* */
        }

    protected:
        void paintEvent(QPaintEvent *) {
            QPainter painter(this);
            painter.fillRect(QRect(0, 0, 120, 120), QColor(200, 200, 200));
            painter.fillRect(QRect(30, 5, 60, 110), QColor(220, 190, 180));
            paintGradient(&painter, QRect(10, 10, 100, 100));
        }

    private:
        void paintGradient(QPainter *painter, const QRect &rect)
        {
            QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
            gradient.setColorAt(0.0, QColor(0, 0, 0, 50));
            gradient.setColorAt(0.5, Qt::transparent);
            gradient.setColorAt(1.0, QColor(255, 255, 255, 80));
            painter->fillRect(rect, gradient);
        }
};


#include <QtGui/QApplication>
#include "Canvas.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Canvas canvas;
    canvas.resize(120, 120);
    canvas.show();
    return app.exec();
}


<<attachment: gradient-qt44.png>>

<<attachment: gradient-qt45.png>>

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to