1、move 移动位置
/*对于父窗口(主窗口),坐标系统相对于屏幕
* 原点:相对于屏幕左上角
* x:往右递增
* y:往下递增
*/
move(100,100); //坐标相对于屏幕
/*子窗口,坐标系统相对于父窗口
* 原点:相对于窗口空白区域左上角(不包括边框)
* x:往右递增
* y:往下递增
*/
QPushButton *b1= new QPushButton(this); //指定父对象为窗口(this)
b1->move(100,100); //坐标相对于窗口
b1->resize(200,100); //设置按钮b1大小
QPushButton *b2= new QPushButton(b1); //指定父对象为按钮b1
b2->move(10,10); //坐标相对于按钮b1
2、translate 偏移坐标系
QPainter painter(this);
//>>1 右移一位,相当于width() / 2
painter.translate(width() >> 1,height() >> 1); //通过给定的偏移量转换坐标系统;也就是说,给定的偏移量被加到点上。
3、rotate 旋转坐标系
QPainter painter(this);
painter2.rotate(60); //顺时针旋转坐标系。给定的角度参数是度数。