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. QRect ,getting rid of points in the rect,need help!
Forum Updated to NodeBB v4.3 + New Features

QRect ,getting rid of points in the rect,need help!

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 790 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.
  • musimbateM Offline
    musimbateM Offline
    musimbate
    wrote on last edited by
    #1

    Hi guys,
    I have a 2D matrix containing QPoints and I want to select rows whose all points are contained in a certain QRect and strore those row indexes in some kind of list.
    I have put the following piece of code together to do the job but it is selecting all the points.I am sure I am doing things wrong here and I can't figure it out yet.Here is the code:

    @

    for(int i=0;i<rows;i++)
    {
    for(j=0;j<columns;j++)
    {
    if(!rect.contains(pointAt(i,j)))
    break;
    }
    rowIndexList.appeng(i);

    }

    @

    The idea is to go through each row and examine all the points.A row is discarded as soon as we find a point outside the rectangle.If all the points of the row are fine then we add the row to the selected indexes.I would like suggestions as to whether my logic is messed up some how here.

    Thanks for your time

    NOTE:This is a modification of another problem I have,I modified it for readability.I was getting no replies may be because it was presented clean .Please help .

    Why join the navy if you can be a pirate?-Steve Jobs

    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