2012-04-26 196 views
0

我不知道如何创建将transpalent一个的WebView元素(在透明窗口的术语如...) 我尝试类似:QML:如何创建半透明/半透明的WebView元素?

 Rectangle { 
      id: webBrowser 
      width: 100; height: 100 
      color: "red" 
      WebView { 
       html: "<style>body,html{background:transparent;background-color: rgba(1,255,0,0.5;)} </style><p>Hello</p>" 
      //  preferredWidth: 50 
       // preferredHeight: 50 
anchors.fill: parent 

      } 
     } 

,但似乎并没有帮助=(我该怎么办?做出的WebView透明

回答

1

您需要设置的WebView本身的透明度,而不仅仅是HTML内容:

WebView { 
    opacity: 0.5; 
    html: "<style>body,html{background:transparent;background-color: 
     rgba(1,255,0,0.5;)} </style><p>Hello</p>" 
    anchors.fill: parent 
    }