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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.