PDA

View Full Version : problem in use of Qt::ConicalGradientPattern



rezas1000
4th September 2014, 13:51
Hello,I have a problem in use of Qt::ConicalGradientPattern.please help me.thank you very very much.;)

#ifndef PAINT_H
#define PAINT_H

#include <QtWidgets>

class Lines : public QWidget
{
Q_OBJECT

public:
Lines(QWidget *parent = 0);

protected:
void paintEvent(QPaintEvent *event);
void drawLines(QPainter *qp);

};
#endif // PAINT_H


#include "lines.h"
#include <QPainter>


Lines::Lines(QWidget *parent)
: QWidget(parent)
{

}

void Lines::paintEvent(QPaintEvent *e)
{
Q_UNUSED(e);
QPainter qp(this);
drawLines(&qp);
}

void Lines::drawLines(QPainter *qp)
{QPen pen(Qt::black, 100, Qt::SolidLine);
qp->fillRect(500,500,200,200,Qt::ConicalGradientPatter n );
qp->setPen(pen);
qp->drawLine(100,100,100,100);

}

The error is: QBrush: Wrong use of a gradient pattern

anda_skoa
4th September 2014, 18:19
If you want to paint using a gradient, pass a properly set up QGradient.

Cheers,
_