#pragma once#include <QtGui>class CMainWindow:public QMainWindow{public: CMainWindow(QString pathParam); ~CMainWindow(void);private: QString path; QPixmap *pixmap; virtual void resizeEvent (QResizeEvent * event); virtual void paintEvent (QPaintEvent * event);};---------------------------#include "MainWindow.h"CMainWindow::CMainWindow(QString pathParam){ path=pathParam; pixmap=new QPixmap("e:\\anyshape\\debug\\01.bmp");}CMainWindow::~CMainWindow(void){}void CMainWindow::resizeEvent (QResizeEvent * event){ setMask(pixmap->mask());};void CMainWindow::paintEvent (QPaintEvent * event){ QRegion r1(pixmap->rect()); QPainter painter(this); painter.setClipRegion(r1); painter.drawPixmap(pixmap->rect(), *pixmap);};
QRegion rgn( int 0, int 0, int 100, int 100, QRegion::Ellipse);
this->setMask(rgn);