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. [SOLVED] Polygon with holes fading
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Polygon with holes fading

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.1k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    carlinski
    wrote on last edited by
    #1

    I have managed to get a polygon with holes appearing. However the holes get darker and darker for some reason?

    Here is an example...

    !http://www.streettrack.co.uk/polygonhole.jpg(Example of polygon hold)!

    Here is the code:

    @
    QPainterPath path;
    path.addPolygon(poly); // Outer region.
    if (v_polyinner.size() > 0)
    {
    QPainterPath inner;
    for (int iPoly = 0; iPoly < v_polyinner.size(); iPoly++)
    {
    inner.addPolygon(v_polyinner[iPoly]);
    }
    path = path.subtracted(inner);
    }

    stringstream sscolour;
    sscolour << "#" << polyi->getColour();
    QColor colour(QString::fromStdString(sscolour.str()));
    colour.setAlpha(127);
    QBrush brush(colour);
    painter.setBrush(brush);
    if (this->sSelectedItemGUID == polyi->getFeatureGUID()) painter.setPen(penHighlight);
    painter.fillPath(path, brush);
    @

    It's seems as though as each polygon is added is goes darker.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      carlinski
      wrote on last edited by
      #2

      Whoops, made a mistake loading the coordinates, so multiple polys were on top of each other and gradually fading the holes out.

      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