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. Question about QPainterPathStroker::createStroke()

Question about QPainterPathStroker::createStroke()

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 243 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by
    #1

    I am "abusing" this function to create a polygon used for testing whether the user has moved the mouse or clicked inside of it. The idea is to provide tooltips and/or additional information about an edge in a GraphViz graph. Since GraphViz gives you a list of control points (B-splines) for each edge, I use the tinyspline library to re-calculate some of the points along the edge, create a QPainterPath from that, and then stroke it with width = 8 using the above function. Then I call the QPainterPath::toFillPolygon() function and add the polygon it returns to a "hit list", so to speak, (a member variable in my widget class) which is queried in the appropriate mouse event functions. The QPainterPath object itself is never used, except to get the polygon.

    However, my question is this:
    According to the documentation, it says: "The generated path should only be used for outlining the given painter path. Otherwise it may cause unexpected behavior." This seems rather strange to me because the stroked path is returned as an object, not a pointer or reference. I haven't noticed any strange behavior yet, but I do believe that one should take such warnings seriously.

    Am I in danger of undefined behavior here?

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      it's just a container of information for drawing graphics primitives. If all you are doing with it is generating a polygon then I'd gamble on being OK.

      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