<?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[Updating property of sibling when pseudo-element changes]]></title><description><![CDATA[<p dir="auto">Not sure if I'm using the right terminology, so bear with me.</p>
<p dir="auto">I have a QCheckbox, and a QWidget (it can be a text, button, etc..) somewhere in my form.<br />
I want to know if it's possible to set the QWidget's <code>enabled</code> state, from the QCheckbox's <code>checked</code> pseudo-element.</p>
<p dir="auto">In C++ code this is what I mean</p>
<pre><code>void on_QCheckbox_stateChanged(int checked)
{
    if(checked == 2)
        ui-&gt;QWidget-&gt;setEnabled(true);
    else if(checked == 0)
        ui-&gt;QWidget-&gt;setEnabled(false);
};
</code></pre>
<p dir="auto">Is this possible using <em>only</em> stylesheets?</p>
]]></description><link>https://forum.qt.io/topic/137071/updating-property-of-sibling-when-pseudo-element-changes</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 13:05:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/137071.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Jun 2022 06:34:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Updating property of sibling when pseudo-element changes on Wed, 08 Jun 2022 08:02:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/josef-lintz">@<bdi>Josef-Lintz</bdi></a><br />
Not that I have ever used QML, but I understand this is what its "property binding" system is good for.  If you were using HTML + CSS, you would have to code this action in JavaScript.  In Qt you must do it just the way you showed with a signal/slot action.</p>
]]></description><link>https://forum.qt.io/post/716853</link><guid isPermaLink="true">https://forum.qt.io/post/716853</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 08 Jun 2022 08:02:23 GMT</pubDate></item><item><title><![CDATA[Reply to Updating property of sibling when pseudo-element changes on Wed, 08 Jun 2022 07:46:44 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">As I also wrote</p>
<p dir="auto">(even if it were possible to read some other widget's state in a different widget, which it is not)</p>
</blockquote>
<p dir="auto">Oh, apologies, I missed that.<br />
That's very unfortunate. Thanks anyway.</p>
]]></description><link>https://forum.qt.io/post/716848</link><guid isPermaLink="true">https://forum.qt.io/post/716848</guid><dc:creator><![CDATA[Josef Lintz]]></dc:creator><pubDate>Wed, 08 Jun 2022 07:46:44 GMT</pubDate></item><item><title><![CDATA[Reply to Updating property of sibling when pseudo-element changes on Wed, 08 Jun 2022 07:35:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/josef-lintz">@<bdi>Josef-Lintz</bdi></a><br />
Stylesheets really are only for changing the <em>visual appearance</em> of elements, nothing more.  For example, they can alter how an enabled/disabled item <em>looks</em>, but not whether they are/are disabled.</p>
<p dir="auto">As I also wrote</p>
<blockquote>
<p dir="auto">(even if it were possible to read some other widget's state in a different widget, which it is not)</p>
</blockquote>
<p dir="auto">so, no, you cannot "change the visual appearance of sibling using another's pseudo-element".</p>
]]></description><link>https://forum.qt.io/post/716844</link><guid isPermaLink="true">https://forum.qt.io/post/716844</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 08 Jun 2022 07:35:18 GMT</pubDate></item><item><title><![CDATA[Reply to Updating property of sibling when pseudo-element changes on Wed, 08 Jun 2022 07:28:57 GMT]]></title><description><![CDATA[<p dir="auto">I see so you can't change the <code>enabled</code> state, using a stylesheet. That's unfortunate.<br />
Is there a way to change the visual appearance of sibling using another's pseudo-element?</p>
<p dir="auto">Similar to my C++ example, with a different property than <code>enabled</code>, say,<code>background-color</code>?</p>
]]></description><link>https://forum.qt.io/post/716840</link><guid isPermaLink="true">https://forum.qt.io/post/716840</guid><dc:creator><![CDATA[Josef Lintz]]></dc:creator><pubDate>Wed, 08 Jun 2022 07:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to Updating property of sibling when pseudo-element changes on Wed, 08 Jun 2022 07:16:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/josef-lintz">@<bdi>Josef-Lintz</bdi></a><br />
No, because (even if it were possible to read some other widget's state in a different widget, which it is not) stylesheets can do nothing other than visual appearance, they cannot do any kind of "action", such as altering enablement state.</p>
]]></description><link>https://forum.qt.io/post/716836</link><guid isPermaLink="true">https://forum.qt.io/post/716836</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 08 Jun 2022 07:16:29 GMT</pubDate></item></channel></rss>