【发布时间】:2017-09-02 04:25:42
【问题描述】:
在 QML 中,我实现了一个带有 SwipeView 的简单应用程序,如下所示:
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
Window {
visible: true
Rectangle{
id: bg
anchors.fill: parent
color: "red"
}
SwipeView {
id: swipeView
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: tabBar.top
currentIndex: tabBar.currentIndex
Page{
// Empty
}
Page{
Rectangle{
anchors.fill: parent
color:"purple"
}
}
}
TabBar {
id: tabBar
width: parent.width;
height: 30;
anchors.bottom: parent.bottom
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("Empty")
}
TabButton {
text: qsTr("Purple")
}
}
}
如果我删除 SwipeView,则 red 背景 Rectangle 显示,但只要 SwipeView 存在,它要么是 white 要么 紫色,具体取决于显示的页面。
选择紫色页面:
选择空白页面:
使用 swipeview 和 tabbar 注释掉:
那么,我怎样才能让红色背景发光(即让SwipeView 透明)?
【问题讨论】:
标签: qt colors background qml transparency