I've changed the code and now it works!
Qt Code:
  1. QPushButton *NewButton= new QPushButton(this);
  2. NewButton->setText("Button");
  3.  
  4. actionsObj *ao= new actionsObj;
  5. connect(NewButton, SIGNAL(clicked()),ao, SLOT(ButtonClicked()));
  6. NewButton->setGeometry(50, 40, 300, 200);
  7. NewButton->show();
  8. //ui->setupUi(this);
To copy to clipboard, switch view to plain text mode 

the only problem now is that if I uncomment the last row the button isn't clickable anymore. What could be the problem?