Hello all, I am completely new to this forum and quite new to QtCeator... I would like to ask some things about having multiple forms. Ok, let's say that we have a very simple program with only a button "Preferences". When you click this button a new Window (and not QMessageBox) is created with his own features etc... I know how to pop-up a MessageBox, but how do I open a whole new Window? The problem seems huge considering that you have to design its own ui and define its own settings.. Can anyone help me on this?
I give you the files:
mainwindow.h
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5.  
  6. namespace Ui {
  7. class MainWindow;
  8. }
  9.  
  10. class MainWindow : public QMainWindow {
  11. Q_OBJECT
  12. public:
  13. MainWindow(QWidget *parent = 0);
  14. ~MainWindow();
  15.  
  16. protected:
  17. void changeEvent(QEvent *e);
  18.  
  19. private:
  20. Ui::MainWindow *ui;
  21.  
  22. private slots:
  23. void on_pushButton_clicked();
  24. };
  25.  
  26. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp
Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9. }
  10.  
  11. MainWindow::~MainWindow()
  12. {
  13. delete ui;
  14. }
  15.  
  16. void MainWindow::changeEvent(QEvent *e)
  17. {
  18. QMainWindow::changeEvent(e);
  19. switch (e->type()) {
  20. case QEvent::LanguageChange:
  21. ui->retranslateUi(this);
  22. break;
  23. default:
  24. break;
  25. }
  26. }
  27.  
  28. void MainWindow::on_pushButton_clicked()
  29. {
  30. //Here the other window should open up
  31. }
To copy to clipboard, switch view to plain text mode 



main.cpp
Qt Code:
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication a(argc, argv);
  7. MainWindow w;
  8. w.show();
  9. return a.exec();
  10. }
To copy to clipboard, switch view to plain text mode 
Screenshot of Gui:

I have to say that I had the idea an other executable to run each time you press the button preferences but this is quite noob I think