Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    QPainterPath::drawPath

    General and Desktop
    1
    1
    491
    Loading More Posts
    • 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
      maxg0 last edited by

      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 Reply Quote 0
      • First post
        Last post