title: Set a button of custom color to a disabled style
body: <p>I have a class that inherits <code>QWidget</code>. Under certain circumstances, I wish to set it disabled.</p>
  
  <p>The widget has some color buttons, that are set from a list of colors:</p>
  
  <pre><code>void MyWidget::colorUpdate(QString color)
  {
      if(!color.isEmpty())
      {
          QString foreground = (QColor(color).lightness() &lt; 125 ? "white" : "black");
          m_colorButton-&gt;setStyleSheet("color: " + foreground + "; background-color: " + color);
      }
  }
  </code></pre>
  
  <p>Calling <code>myWidget.setEnabled(enabledOption);</code> disables the widget, grays out all text and every other items in the widget - except for these color buttons.</p>
  
  <p>So I am thinking of making my own action:</p>
  
  <pre><code>void MyWidget::setWidgetEnabled(bool enabled)
  {
      this-&gt;setEnabled(enabled);
      // what else ?
  }
  </code></pre>
  
  <p>How can I make my buttons - of a background color and text color that I don't know, but the button does - have that "disabled look" ?</p>
  
  <p>(Note - the color update works on disabled items too - that is not really complicated though - whatever style sheet I apply on setting widget disabled can be applied in the <code>colorUpdate</code> function).</p>
  
  <p>I just don't know how to apply a stylesheet with that gray shade - or possibly have a "disabled" option in the stylesheet even...<br>
  What do colors look like in "disabled" ? </p>