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. Invert Selection

Invert Selection

Scheduled Pinned Locked Moved Unsolved General and Desktop
selectionsubtractpathpolygon
4 Posts 3 Posters 2.7k 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.
  • D Offline
    D Offline
    DEADBEEF
    wrote on last edited by DEADBEEF
    #1

    Hi all!

    I’m working with QT in order to create a selection path. But now I would like to invert it, like the photoshop tool you know.

    I used the subtracted method to manage to get the invert selection BUT I got only one path. I would like to splite this path into small path/polygons since I use a personal class to print the selections.

    I know the methods ToFillPolygons & ToSubpathPolygons exist but they don’t give me what I need.

    Here is few drawing to understand what I need:

    First, the selections the user do in black: First Selection

    Then, in red, the result of the subtracted method: Inverted selection

    And here is what I’m looking for: How can I get only the 2 red polygons like this

    In a perfect world I would like to get 5 polygons because I cannot deal with hole inside my polygons for the moment, I mean I cannot remove the line which connect outer and inner polygons and I have something like this: ugly result.
    Now you can understand why I cannot use ToFillPolygons & ToSubpathPolygons method which give me this following result

    Thanks for your help

    D 1 Reply Last reply
    0
    • D DEADBEEF

      Hi all!

      I’m working with QT in order to create a selection path. But now I would like to invert it, like the photoshop tool you know.

      I used the subtracted method to manage to get the invert selection BUT I got only one path. I would like to splite this path into small path/polygons since I use a personal class to print the selections.

      I know the methods ToFillPolygons & ToSubpathPolygons exist but they don’t give me what I need.

      Here is few drawing to understand what I need:

      First, the selections the user do in black: First Selection

      Then, in red, the result of the subtracted method: Inverted selection

      And here is what I’m looking for: How can I get only the 2 red polygons like this

      In a perfect world I would like to get 5 polygons because I cannot deal with hole inside my polygons for the moment, I mean I cannot remove the line which connect outer and inner polygons and I have something like this: ugly result.
      Now you can understand why I cannot use ToFillPolygons & ToSubpathPolygons method which give me this following result

      Thanks for your help

      D Offline
      D Offline
      DEADBEEF
      wrote on last edited by
      #2

      Nobody has an idea?
      It's very important and this issue drives me crazy

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        You could use operator - like this:

        QPainterPath p1;
        p1.addRect(0.0, 0.0, 100.0, 150.0);
        
        QVector<QPointF> points;
            points << QPointF(60.0, 30.0)   << QPointF(100.0, 30.0)
                   << QPointF(100.0, 90.0)  << QPointF(0.0, 90.0)
                   << QPointF(0.0, 60.0)    << QPointF(60.0, 60.0)
                   << QPointF(60.0, 30.0);
        QPainterPath p2;
        p2.addPolygon(points);
        p2.addRect(20.0, 110.0, 60.0, 20.0);
        
        QPainterPath p3 = p1 - p2;
        

        Which gives:
        Selection

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jagir
          wrote on last edited by
          #4

          Hii..

          Sorry to disturb you but if you are free then please give me answer of below question

          https://forum.qt.io/topic/60399/adobe-photoshop-cc-2015-plugin

          I am newbie to this Qt framework.

          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