<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to make ActiveQt Widget transparent in browser?]]></title><description><![CDATA[<p dir="auto">I create a browser plugin demo with the qtbrowserplugin ,and load it to IE browser, but  can not set it transparent.<br />
Override the paintEvent()</p>
<pre><code>	QPainter p(this);
	p.fillRect(rect(), QColor(255,0,0, 0));

</code></pre>
<p dir="auto">it will be show the  window default  background at Windows OS;<br />
Append a attribute :</p>
<pre><code>setAttribute(Qt::WA_TranslucentBackground);
</code></pre>
<p dir="auto">for this widget ,it will be show the black background;</p>
<p dir="auto">and this method</p>
<pre><code>	setAutoFillBackground(true);
	QPalette pal = palette();
	pal.setColor(QPalette::Background, QColor(100,100,100,0));
	setPalette(pal);
</code></pre>
<p dir="auto">it looks same as 2nd;</p>
<p dir="auto">What should I do?<br />
Thanks!!</p>
]]></description><link>https://forum.qt.io/topic/82470/how-to-make-activeqt-widget-transparent-in-browser</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 13:52:31 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/82470.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Aug 2017 10:59:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Tue, 22 Aug 2017 01:54:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi, I think the best approach is to change the <strong>css</strong> for the <strong>div</strong> for the .browserPluginDiv, try adding something like<br />
<code>background-color: rgba(255, 255, 255, 0.5);</code></p>
]]></description><link>https://forum.qt.io/post/411538</link><guid isPermaLink="true">https://forum.qt.io/post/411538</guid><dc:creator><![CDATA[hskoglund]]></dc:creator><pubDate>Tue, 22 Aug 2017 01:54:31 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Tue, 22 Aug 2017 01:46:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/l.gogs">@<bdi>L.Gogs</bdi></a><br />
thanks for reply.<br />
it is not display in the Mainwindow, but as a QtActive control in the IE browser.<br />
And  I have tried that, set stylesheet for the widget with "background:transparent", it will show likes case 3.<br />
if I stylesheet is "background-origin: content;background-position: center; background-repeat:no-repeat;background-image:url("f:/test_icon.png")", it  as following picture shows:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/cd15ed2b-ef81-45fa-8f0b-e47ada76959c.png" alt="alt text" class=" img-fluid img-markdown" /><br />
around of the test_icon.png is transparent area.<img src="https://ddgobkiprc33d.cloudfront.net/ec5c1a02-09e9-4639-8371-6c4c4565620b.png" alt="0_1503366361088_test_icon.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/411537</link><guid isPermaLink="true">https://forum.qt.io/post/411537</guid><dc:creator><![CDATA[niessen]]></dc:creator><pubDate>Tue, 22 Aug 2017 01:46:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Tue, 22 Aug 2017 01:27:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vinod-kuntoji">@<bdi>Vinod-Kuntoji</bdi></a><br />
I just resize the browser window, and the widget size is fixed.<br />
I don't know how to call update() function in the widget while resizing the IE window. if the background image is a gif, there will no resizing, no position changed, and how to notify the widget to update?</p>
]]></description><link>https://forum.qt.io/post/411536</link><guid isPermaLink="true">https://forum.qt.io/post/411536</guid><dc:creator><![CDATA[niessen]]></dc:creator><pubDate>Tue, 22 Aug 2017 01:27:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Mon, 21 Aug 2017 12:06:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/niessen">@<bdi>niessen</bdi></a></p>
<p dir="auto">Open Mainwindow stylesheet and write: background:transparent;</p>
]]></description><link>https://forum.qt.io/post/411423</link><guid isPermaLink="true">https://forum.qt.io/post/411423</guid><dc:creator><![CDATA[L.Gogs]]></dc:creator><pubDate>Mon, 21 Aug 2017 12:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Mon, 21 Aug 2017 11:25:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/niessen">@<bdi>niessen</bdi></a> ,</p>
<p dir="auto">Did you call  update() function  while resizing?</p>
]]></description><link>https://forum.qt.io/post/411416</link><guid isPermaLink="true">https://forum.qt.io/post/411416</guid><dc:creator><![CDATA[Vinod Kuntoji]]></dc:creator><pubDate>Mon, 21 Aug 2017 11:25:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Mon, 21 Aug 2017 11:16:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vinod-kuntoji">@<bdi>Vinod-Kuntoji</bdi></a><br />
it's just a very simple demo:<br />
In Qt 4.8.6, IE11;</p>
<p dir="auto">the header file:</p>
<pre><code>#ifndef BROWSERWIDGET_H
#define BROWSERWIDGET_H

class BrowserWidget: public QWidget, public QAxBindable
{
	Q_OBJECT

	Q_CLASSINFO("MIME", "application/x-browser-widget")
	Q_CLASSINFO("ClassID", "{1FF1F21C-464F-4460-9179-76D668CC6588}")
	Q_CLASSINFO("InterfaceID", "{57436653-AA44-42f4-BA0F-DD65A8A77AE6}")
	Q_CLASSINFO("EventsID", "{204C5D3B-75C3-4d5d-9347-D5A1216C6658}")

public:
	BrowserWidget(QWidget * parent = 0);

protected:
    virtual void paintEvent(QPaintEvent * e) override;
};

#endif // BROWSERWIDGET_H

</code></pre>
<p dir="auto">and the source file:</p>
<pre><code>#include "StdAfx.h"
#include "BrowserWidget.h"

BrowserWidget::BrowserWidget(QWidget * parent /*= 0*/): QWidget(parent)
{
	setMinimumSize(200, 100);
        //  ***********   1   ************
	//setWindowFlags(Qt::FramelessWindowHint);
	//setAttribute(Qt::WA_TranslucentBackground);

        //  ***********   2   ************
	//setWindowOpacity(0.9);

        //  ***********   3   ************
	//setAutoFillBackground(true);
	//QPalette pal = palette();
	//pal.setColor(QPalette::Background, Qt::transparent);
	//setPalette(pal);

	QLabel * label = new QLabel(this);
	label-&gt;setFixedSize(200, 100);
	label-&gt;setText("hello world");

}

BrowserWidget::paintEvent(QPaintEvent* e)
{
     //  ***********   4   ************
    //QPainter p(this);
    //p.fillRect(rect(), Qt::transparent);
}
</code></pre>
<p dir="auto">There is html content.</p>
<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;style type="text/css"&gt;
			html,body{
			    margin:0;
				padding:0;
				width:100%;
				height:100%;
				position:relative;
				background:url(bristleGrass.jpg) no-repeat center center;
				background-size:50%,50%;
			}
            .browserPluginDiv{
                width:800px;
                height: 450px;
                position: absolute;
                top:300px;
                left: 100px;
                z-index: 0;
                
            }
			#browserPlugin{
				position:absolute;
				left:0;
				top:10px;
				z-index:200;
				
			}
        &lt;/style&gt;
    &lt;/head&gt;  
    &lt;body&gt;  
        &lt;div id="browserPluginDiv" class="browserPluginDiv"&gt;
			&lt;object id="browserPlugin" classid="clsid:1FF1F21C-464F-4460-9179-76D668CC6588" width="160" height="90"&gt;&lt;/object&gt;	
		&lt;/div&gt;
    &lt;/body&gt; 
&lt;/html&gt;
</code></pre>
<p dir="auto"><strong>The background image is set in the html page.</strong><br />
<strong>case 1:</strong><br />
at first show, it looks like transparent, but it not repaint when I resize the browser window.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/ae7a0869-8199-4c17-a2aa-25aa0063f0b9.gif" alt="0_1503302402313_1.gif" class=" img-fluid img-markdown" /><br />
And when I click the browser minisize button, then restore it , it will show the default background color.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/82230a99-436c-4700-84b1-197f36b82e8c.png" alt="alt text" class=" img-fluid img-markdown" /><br />
<strong>case 2:</strong><br />
same as case 1.<br />
<strong>case 3:</strong><br />
it always show the black color.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/3635300e-72e6-4f1d-a1af-608c565883e9.png" alt="alt text" class=" img-fluid img-markdown" /><br />
<strong>case 4:</strong><br />
<img src="https://ddgobkiprc33d.cloudfront.net/f906bc72-9985-4aa9-a9e1-26652f5c12a0.png" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/411401</link><guid isPermaLink="true">https://forum.qt.io/post/411401</guid><dc:creator><![CDATA[niessen]]></dc:creator><pubDate>Mon, 21 Aug 2017 11:16:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Mon, 21 Aug 2017 03:25:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/niessen">@<bdi>niessen</bdi></a> ,</p>
<p dir="auto">Please show me your code</p>
]]></description><link>https://forum.qt.io/post/411343</link><guid isPermaLink="true">https://forum.qt.io/post/411343</guid><dc:creator><![CDATA[Vinod Kuntoji]]></dc:creator><pubDate>Mon, 21 Aug 2017 03:25:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Mon, 21 Aug 2017 01:15:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vinod-kuntoji">@<bdi>Vinod-Kuntoji</bdi></a><br />
it dosen’t work yet！：(</p>
]]></description><link>https://forum.qt.io/post/411338</link><guid isPermaLink="true">https://forum.qt.io/post/411338</guid><dc:creator><![CDATA[niessen]]></dc:creator><pubDate>Mon, 21 Aug 2017 01:15:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Fri, 18 Aug 2017 03:40:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/niessen">@<bdi>niessen</bdi></a> said in <a href="/post/410912">How to make ActiveQt Widget transparent in browser?</a>:</p>
<blockquote>
<p dir="auto">setAttribute(Qt::WA_TranslucentBackgro</p>
</blockquote>
<p dir="auto">widget-&gt;setWindowOpacity(0.4);</p>
]]></description><link>https://forum.qt.io/post/411080</link><guid isPermaLink="true">https://forum.qt.io/post/411080</guid><dc:creator><![CDATA[Vinod Kuntoji]]></dc:creator><pubDate>Fri, 18 Aug 2017 03:40:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Fri, 18 Aug 2017 00:44:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vinod-kuntoji">@<bdi>Vinod-Kuntoji</bdi></a><br />
Thanks for replay. but it not work. still show the default background color .</p>
]]></description><link>https://forum.qt.io/post/411058</link><guid isPermaLink="true">https://forum.qt.io/post/411058</guid><dc:creator><![CDATA[niessen]]></dc:creator><pubDate>Fri, 18 Aug 2017 00:44:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to make ActiveQt Widget transparent in browser? on Thu, 17 Aug 2017 12:00:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/niessen">@<bdi>niessen</bdi></a> ,</p>
<p dir="auto">You can try, painter-&gt;setOpacity(val);</p>
]]></description><link>https://forum.qt.io/post/410950</link><guid isPermaLink="true">https://forum.qt.io/post/410950</guid><dc:creator><![CDATA[Vinod Kuntoji]]></dc:creator><pubDate>Thu, 17 Aug 2017 12:00:40 GMT</pubDate></item></channel></rss>