In my MainWindow there is a button that opens the MbulbWindow. There one can change some parameters and click a Generate button which calls the generateMBulb() function which does some calculation and in the end creates an object named entity of the class internalEntity.

Now I want to "send" this entity to the MainWindow where it will be saved for later use. But how do I do that? My idea was to create the transferEntity(internalEntity& entity) signal and connect it to the addEntity(internalEntity& entity) function of the MainWindow but Qt always gives an error message similar to the following:

Qt Code:
  1. QObject::connect: No such signal MbulbWindow::MBulbWindow::transferEntity() in ../MandelbulbUI_rewrite/mainwindow.cpp:15
  2. QObject::connect: (sender name: 'MbulbWindow')
  3. QObject::connect: (receiver name: 'MainWindow')
To copy to clipboard, switch view to plain text mode 

Here are my files:

mainwindow.h:

Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QWindow>
  6. #include <QAction>
  7. #include "mbulbwindow.h"
  8. #include "internalentityhandler.h"
  9.  
  10. QT_BEGIN_NAMESPACE
  11. namespace Ui { class MainWindow; }
  12. QT_END_NAMESPACE
  13.  
  14. class MainWindow : public QMainWindow
  15. {
  16. Q_OBJECT
  17.  
  18. public:
  19. MainWindow(QWidget *parent = nullptr);
  20. ~MainWindow();
  21.  
  22. private:
  23. Ui::MainWindow *ui;
  24. internalEntityHandler entityHandler; //Saves and manages entities
  25. MbulbWindow *mBulbWindow = new MbulbWindow;
  26. private slots:
  27.  
  28. //...
  29.  
  30. //Generate
  31. void showMBGenerator();
  32.  
  33. //internal entity management
  34. void addEntity(internalEntity& entity);
  35.  
  36. };
  37. #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.  
  12. //Connections
  13. internalEntity entity;
  14. connect(mBulbWindow, SIGNAL(MBulbWindow::transferEntity()), this, SLOT(addEntity()));
  15. //This is where I would make the connection
  16. }
  17.  
  18. MainWindow::~MainWindow()
  19. {
  20. delete ui;
  21. }
  22.  
  23. //...
  24.  
  25. //Generate
  26. void MainWindow::showMBGenerator(){
  27. mBulbWindow->show();
  28. }
  29.  
  30. //internal entity management
  31. void MainWindow::addEntity(internalEntity& entity){
  32. //Entity in memory:
  33. entityHandler.addEntity(entity);
  34.  
  35. //...
  36. }
To copy to clipboard, switch view to plain text mode 

mbulbwindow.h:

Qt Code:
  1. #ifndef MBULBWINDOW_H
  2. #define MBULBWINDOW_H
  3.  
  4. #include <QDialog>
  5. #include <vector>
  6. #include "boolcloud.h"
  7. #include "internalentityhandler.h"
  8.  
  9. namespace Ui {
  10. class MbulbWindow;
  11. }
  12.  
  13. class MbulbWindow : public QDialog
  14. {
  15. Q_OBJECT
  16.  
  17. public:
  18. explicit MbulbWindow(QWidget *parent = nullptr);
  19. ~MbulbWindow();
  20.  
  21. private:
  22. Ui::MbulbWindow *ui;
  23.  
  24. private slots:
  25. void generateMBulb();
  26. signals:
  27. void transferEntity(internalEntity& entity);
  28. };
  29.  
  30. #endif // MBULBWINDOW_H
To copy to clipboard, switch view to plain text mode 
mbulbwindow.cpp:

Qt Code:
  1. #include "mbulbwindow.h"
  2. #include "ui_mbulbwindow.h"
  3.  
  4. MbulbWindow::MbulbWindow(QWidget *parent) :
  5. QDialog(parent),
  6. ui(new Ui::MbulbWindow)
  7. {
  8. ui->setupUi(this);
  9.  
  10. //Connections
  11. connect(ui->ButtonGenerate, SIGNAL(clicked()), this, SLOT(generateMBulb()));
  12.  
  13. }
  14.  
  15. MbulbWindow::~MbulbWindow()
  16. {
  17. delete ui;
  18. }
  19.  
  20. void MbulbWindow::generateMBulb(){
  21.  
  22. //Calculation of "mBulb" object...
  23.  
  24. //Create entity
  25. internalEntity entity(mBulb, "Mandelbulb");
  26.  
  27. emit transferEntity(entity);
  28. //This entity needs to be transferred to the MainWindow
  29. this->close();
  30. }
To copy to clipboard, switch view to plain text mode