Qt Code:
  1. #include "example.h"
  2. #include "ui_example.h"
  3. #include "hi.h" //include the header file
  4.  
  5. example::example(QWidget *parent) :
  6. QMainWindow(parent),
  7. ui(new Ui::example)
  8. {
  9. ui->setupUi(this);
  10.  
  11. // note that the declaration of pointer can be done only once
  12.  
  13. connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(on_pushButton_clicked())); //connect... the signal with slot ...
  14.  
  15. }
  16.  
  17. example::~example()
  18. {
  19. delete ui;
  20. }
  21.  
  22. void example::on_pushButton_clicked()
  23. {
  24. //use the other class to instantiate the QDialog or the QDialog derived class (with or without ui)
  25.  
  26. hi *gamatos = new hi(this); //this is valid if the class name is "hi"... replace that with your class name //you need to pass 'this' as parent so that you don't get a memory leak
  27.  
  28. gamatos->show(); //you show the dialog
  29. }
  30.  
  31. void example::changeEvent(QEvent *e)
  32. {
  33. QMainWindow::changeEvent(e);
  34. switch (e->type()) {
  35. case QEvent::LanguageChange:
  36. ui->retranslateUi(this);
  37. break;
  38. default:
  39. break;
  40. }
  41. }
To copy to clipboard, switch view to plain text mode 

NOTE: the code changed a bit... i corrected in the previous post, but you already copied... you can't declare the pointer twice (you don't declare it in the constructor, only in the slot)