全部博文(1493)
分类: LINUX
2013-10-31 20:56:16
原文地址:QT: QT下的几种透明效果 作者:wangchenxicool
QPalette pal = palette();
pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
setPalette(pal);
setAttribute(Qt::WA_TranslucentBackground, true );
setWindowOpacity(0.7)
void TestWindow::paintEvent( QPaintEvent* )
{
QPainter p(this );
p.setCompositionMode( QPainter::CompositionMode_Clear );
p.fillRect( 10, 10, 300, 300, Qt::SolidPattern );
}| QPushButton *bt =new QPushButton(this); |
| 2 | bt->setText("ok"); |
| 3 | bt->move(200,100); |
| 4 | bt->setFlat(true);//就是这句能够实现透明 |
QPushButton {
color: rgb(0,88,152)
background-color: rgba(97%,80%,9%,50%)
}
请参见C++ GUI Qt4编程(第二版)第19章 自定义外观