<?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[QML button&#x27;s palette with enabled property]]></title><description><![CDATA[<p dir="auto">Hello</p>
<p dir="auto">I am using the raw of buttons to perform some actions and at the same time to represent the current state of the project. So I use <code>palette.button</code> to set the current color. When the button has been clicked by the user it should go to disabled state for the action running time. So I do <code>enabled = false</code>. All works as expected except that the button visually stays in the disabled state (text is faded) even after I re-enable it (<code>enabled = true</code>) though it is, in fact, active now (I can click on it and the action will propagate). It seems like non-default palettes aren't compatible with <code>enabled</code> property. Is it a known behavior or I'm missing something?</p>
<p dir="auto">I am using PySide2. QML imports are:</p>
<pre><code>import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.12
import QtQuick.Dialogs 1.3 as QtDialogs

import Qt.labs.platform 1.1 as QtLabs

import ProjectListItem 1.0
import Settings 1.0
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/9e65a90f-fc2c-4548-9a47-c1a27e3cc532.png" alt="screenshot1" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/112777/qml-button-s-palette-with-enabled-property</link><generator>RSS for Node</generator><lastBuildDate>Wed, 10 Jun 2026 20:57:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/112777.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Mar 2020 15:01:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QML button&#x27;s palette with enabled property on Sat, 28 Mar 2020 12:09:27 GMT]]></title><description><![CDATA[<p dir="auto">OK, I guess I should just set <code>buttonText</code> property explicitly when manipulating button's palette so the text always will be in the desired state. Not very elegant but anyway... Probably can use <code>State</code> component to group both changes in background and text under one thing.</p>
]]></description><link>https://forum.qt.io/post/585260</link><guid isPermaLink="true">https://forum.qt.io/post/585260</guid><dc:creator><![CDATA[Usserr]]></dc:creator><pubDate>Sat, 28 Mar 2020 12:09:27 GMT</pubDate></item><item><title><![CDATA[Reply to QML button&#x27;s palette with enabled property on Mon, 23 Mar 2020 06:55:13 GMT]]></title><description><![CDATA[<p dir="auto">I don't know. But: <a href="https://doc.qt.io/qt-5/qpalette.html#ColorRole-enum" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qpalette.html#ColorRole-enum</a> gives... something.<br />
But also, if you dig into source you could probably know what you are looking to seek (I don't know exactly your situation but you can find out).</p>
<p dir="auto">I.e. for me ( QML ) I'd start digging and find out how things are, places things like:<br />
"\Qt&lt;version&gt;&lt;kit&gt;\qml\QtQuick\Controls.2\Button.qml" for example:</p>
<pre><code>background: Rectangle {
    implicitWidth: 100
    implicitHeight: 40
    visible: !control.flat || control.down || control.checked || control.highlighted
    color: Color.blend(control.checked || control.highlighted ? control.palette.dark : control.palette.button,
                                                                control.palette.mid, control.down ? 0.5 : 0.0)
    border.color: control.palette.highlight
    border.width: control.visualFocus ? 2 : 0
}
</code></pre>
<p dir="auto">and if I'd used Material theme see@ "\Qt&lt;version&gt;&lt;kit&gt;\qml\QtQuick\Controls.2\Material\Button.qml" for example:</p>
<pre><code>color: !control.enabled ? control.Material.buttonDisabledColor :
            control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
</code></pre>
<p dir="auto">Anyhow, point is, you might find just a theme might do it - possibly not. In which case, you can always overwrite the background delegate for fine tuning yourself. Or any other section that doesn't quite do it for you.</p>
]]></description><link>https://forum.qt.io/post/584082</link><guid isPermaLink="true">https://forum.qt.io/post/584082</guid><dc:creator><![CDATA[6thC]]></dc:creator><pubDate>Mon, 23 Mar 2020 06:55:13 GMT</pubDate></item></channel></rss>