Results 1 to 4 of 4

Thread: QPainter::drawLineSegments

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPainter::drawLineSegments

    Hi,

    In Qt3, there is QPainter::drawLineSegments, what is the replacement in Qt4?

    Thanks...

  2. #2
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter::drawLineSegments

    I don't know what QPainter::drawLineSegments does,
    but among all the drawing methods of QPainter didn't you find any that fits your needs?

  3. #3
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPainter::drawLineSegments

    Quote Originally Posted by scascio View Post
    I don't know what QPainter::drawLineSegments does,
    but among all the drawing methods of QPainter didn't you find any that fits your needs?
    There is a workaround, but required extra coding...

  4. #4
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter::drawLineSegments

    Maybe you can use std::copy to convert your array into a QVector,
    then use drawPolygon since a QPolygon is a QVector<QPoint>

    Qt Code:
    1. QPointArray yourArray;
    2. QPolygon polygon(yourArray.size());
    3. std::copy(yourArray.begin(), yourArray.end(), polygon.begin())
    4. painter->drawPolygon(polygon);
    To copy to clipboard, switch view to plain text mode 

    Or maybe Qt provides container algorithm too.

    hope this helped you...

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.