<?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[Qt5 -&gt; Qt6 - partial window transparency]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I'm trying to port an application from Qt5 to Qt6, but I'm having some trouble getting (partial) window transparency to work in Windows (it works just fine in Linux).</p>
<p dir="auto">To test this, I simply created a new project in QtCreator for Qt5 (5.15) and Qt6 (6.2), so it's a simple Window with a "Hello World" title. I then add <code>color: #88000000</code> to both <code>Window</code> elements, build it and run it. The Qt5 version looks as expected, the window is black and partially transparent. The Qt6 version, however, does not have any transparency at all.</p>
<p dir="auto">If I do the same, however, on Linux, then both look exactly the same.</p>
<p dir="auto">Did anybody run into this before, or does anybody have an idea what to look into?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/146268/qt5-qt6-partial-window-transparency</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 17:16:00 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146268.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Jul 2023 03:42:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt5 -&gt; Qt6 - partial window transparency on Wed, 12 Jul 2023 13:38:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aran">@<bdi>aran</bdi></a> I would try setting view color and surface format before loading source<br />
Also, you might want to try different RHI backends, and see how they behave.</p>
]]></description><link>https://forum.qt.io/post/764600</link><guid isPermaLink="true">https://forum.qt.io/post/764600</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Wed, 12 Jul 2023 13:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5 -&gt; Qt6 - partial window transparency on Fri, 07 Jul 2023 18:52:22 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your reply!</p>
<p dir="auto">I've been using <code>QQmlApplicationEngine</code> to load and display the window. If I switch it to <code>QQuickView</code> I also don't get a transparent window.</p>
<p dir="auto">Here is the example code I'm running:</p>
<p dir="auto">main.cpp:</p>
<pre><code>#include &lt;QGuiApplication&gt;
#include &lt;QQmlApplicationEngine&gt;
#include &lt;QQuickView&gt;

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    // creating application using engine
    // when uncommenting this also make sure to replace
    // Rectangle by Window in Main.qml
/*    QQmlApplicationEngine engine;
    const QUrl url(u"qrc:/transparenttest/Main.qml"_qs);
    QObject::connect(&amp;engine, &amp;QQmlApplicationEngine::objectCreated,
        &amp;app, [url](QObject *obj, const QUrl &amp;objUrl) {
            if (!obj &amp;&amp; url == objUrl)
                QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);

    engine.load(url);*/

    // creating the application using view
    QQuickView *view = new QQuickView;
    view-&gt;setSource(QUrl("qrc:/transparenttest/Main.qml"));

    QSurfaceFormat surfaceFormat;
    surfaceFormat.setAlphaBufferSize(8);
    view-&gt;setFormat(surfaceFormat);
    view-&gt;setColor(QColor(qRgba(0,0,0,128)));
    view-&gt;show();

    return app.exec();
}
</code></pre>
<p dir="auto">(the commented out code is the default code provided by qt creator and (afaict) the recommended way (?) of creating qml applications.)</p>
<p dir="auto">Main.qml:</p>
<pre><code>import QtQuick
import QtQuick.Controls
import QtQuick.Window

// use Window when running it with QQmlApplicationEngine
//Window {
Rectangle {
    width: 640
    height: 480
    visible: true
    color: "#88000000"
}

</code></pre>
<p dir="auto">It also has some strange behavior when resizing the window, in particular when making it larger. The newly added areas are indeed semi-transparent. It seems like there is a central item or rectangle in the background that is all white at startup and stays around but doesn't resize...</p>
]]></description><link>https://forum.qt.io/post/764026</link><guid isPermaLink="true">https://forum.qt.io/post/764026</guid><dc:creator><![CDATA[aran]]></dc:creator><pubDate>Fri, 07 Jul 2023 18:52:22 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5 -&gt; Qt6 - partial window transparency on Fri, 07 Jul 2023 08:11:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aran">@<bdi>aran</bdi></a><br />
How do you create a Window?</p>
<p dir="auto">When using QQuickView, I can make it work with the following code:</p>
<pre><code>        // See https://stackoverflow.com/questions/14009549/how-to-make-a-transparent-window-with-qt-quick-2-0
        QSurfaceFormat surfaceFormat;
        surfaceFormat.setAlphaBufferSize(8);
        pQuickView-&gt;setFormat(surfaceFormat);
        pQuickView-&gt;setColor(QColor(Qt::transparent));
</code></pre>
<p dir="auto">(a semi-transparent color should work then, as well)</p>
]]></description><link>https://forum.qt.io/post/763958</link><guid isPermaLink="true">https://forum.qt.io/post/763958</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Fri, 07 Jul 2023 08:11:34 GMT</pubDate></item></channel></rss>