Sorry, I forgot to add the line in the last code.
I'm not trying to use the state machine right know. Since you said you would use animation direct, I'm trying to use the QPropertyAnimation class.
I define my TopBar as a private property of a class that inherits QWidget, using the code below:
Qt Code:
  1. namespace Ui {
  2. class TopBar;
  3. }
  4. /**...class code...*/
  5. private:
  6. Ui::TopBar *chrome;
To copy to clipboard, switch view to plain text mode 
I initialize it in the constructor doing this:
Qt Code:
  1. QWidget* activeChromeWidget = new QWidget();
  2. chrome->setupUi (activeChromeWidget);
To copy to clipboard, switch view to plain text mode 
I did not connect the buttons' signals to slots yet, so that's pretty much everything I do to initialize the TopBar. I get the compiler error in the animation code, at this method:
Qt Code:
  1. void WebWidget::setChromeStyleSheet(bool active) {
  2. QString activeStyle = "#TopBar{\n background-image: url(:/tbskin.png);\n background-repeat: no-repeat;\n background-color: rgba(255, 255, 255, 0);\n}";
  3. QString inactiveStyle = "#InactiveTopBar{\n background-image: url(:/tbskin_inactive.png);\n background-repeat: no-repeat;\n background-color: rgba(255, 255, 255, 0);\n}";
  4. if (!active) {
  5. QPropertyAnimation *anim = new QPropertyAnimation(chrome, "styleSheets"); //HERE I GET ONE COMPILER ERROR
  6. anim->setDuration(2);
  7. anim->setStartValue(activeStyle); //could not reach chrome->styleSheets value here, seems to be not accessible, using the actual value
  8. anim->setEndValue(inactiveStyle);
  9. anim->start();
  10. } else {
  11. QPropertyAnimation *anim = new QPropertyAnimation(chrome, "styleSheets"); //HERE I GET ANOTHER ONE COMPILER ERROR
  12. anim->setDuration(2);
  13. anim->setStartValue(inactiveStyle); //could not reach chrome->styleSheets value here, seems to be not accessible, using the actual value
  14. anim->setEndValue(activeStyle);
  15. anim->start();
  16. }
  17. }
To copy to clipboard, switch view to plain text mode 

Thanks for your attention