title: QtQuick colour palette for disabled widgets
body: <p>I am working on a Qt (QML) application that requires darker color palette. Based on some examples I created a <code>qtquickcontrols2.conf</code> file with the following content:</p>
  
  <pre><code>[Controls]
  Style=Fusion
  
  [Fusion\Palette]
  AlternateBase=#353535
  Base=#191919
  BrightText=red
  Button=#353535
  ButtonText=white
  Highlight=#2a82da
  HighlightedText=gray
  Link=#2a82da
  Text=white
  ToolTipBase=white
  ToolTipText=white
  Window=#353535
  WindowText=#dddddd
  </code></pre>
  
  <p>The colour palette works just fine for active mode of widgets. However, disabled widgets look exactly the same as active ones. I did not find a way to add colours for disabled widgets to the config file. It seems that it can't be done.</p>
  
  <p>Then I had an idea to create lighter version of active palette in application main.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>QPalette&amp; updateDisabledColors(QPalette &amp;palette)
  {
      palette.setColor(QPalette::Disabled, QPalette::Window, palette.window().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::WindowText, palette.windowText().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::Base, palette.base().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::AlternateBase, palette.alternateBase().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::Text, palette.text().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::Button, palette.button().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::ButtonText, palette.buttonText().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::BrightText, palette.brightText().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::Link, palette.link().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::Highlight, palette.highlight().color().lighter());
      palette.setColor(QPalette::Disabled, QPalette::HighlightedText, palette.highlightedText().color().lighter());
  
      return palette;
  }
  
  
  int main(int argc, char *argv[])
  {
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  
      QApplication app(argc, argv);
  
  // Tried to change palette here also
  
      QQmlApplicationEngine engine;
  
      engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
      if (engine.rootObjects().isEmpty()) {
          return -1;
      }
  
      auto palette = app.palette();
      palette = updateDisabledColors(palette);
      app.setPalette(palette);
  
      return app.exec();
  }
  
  </code></pre>
  
  <p>The palette acquired from the <code>app</code> is not the one defined in <code>qtquickcontrol2.conf</code>.</p>
  
  <p>What is the proper way to modify palette colours for disabled widgets when using QML?</p>