PDA

View Full Version : QGraphicsView Item not accepting moouse event after moving the items



deepal_de
30th August 2015, 09:23
im developing something like windows 8 style tile view with QGraphicsView.
user can move these tiles around. this movable functionality is not provided by ItemIsMovable flag since its little bit messy to handle rows and columns coordinates.
so i provided 4 button to move the item up,down,left and right.

when the item is moved the mouse event for the item is not accepted.
seems like the item has moved outside the QGraphicsScene view port.

im not a expert in QGraphicsView, :(
i tried re sizing the QGraphicsScene when the items are moved aroud, but it did not work

this is the code for getting the boundingRect() of the item , the code is little bit large to post here. il work on a small example and post a code sample if i can manage to re-create it. :)
when the items is moved aroudn m_column and m_row is incremented;


boundingRect()
{
int x = 10 + (m_column * TILE_WIDTH) + (TILE_SPACING * m_column);
int y = 90 + (m_row * TILE_HEIGHT) + (TILE_SPACING * m_row);

int width = TILE_WIDTH;
int height = TILE_HEIGHT;

QRectF rect(x , y, width, height);
return rect;
}

has anyone come across this kind of a problem?