Hello :
In my programe I used the fun setMask(pixmap->createHeuristicMask()), it is very slow
to transformation,if is other fun to transformation faster.
If I used setMask(*pixmap),the programe will break down ,and I must restart my computer .
and the programe is very use the memory,how can I don't new the pixmap all the time.
If someone can help me.
the code is here:
{
setWindowOpacity(transparency); //设置透明度
brush->setStyle(Qt::SolidPattern) ;
brush->setColor(Qt::lightGray) ;
pixmap
= new QPixmap(m_fwidth,m_fheight
);
painter
->setRenderHint
(QPainter::Antialiasing);
painter->translate(m_xcenter,m_ycenter);
painter->rotate(m_rotation) ;
painter->fillRect(-10,0,frulerw,frulerh,*brush) ;
painter->setPen(Qt::black) ;
//painter.setPen(Qt::SolidLine);
painter->drawRect(-10,0,frulerw,frulerh) ;
painter->setPen(Qt::black) ;
setPalette(*palette);
setMask(pixmap->createHeuristicMask(false));
delete painter ;
}
void Ruler::paintEvent(QPaintEvent *)
{
setWindowOpacity(transparency); //设置透明度
brush->setStyle(Qt::SolidPattern) ;
brush->setColor(Qt::lightGray) ;
pixmap = new QPixmap(m_fwidth,m_fheight);
painter = new QPainter(pixmap) ;
painter->setRenderHint(QPainter::Antialiasing);
painter->translate(m_xcenter,m_ycenter);
painter->rotate(m_rotation) ;
painter->fillRect(-10,0,frulerw,frulerh,*brush) ;
painter->setPen(Qt::black) ;
//painter.setPen(Qt::SolidLine);
painter->drawRect(-10,0,frulerw,frulerh) ;
painter->setPen(Qt::black) ;
setPalette(*palette);
setMask(pixmap->createHeuristicMask(false));
delete painter ;
}
To copy to clipboard, switch view to plain text mode
Bookmarks