A
A
al314152014-06-27 00:25:28
Qt
al31415, 2014-06-27 00:25:28

Qt does not see the signal, how to fix it?

Good afternoon. I made a slot in one class, a signal in another and connected them. The project builds, but the following entry appears in the output of the application:
QObject::connect: No such signal
Code connecting a signal and a slot

#include "UIManager.h" // в этот хедер включён ProjectTree.h
#include "SolutionManager.h"
#include "AlgorithmManager.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_Width(1200),
    m_Height(650)
{
    ui->setupUi(this);

    this->setCentralWidget(UIManager::GetInstance()->GetParentWidget());

    QObject::connect(UIManager::GetInstance()->GetProjectTree(),
                     SIGNAL(ProjectTree::AddedSolutionByUser(QString&)),
                     SolutionManager::GetInstance(),
                     SLOT(SolutionManager::AddNewSolutionByUser(QString&)));
}

class SolutionManager : public QObject{
    Q_OBJECT
// for implementation Singleton
protected:
    SolutionManager();
 
public:
    ~SolutionManager();
 
    ...
 
    static SolutionManager* GetInstance();
 
private slots:
    void                    AddNewSolutionByUser(QString& name);
};

class ProjectTree : public QWidget{
    Q_OBJECT
public:
    ProjectTree(QWidget* pwgt = 0);
 
    QTreeWidget*        GetParentWidget();
    QSplitter*          GetSplitter();
 
private slots:
    bool    SetProjectName();
 
    void    AddNewSolution();
    void    SetSolutionName();
    void    RemoveSolution();
 
    void    CreateContextMenu(QPoint pos);
    void    SetCurrentSolution(QTreeWidgetItem*, int);
    void    ItemCollapsedHandler(QTreeWidgetItem*);
 
signals:
    void    AddedSolutionByUser(QString& name);
 
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Danilevsky, 2014-06-27
@al31415

Instead of:

QObject::connect(UIManager::GetInstance()->GetProjectTree(),
                     SIGNAL(ProjectTree::AddedSolutionByUser(QString&)),
                     SolutionManager::GetInstance(),
                     SLOT(SolutionManager::AddNewSolutionByUser(QString&)));

Write:
<QObject::connect(UIManager::GetInstance()->GetProjectTree(),
                     SIGNAL(AddedSolutionByUser(QString&)),
                     SolutionManager::GetInstance(),
                     SLOT(AddNewSolutionByUser(QString&)));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question