函数声明:void QPainter::drawImage ( const QRectF & target, const QImage & image, const QRectF & source, Qt::ImageConversionFlags flags = Qt::AutoColor )
举例:
QRectF target(10.0, 20.0, 80.0, 60.0); //建立目标矩形
QRectF source(0.0, 0.0, 70.0, 40.0); //建立源矩形,用来框定源图像文件中要显示的部分
QImage image(":/images/myImage.png"); //建立QImage类对象image
QPainter painter(this);
painter.drawImage(target, image, source); //将源图像文件中(0.0, 0.0, 70.0, 40.0)位置的图像画到painter device中的
//(10.0, 20.0, 80.0, 60.0)位置上,大小自适应
bool QRect::contains ( const QPoint & point, bool proper = false ) const
如果被给的点在矩形内部或者边缘上,返回true。否则返回错。如果参数proper是true,这个函数返回true,只用当被给的点是在矩形的内部(不在边上)。
bool QRect::contains ( int x, int y, bool proper ) const
这是一个重载函数。
返回true,如果点(x,y)是在矩形的内部或者边缘上。否则返回false。同上
bool QRect::contains ( int x, int y ) const
这也是一个重载函数
如果点(x,y)在矩形内部,返回true,否则返回false
bool QRect::contains ( const QRect & rectangle, bool proper = false ) const
这是一个重载函数。同上
void QRect::getCoords ( int * x1, int * y1, int * x2, int * y2 ) const
获取矩形的左上角位置到x1和y1,并且右下角的位置到x2、y2
void QRect::getRect ( int * x, int * y, int * width, int * height ) const
获取矩形的左上角位置到x、y,并且它的尺寸到width和heigth
int QRect::height () const
返回高
QRect QRect::intersected ( const QRect & rectangle ) const
返回两个矩形的交集。
bool QRect::intersects ( const QRect & rectangle ) const
如果矩形相交返回true。
这个交集能被获得通过intersected()函数。
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ypoflyer/archive/2010/05/10/5573768.aspx