I am trying to build a Qt application where more than one window can occur.
Example: there is a main window and there is a settings menu on it. When settings menu is clicked, I want that another window will show up with the title Settings and will show different setting properties for the program.
I want this setting window to be designed in Qt creator rather than creating by writing code only. I have designed settings window and added the setings.ui file to my project.
I also created settingsWindow.cpp and settingsWindow.h following the structure of mainWindow.h and mainWindow.cpp ( which were generated automatically when I created the gui project).
But when I compile, it shows error on the ui(new Ui::settingsWindow)
of settingsWindow constructor in settingsWindow.cpp
settingsWindow::settingsWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::settingsWindow)
{
ui->setupUi(this);
}
The error says: 'Ui::settingsWindow' : no appropriate default constructor available
Here is the content of settingsWinow.h:
#ifndef SETTINGSWINDOW_H
#define SETTINGSWINDOW_H
#include <QMainWindow>
namespace Ui
{
class settingsWindow;
}
class settingsWindow : public QMainWindow
{
Q_OBJECT
public:
explicit settingsWindow(QWidget *parent = 0);
~settingsWindow();
private:
Ui::settingsWindow *ui;
};
#endif // SETTINGSWINDOW_H
What should I do?