2012-04-26 320 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 
    }