簡體   English   中英

QML:如何創建半透明/半透明的WebView元素?

[英]QML: how to create semi-transparent/ translucent WebView element?

我想知道如何創建一個透明的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透明?

您需要設置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
   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM