Originally Posted by
nagpalma
Hi,
I confirm, QPainter::setOpacity() had no effect after use setWindowOpacity().
Any suggestions?
Thanks,
nagpalma
This code works for me on windows Xp
Transparent
::Transparent(QWidget *parent
) setWindowTitle(tr("Transparent Window"));
setWindowOpacity(0.2f);
}
p.
setPen( QPen( Qt
::red ) );
p.setOpacity(1.0f);
p.drawLine(0, 0, 50, 50);
p.setOpacity(0.0f);
}
int main(int argc, char *argv[]){
Transparent w;
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
Transparent::Transparent(QWidget *parent)
: QWidget(parent) {
setWindowTitle(tr("Transparent Window"));
setWindowOpacity(0.2f);
}
void Transparent::paintEvent(QPaintEvent *) {
QPainter p(this);
p.setPen( QPen( Qt::red ) );
p.setOpacity(1.0f);
p.drawLine(0, 0, 50, 50);
p.setOpacity(0.0f);
}
int main(int argc, char *argv[]){
QApplication a(argc, argv);
Transparent w;
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks