The thing is widgets aren't supposed to overlap. You can put your scrollarea on top of another widget and without any special treatment it should be transparent. But if you start putting non-transparent stuff into it, it will not be transparent anymore.
#include <QtGui>
int main(int argc, char **argv){
l.resize(600,400);
l.setText("some very long text that is really extremely long so that it is long enough to be seen past the line edits");
area->setAutoFillBackground(false);
area->viewport()->setAutoFillBackground(false);
w->setAutoFillBackground(false);
for(int i=0;i<40;++i) {
la->addWidget(lab);
}
area->setWidget(w);
l.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char **argv){
QApplication app(argc, argv);
QLabel l;
l.resize(600,400);
l.setText("some very long text that is really extremely long so that it is long enough to be seen past the line edits");
QScrollArea *area = new QScrollArea(&l);
area->setGeometry(QRect(QPoint(0,0), QSize(600,400)));
area->setAutoFillBackground(false);
area->viewport()->setAutoFillBackground(false);
QWidget *w = new QWidget;
w->setAutoFillBackground(false);
QVBoxLayout *la = new QVBoxLayout(w);
for(int i=0;i<40;++i) {
QLabel *lab = new QLabel("xyz");
la->addWidget(lab);
}
area->setWidget(w);
l.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks