Hi,
in my QTableWidgetItems, I try to display a list of (3) strings vertically ordered and with a border.
For this border, I'd like to draw the rect in a loop and change its y-coordinate, so the same rect should be painted vertically shifted.
This is my code:
rectStringEvent.setY(rectCell.y() + 20); // position of the first string
rectStringEvent.setHeight(15); // rect height, should not be changed but it does!
for(int i = 0; i < 3; i++)
{
pPainter->drawText(rectStringEvent, listEvents.at(i));
pPainter->drawRect(rectStringEvent);
rectStringEvent.setY(rectStringEvent.y() + 15); // <--- this line is the problem: it also changes the rects height! But why?
}
rectStringEvent.setY(rectCell.y() + 20); // position of the first string
rectStringEvent.setHeight(15); // rect height, should not be changed but it does!
for(int i = 0; i < 3; i++)
{
pPainter->drawText(rectStringEvent, listEvents.at(i));
pPainter->drawRect(rectStringEvent);
rectStringEvent.setY(rectStringEvent.y() + 15); // <--- this line is the problem: it also changes the rects height! But why?
}
To copy to clipboard, switch view to plain text mode
I figured out that the rect's height is decreased by the number I increase the y-coordinate. I don't understand this behaviour. Why can't I just change the y-coordinate and the rect moves and still has it's prior height?
Thank you in anticipation.
Binary
Bookmarks