Results 1 to 8 of 8

Thread: Draw line with border

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2011
    Posts
    79
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw line with border

    Ok, in attached image I described what exactly I need.
    And the code how I do it now:
    Qt Code:
    1. QPoint line1[] = {QPoint(20,200),QPoint(400,200),QPoint(400,300),QPoint(20,300)};
    2. QPoint line2[] = {QPoint(100,100),QPoint(100,400),QPoint(200,400),QPoint(350,100)};
    3. QPen pen;
    4. pen.setCapStyle(Qt::RoundCap);
    5. pen.setJoinStyle(Qt::RoundJoin);
    6. pen.setColor(qRgb(201,199,182));
    7. pen.setWidth(14);
    8. painter.setPen(pen);
    9. painter.drawPolyline(line1,4);
    10. painter.drawPolyline(line2,4);
    11. pen.setColor(qRgb(237,234,200));
    12. pen.setWidth(10);
    13. painter.setPen(pen);
    14. painter.drawPolyline(line1,4);
    15. painter.drawPolyline(line2,4);
    To copy to clipboard, switch view to plain text mode 

    I was not successful with QPainterPathStroker and QPainterPath at all. It just draw closed lines and I really don't know how to use it.
    Rectangles ... ok guys, may be you use thermonuclear anisotropic grasper to eat spaghetti I just use a fork for that.
    It seems too confusing to me to draw a rectangle and rotate it when you need just line )))
    And anyway, it will be a bit problematic to connect one this "line" to others.
    As I understand it is impossible to draw line with border in Qt now and it is very frustrating to me.
    So I'll continue to use my method.
    Thanks to all who responded!
    Attached Images Attached Images

Similar Threads

  1. To draw a line
    By vinayaka in forum Qt Quick
    Replies: 1
    Last Post: 6th June 2011, 10:53
  2. How draw border in QProgressDialog?
    By kamlesh.sangani in forum Qt Programming
    Replies: 0
    Last Post: 5th June 2009, 11:32
  3. Replies: 2
    Last Post: 5th July 2008, 19:35
  4. Best way to draw a Line
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2008, 09:57
  5. How draw extra border on QGraphicsTextItem?
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 8th July 2007, 15:11

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
  •  
Qt is a trademark of The Qt Company.