title: Changing color of a pushButton in QT
body: <p>I want to Change the Color of a pushButton in QT after the button is clicked. The Problem is that when I have multiple Buttons all the pushbButton`s Colors Change. How can I make only the one i clicked on Change? PS: I am a beginner so it would be really nice if you could explain your solution in Detail, sry :D.</p>
  
  <p>My Code:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
      , ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  int i=1;
  
  void MainWindow::on_pushButton_clicked()
  {
      if((i==1))
      {
          setStyleSheet("QPushButton { background-color: grey; }\n"
                        "QPushButton:enabled { background-color: rgb(200,0,0); }\n");
          i=i+1;
  
      }
      else
      {
          if((i==2))
          {
              setStyleSheet("QPushButton { background-color: grey; }\n"
                            "QPushButton:enabled { background-color: rgb(0,200,0); }\n");
           i=i+1;
          }
          else
          {
              setStyleSheet("QPushButton { background-color: grey; }\n"
                            "QPushButton:enabled { background-color: rgb(0,0,200); }\n");
              i=i-2;
          }
      }
  
  }
  
  </code></pre>