<?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[Opacity and inheritance]]></title><description><![CDATA[<p dir="auto">Hi<br />
I have a container element that I want to set an opacity value for, but I don't want the 'contained' elements to get this opacity.<br />
Is there a way of achieving this?<br />
Container code</p>
<pre><code>import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import Qt.labs.location 1.0
import "../../Customisation"

Rectangle {
    id: frame
    property string title: ""
    property string contentSource: ""
    property string regionColor: ""
    height: label.height + loader.height + base.height

    color: "black"

    opacity: 0.5

    Label {
        id: label
        anchors.right: parent.right
        anchors.rightMargin: 0
        anchors.top: parent.top
        anchors.topMargin: 0
        anchors.left: parent.left
        anchors.leftMargin: 0
        font.pointSize: Style.appSection.fontSize
        color: Style.appSection.titleLabelColor
        text: title.toUpperCase()
        background: Rectangle {
            color: Style.appSection.titleLabelBackgroundColor
            height: 20
        }
    }

    Loader {
        id: loader
        anchors.top: label.bottom
        anchors.topMargin: 50
        width: childrenRect.width
        height : childrenRect.height

        source: contentSource


    }

    Rectangle {
        id: base
        height: 5
        color: regionColor
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        anchors.right: parent.right
        anchors.rightMargin: 0
        anchors.left: parent.left
        anchors.leftMargin: 0
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/99199/opacity-and-inheritance</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 02:42:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/99199.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 31 Jan 2019 15:52:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Opacity and inheritance on Tue, 05 Feb 2019 11:26:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yashpal">@<bdi>Yashpal</bdi></a><br />
Thanks - it worked</p>
]]></description><link>https://forum.qt.io/post/509566</link><guid isPermaLink="true">https://forum.qt.io/post/509566</guid><dc:creator><![CDATA[GrahamLa]]></dc:creator><pubDate>Tue, 05 Feb 2019 11:26:33 GMT</pubDate></item><item><title><![CDATA[Reply to Opacity and inheritance on Fri, 01 Feb 2019 11:27:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi! do not set opacity, instead set container rectangle color with alpha value<br />
color: "#80000000" should give you the desired outcome.</p>
<p dir="auto">Cheers!!</p>
]]></description><link>https://forum.qt.io/post/508939</link><guid isPermaLink="true">https://forum.qt.io/post/508939</guid><dc:creator><![CDATA[Yashpal]]></dc:creator><pubDate>Fri, 01 Feb 2019 11:27:19 GMT</pubDate></item></channel></rss>