[Qt-interest] QGraphicItem rotate problem
Riccardo Roasio
riccardo.roasio at gmail.com
Mon Sep 28 15:18:50 CEST 2009
Hi,
I need to rotate a QGraphicItem and make a union between its QPolygon
and another QGraphicItem QPolygon in this way:
QString Table::attachBrother(Table *b)
{
int i;
int my_x=this->x();
int my_y=this->y();
int brother_x=b->x();
int brother_y=b->y();
int x_diff=brother_x-my_x;
int y_diff=brother_y-my_y;
attached_brothers<<b;
QPolygon polygon=b->getTablePolygon();
polygon.translate(x_diff,y_diff);
table_polygon=table_polygon.united(polygon);
std::cout << "Brother attached" << std::endl;
update();
....
If both objects have 0 degrees of rotation all is ok, but if i rotate
one or both of them so the union result in strange stuff.
I think is because rotating aa QGraphicItem mantains the original
points,so if one point is at -10,-10 and another is at -10,-20 after
the rotation they are in the same positions so this cause
preoblems....
There is a way to rotate also these points?
Thanks,
RIccardo
More information about the Qt-interest-old
mailing list