void Test::setLabelOpacity(int opacity)
{
m_label->setWindowOpacity(opacity / 100.0);
}
void Test::showLabel()
{
QRectF rectangle
(0.0,
0.0,
299.0,
299.0);
painter.setBrush(Qt::red);
painter.setPen(Qt::red);
painter.drawRoundedRect(rectangle, 20.0, 15.0);
m_label->setPixmap(pixmap);
m_label->setAttribute(Qt::WA_DeleteOnClose);
timeLine
->setCurveShape
(QTimeLine::LinearCurve);
timeLine->setFrameRange(0, 100);
connect(timeLine, SIGNAL(frameChanged(int)), SLOT(setLabelOpacity(int)));
timeLine->start();
m_label->setWindowOpacity(0);
m_label->show();
}
void Test::setLabelOpacity(int opacity)
{
m_label->setWindowOpacity(opacity / 100.0);
}
void Test::showLabel()
{
QPixmap pixmap(300, 300);
QPainter painter(&pixmap);
QRectF rectangle(0.0, 0.0, 299.0, 299.0);
painter.setBrush(Qt::red);
painter.setPen(Qt::red);
painter.drawRoundedRect(rectangle, 20.0, 15.0);
m_label = new QLabel();
m_label->setMask(QBitmap(pixmap));
m_label->setPixmap(pixmap);
m_label->setAttribute(Qt::WA_DeleteOnClose);
QTimeLine *timeLine = new QTimeLine(1000, this);
timeLine->setCurveShape(QTimeLine::LinearCurve);
timeLine->setFrameRange(0, 100);
connect(timeLine, SIGNAL(frameChanged(int)), SLOT(setLabelOpacity(int)));
timeLine->start();
m_label->setWindowOpacity(0);
m_label->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks