Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainterPath::drawPath
Forum Update on Monday, May 27th 2025

QPainterPath::drawPath

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 646 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxg0
    wrote on last edited by
    #1

    Hi,

    I am working on a new application which uses a QPainterPath::drawPath function. It all works fine, however at some point the new drawn path starts erasing the old one!
    There could be something wrong in the application algorithm, however is there anything I should be aware of in relation to drawPath which could cause such a behaviour?

    Code fragment:
    @
    QPainterPath qtPath;
    QColor colour;
    std::vector<std::pair<QColor, QPainterPath> > ret;
    const size_t size = path.GetTotalNumPoints();
    if (size)
    {
    RobotGraphicsPath::Point pt = path.GetPoint(0);
    colour = path.GetColour(0);
    qtPath.moveTo(pt.x, pt.y);
    }
    for (size_t i = 1; i < size; ++i)
    {
    RobotGraphicsPath::Point pt = path.GetPoint(i);
    qtPath.lineTo(pt.x, pt.y);
    if (path.GetColour(i) != colour) // If the colour has changed from the last point to this point start a new path.
    {
    ret.push_back(std::make_pair(colour, qtPath));
    qtPath = QPainterPath();
    qtPath.moveTo(pt.x, pt.y); // Start next path where last path ends
    colour = path.GetColour(i);
    }
    }
    ret.push_back(std::make_pair(colour, qtPath));
    return ret;
    @

    Thanks

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved