
Originally Posted by
wysota
Because it doesn't work that way.
QWMatrix m;
m.rotate(-45);
QRect newRect
= m.
mapRect(rect
());
QWMatrix m;
m.rotate(-45);
QRect newRect = m.mapRect(rect());
To copy to clipboard, switch view to plain text mode
Look closely what each method does and returns.
Yep thnx alot. But i see stil some mis calculation in my methods i have one main class which has these two functions and it is XView: QFrame -
double XView::Rotate(double a_dRotate)
{
QWMatrix m;
m.rotate(22);
QRect newRect
= m.
mapRect(rect
());
return a_dRotate;
}
void XView::Rotate(double a_dRotate, double x, double y)
{
double rotateView = Rotate(a_dRotate);
x *= rotateView;
y *= rotateView;
}
double XView::Rotate(double a_dRotate)
{
QWMatrix m;
m.rotate(22);
QRect newRect = m.mapRect(rect());
return a_dRotate;
}
void XView::Rotate(double a_dRotate, double x, double y)
{
double rotateView = Rotate(a_dRotate);
x *= rotateView;
y *= rotateView;
}
To copy to clipboard, switch view to plain text mode
In my other class which is View: XView, i have a slot which should do the rotation and it is as follows:
void View::SlotRotate()
{
//in this place the rectangle is calculated,
int x = -( m_Dev.Left() - ((View.left() + View.right()) ) );
int y = -( m_Dev.Top() - ((View.top() + View.bottom()) ) );
Rotate(22, x, y);
}
void View::SlotRotate()
{
QRect View = rect();
//in this place the rectangle is calculated,
int x = -( m_Dev.Left() - ((View.left() + View.right()) ) );
int y = -( m_Dev.Top() - ((View.top() + View.bottom()) ) );
Rotate(22, x, y);
}
To copy to clipboard, switch view to plain text mode
I see that its not working properly.
Bookmarks