尝试使用以下内容向QScrollArea添加背景:
scrollArea = new QScrollArea(this);
scrollArea->setObjectName("scrollArea");
scrollWidget = new QWidget(scrollArea);
scrollWidget->setObjectName("scrollWidget");
scrollArea->setWidget(scrollWidget);
scrollArea->setStyleSheet(QString()
+ "#scrollArea { "
+ "border: none; "
+ "background: url(" + background + "); "
+ "background-attachment: fixed; "
+ "background-position: top center; "
+ "} #scrollWidget { background: transparent; } "
);
除了滚动区域的背景也在滚动条后面之外,这个工作正常:
有没有办法让滚动条使用滚动区域后面窗口的背景或其他方式让它们使用自然背景?