title: Change the background color of a QPushButton with QPropertyAnimation
body: <p>I'm trying to apply a soft color change to a QPushButton clicked event. My first approach with QPropertyAnimation works like a charm.</p>
  
  <p>header:</p>
  
  <pre><code>class myAnim : public QWidget
  {
      Q_OBJECT
      Q_PROPERTY(QColor color READ color WRITE setColor)
  
  public:
      explicit myAnim(QWidget *parent = 0);
  
      void setColor (QColor color){
          setStyleSheet(QString(" QPushButton { background-color: rgb(%1, %2, %3); }").arg(color.red()).arg(color.green()).arg(color.blue()));
      }
  </code></pre>
  
  <p>and source:</p>
  
  <pre><code>QPropertyAnimation *anim = new QPropertyAnimation(this, "color");
  anim-&gt;setDuration(300);                      // duration in ms
  anim-&gt;setStartValue(QColor(0, 0, 0);
  anim-&gt;setEndValue(QColor(249, 249, 249));
  anim-&gt;start();
  </code></pre>
  
  <p>But since my Button does have a lineargradient as a background I need more than one color to be changed. Tried it with changing the header like so:</p>
  
  <pre><code>void setColor (QColor color[3]){
          setStyleSheet(QString("QPushButton { background: qlineargradient(x1:0, y1:0, x2:0, y2:1,") +
                        QString("stop: 0    rgba(%1, %2, %3, 255),").arg( color[0].red() ).arg( color[0].green() ).arg( color[0].blue() ) +
                        QString("stop: 0.5  rgba(%1, %2, %3, 255),").arg( color[1].red() ).arg( color[1].green() ).arg( color[1].blue() ) +
                        QString("stop: 0.6  rgba(%1, %2, %3, 255),").arg( color[2].red() ).arg( color[2].green() ).arg( color[2].blue() ) +
                        QString("stop: 1    rgba(%1, %2, %3, 255),").arg( color[0].red() ).arg( color[0].green() ).arg( color[0].blue() ));
      }
  </code></pre>
  
  <p><strong>My question:</strong> How do I edit the "setStartValue" and "setEndValue" in the source file correctly??</p>
  
  <p><strong>EDIT 1:</strong>
  The buttons in my app look like this:
  <a href="http://i.stack.imgur.com/qcFYA.png" rel="nofollow">button_1</a></p>
  
  <p>Stylesheet of the QPushButton:</p>
  
  <pre><code>background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f9f9f9 , stop: 0.5 #B5B5B5 , stop: 0.6 #D6D6D6 , stop:1 #f9f9f9 );
  </code></pre>
  
  <p>Stylesheet for the pressed event:</p>
  
  <pre><code>background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #005da8, stop: 0.5 #2882cc, stop: 0.6 #418ecd, stop:1 #005da8);
  </code></pre>
  
  <p>After clicking the silver'ish gradient turns into a blue gradient. After releasing they should fade softly into the silver'ish look again.
  As previously said the first approach does exactly that but with only one flat color.
  I've never worked with QPainter or a custom paintEvent before so any help would be highly appreciated!</p>
  
  <p>Thanks!</p>
  
  <p>Micha</p>