Results 1 to 2 of 2

Thread: How do I get red inside the ellipse?

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

    Default How do I get red inside the ellipse?

    Hello,How do I get red inside the ellipse?thanks.
    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. {
    20. QPen pen(Qt::red);
    21. qp->setPen(pen);
    22. qp->drawEllipse(100,200,200,100);
    23. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How do I get red inside the ellipse?

    Qt Code:
    1. QBrush brush(Qt::red);
    2. qp->setBrush(brush);
    To copy to clipboard, switch view to plain text mode 

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

    rezas1000 (8th September 2014)

Similar Threads

  1. How does one draw a 'cut down' ellipse using QPainter
    By Eos Pengwern in forum Qt Programming
    Replies: 3
    Last Post: 24th July 2012, 01:01
  2. QRadialGradient on Ellipse
    By negro.marchant in forum Qt Programming
    Replies: 0
    Last Post: 12th August 2010, 15:39
  3. Ellipse and rotation
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2009, 10:43
  4. QT3 to Qt4 port - problem seeing Ellipse etc
    By tanimbar in forum Qt Programming
    Replies: 3
    Last Post: 10th March 2008, 13:44
  5. how to display an Ellipse on a Qpainter.
    By mahe2310 in forum Qt Programming
    Replies: 6
    Last Post: 1st March 2006, 14:19

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.