Results 1 to 2 of 2

Thread: problem in use of Qt::ConicalGradientPattern

  1. #1
    Join Date
    Jul 2014
    Posts
    95
    Thanks
    67

    Default problem in use of Qt::ConicalGradientPattern

    Hello,I have a problem in use of Qt::ConicalGradientPattern.please help me.thank you very very much.
    Qt Code:
    1. #ifndef PAINT_H
    2. #define PAINT_H
    3.  
    4. #include <QtWidgets>
    5.  
    6. class Lines : public QWidget
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. Lines(QWidget *parent = 0);
    12.  
    13. protected:
    14. void paintEvent(QPaintEvent *event);
    15. void drawLines(QPainter *qp);
    16.  
    17. };
    18. #endif // PAINT_H
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #include "lines.h"
    2. #include <QPainter>
    3.  
    4.  
    5. Lines::Lines(QWidget *parent)
    6. : QWidget(parent)
    7. {
    8.  
    9. }
    10.  
    11. void Lines::paintEvent(QPaintEvent *e)
    12. {
    13. Q_UNUSED(e);
    14. QPainter qp(this);
    15. drawLines(&qp);
    16. }
    17.  
    18. void Lines::drawLines(QPainter *qp)
    19. {QPen pen(Qt::black, 100, Qt::SolidLine);
    20. qp->fillRect(500,500,200,200,Qt::ConicalGradientPattern );
    21. qp->setPen(pen);
    22. qp->drawLine(100,100,100,100);
    23.  
    24. }
    To copy to clipboard, switch view to plain text mode 
    The error is: QBrush: Wrong use of a gradient pattern

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: problem in use of Qt::ConicalGradientPattern

    If you want to paint using a gradient, pass a properly set up QGradient.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    rezas1000 (4th September 2014)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.