title: How to set the QToolButton's icons using style sheet?
body: <p>I would like to set a QToolButton's icons using style sheets, like this :</p>
  
  <pre><code>#include &lt;QToolButton&gt;
  #include &lt;QApplication&gt;
  
  QString FormStyleSheetString( const QString &amp; name )
  {
    const QString thisItemStyle( "QToolButton:enabled { image: url(" + name + "_normal.png); }  "
                               "QToolButton:pressed { image: url(" + name + "_pressed.png); }  "
                               "QToolButton:disabled { image: url(" + name + "_disabled.png); }  "
                             );
  
    return thisItemStyle;
  }
  
  int main(int argc, char * argv[])
  {
      QApplication qapp(argc,argv);
  
      QToolButton button;
      button.setStyleSheet( FormStyleSheetString( "button" ) );
      button.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
      button.setIconSize(QSize(200,200));
      button.setText("some thing..." );
      button.show();
  
      return qapp.exec();
  }
  </code></pre>
  
  <p>I compiled it like this :  </p>
  
  <pre><code>g++ -O3 -std=c++0x -Wall -Wextra -pedantic test.cpp -lQtCore -lQtGui -I/usr/include/Qt/ -I/usr/include/QtCore/ -I/usr/include/QtGui/
  </code></pre>
  
  <p>Unfortunately, the above doesn't work (the icon is not shown).</p>
  
  <p>If I use <a href="http://doc.qt.nokia.com/4.7-snapshot/qabstractbutton.html#icon-prop" rel="nofollow noreferrer">setIcon</a>, then the icon is shown properly.</p>
  
  <p>So, what am I doing wrong? How to set the button's icon using style sheet?</p>
  
  <p>The images I used are :<br>
  <img src="https://i.stack.imgur.com/15b5Y.png" alt="button_normal.png">
  <img src="https://i.stack.imgur.com/bfV7l.png" alt="button_pressed.png">
  <img src="https://i.stack.imgur.com/Ls2Oo.png" alt="button_disabled.png"></p>
  
  <p>PS Take a note that I asked similar question <a href="https://stackoverflow.com/questions/8382421/how-to-set-a-qt-buttons-icons-using-stylesheet/8382759#8382759">here</a>, but the answer doesn't work once the text is set (the icon is all squished, and the text is not below the icon).</p>
  
  <p>EDIT 1:
  I also tried this function (as Kamil Klimek suggested) :</p>
  
  <pre><code>QString FormStyleSheetString( const QString &amp; name )
  {
    const QString thisItemStyle( "QToolButton { qproperty-icon: url(" + name + "_normal.png); };  "
                                 "QToolButton:pressed { qproperty-icon: url(" + name + "_pressed.png); };  "
                                 "QToolButton:hover { qproperty-icon: url(" + name + "_disabled.png); };  "
                                 );
  
    return thisItemStyle;
  }
  </code></pre>
  
  <p>but it also didn't work. Pressing the button, or hovering, doesn't change the icon.</p>