这个问题与以下内容相关:
- http://www.qtcentre.org/threads/18151-QScrollArea-misbehaving-background-style
- http://www.qtforum.org/article/34443/cannot-change-background-color-of-a-qscrollarea-with-setstylesheet.html
我在这里问是因为我相信SO社区可能有一种方法来解决这个问题。
所以我想将ScrollArea的背景颜色设置为透明或自定义背景图像,因为它将包含一些横幅。我已经在Qt Creator(Designer)中运行它了! :-):
但是当将应用程序部署到模拟器时,它不起作用,该区域仍然是灰色的,深灰色的:
这是我的布局树:
这是我正在使用的样式表(已附加并设置为MainWindow):
QMainWindow {
background: transparent url(:/ui/designs/images_from_android/bg_plain_empty.png) top left;
}
QWidget#centralWidget {
background-color: transparent;
}
QPushButton {
color: red;
border: 1px solid green;
}
QFrame#top_header {
background: transparent url(:/ui/designs/images_from_android/bg_title_bar_landscape.png) top left repeat-x;
}
QWidget#top_banner_scroll1,
QWidget#top_banner_scroll2 {
background: transparent url(:/ui/designs/images_from_android/stripe_bg.png) top left repeat-x;
}
这相当令人困惑。而且由于Qt Designer向我显示了正确的设计,...
setStyleSheet("QScrollArea > QWidget > QScrollBar { background: palette(base); }");
_graphicsView->setStyleSheet("background: transparent");
- kambala_graphicsView
是什么?@kambala - bariodQScrollArea > QWidget > QScrollBar { background: <any integer>; }
) - bariodQGraphicsView
。 - kambala