Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to find intersection rectitem co ordinates
Qt 6.12 LTS is out! See what's new in the release blog

How to find intersection rectitem co ordinates

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.2k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    hi, i have small problem i have one rect angle in horizentel direction rect1(3,3,25,7) and another rectangle in vertical direction rect2(5,5,8,20) rect2 is on rect1 is there any direct function to find the intesected area(it is in rect angle shape) some one please tell me how to find the co ordinates of that rectitem....

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Your horizontal item seem to have the coordinates
      rect1 (xmin = 3, ymin = 3, xmax =3+25=28, ymax = 3+7=10)
      the one has
      rect2 (xmin = 5, ymin = 5, xmax =5+8=13, ymax = 5+20=25)
      The maximum rectangle is formed by all "extreme" coordinates:
      rectmax (xmin = 3, ymin = 3, xmax =28, ymax=25)
      The minimum rectangle is formed by
      rectmin(xmin=5,ymin=5,xmax=13,ymax=10)
      I guess you are looking for the later one.
      There are also a number of webpage around to find the proper formulas for none horizotal and vertical lines. "e.g.":http://paulbourke.net/geometry/lineline2d/

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        thank you so much for your reply ...(3,3,25,7)(x,y,width,height)...the horizental and vertical rect angles are one on the other then some part of area is common for both rectitems it is also in rectangle shape...i want to find that rect angle(x,y,width,height)...

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          It's Qt, man! Everything is done for you. Try this :
          @
          QRect rect1(3,3,25,7);
          QRect rect2(5,5,8,29);
          QRect rect3=rect1 & rect2;
          @

          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
          • Unsolved